Skip to content

caidol/SUB_Mecha

Repository files navigation

🤖 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.

About

A Telegram Utility and Group Management bot.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published