Giter Club home page Giter Club logo

sub_mecha's Introduction

๐Ÿค– SUB_Mecha ๐Ÿค–

A telegram Utility and Group Management bot

Made with python | Built by caidol

Requirements:


  1. Create a telegram bot using botfather

First run /newbot and provide a bot name

after that provide a bot username

image

You will receive a bot token which must be saved.


  1. Create an OWM API Token

Look at the instructions to get access the API and generate a token on Open weather map



Running the bot:

Edit all the values in config.yml to the correct values. Most important are the bot and OWM API token.

NOTE: use the config.yml and NOT the sample_config.yml. The sample_config is only there to provide an example.

image

Direct run - no use of Docker

  1. Install requirements.txt

It is recommended to create a venv for this so ensure that venv is installed

ai-dan@fedora~$ cd {program_directory}
ai-dan@fedora~$ python3 -m venv {venv_name}
ai-dan@fedora~$ source venv/bin/activate
ai-dan@fedora~$ (venv) pip install -r requirements.txt

If you don't wish to run a virtual environment then run the last command without running any others.

  1. Create the bot as a python package

Do this only if it hasn't already been created as a package.

ai-dan@fedora~$ pip install -e .
  1. Run the bot, ensuring that the user is in their virtual environment (venv).
ai-dan@fedora~$ python3 -m src

Docker run - use of Docker

First ensure that docker is installed. An install guide is here

  1. Create the docker container
ai-dan@fedora~$ sudo docker build -t {container-name} .
  1. Run the docker container
aidan@fedora~$ sudo docker run {container-name}


Deploy to cloud

This program uses PythonAnywhere which is simple to set up and great for running small Python programs with its free or paid plans.

Ensure that you have created an account on PythonAnywhere and at least used their free plan, otherwise other plans work just fine and could provide better processing power.

First, you must zip up the whole application recursively to upload it to PythonAnywhere, and then unzip it on the platform to run it.

ai-dan@fedora~$ cd {program_directory}
ai-dan@fedora~$ zip -r {zip_filename} {directory_path}

If you go to the Files section of PythonAnywhere, then you'll see the option to upload files as shown below

image

After uploading the files you must unzip them as shown below

ai-dan@fedora~$ unzip -D {zip_filename}
ai-dan@fedora~$ cd {unzipped_file}

From here you can use the manual method as explained above to run the bot. When you close the web application then you notice that the bot will still be running. Note that if you use PythonAnywhere with a free plan then you can only run the bot for a limited amount of time as the server bounces and resets. To resolve this you should note when the bot will reset and then run the program again. Otherwise, you should get a paid plan of PythonAnywhere to run the bot infinitely.




Thanks for checking out the program. If possible a star would be appreciated.

sub_mecha's People

Contributors

caidol avatar deepsource-io[bot] avatar

Stargazers

 avatar Thikal avatar  avatar Doloro avatar  avatar

Watchers

 avatar

Forkers

ryu-sama

sub_mecha's Issues

Remove Procfile

I'm no longer using Heroku as I couldn't get it working and PythonAnywhere can run the program infinitely for free and is simpler to set up.

Logger must be implemented across all modules.

I have only been printing data to the console as a form of debugging, however it's important that I start to log all the information down instead.

The logger object should be used to log information containing data or completed operations, as well as whenever an exception occurs in error handling statements.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.