Multilingual Telegram bot that sends you notifications some time ahead the upcoming garbage collection. https://t.me/GarbageCollectionSchmittenBot
This repository has been archived on 2024-10-10. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
2024-05-31 00:03:24 +02:00
classes Improved docstrings and set some logging events to INFO level instead of DEBUG 2024-05-30 23:41:52 +02:00
locale Replaced "source code" with "learn more" 2024-05-31 00:03:24 +02:00
migrations Fixed downgrade for strings.url_updater config key 2024-05-30 12:51:47 +02:00
modules Fixed possible bugs and renamed pytz imports 2024-05-31 00:25:40 +03:00
plugins Removed wrong localize 2024-05-31 00:25:40 +03:00
validation Default time is now 16:00 2024-05-31 00:25:40 +03:00
.gitignore Initial commit 2023-08-27 22:43:16 +02:00
.renovaterc Initial commit 2023-08-27 22:43:16 +02:00
commands.json Initial commit 2023-08-27 22:43:16 +02:00
config_example.json Closes #48 2024-05-26 22:56:11 +02:00
LICENSE Added README.md and LICENSE 2024-05-11 11:36:16 +02:00
main.py Closes #49 2024-05-26 22:56:30 +02:00
README.md Added README.md and LICENSE 2024-05-11 11:36:16 +02:00
requirements.txt Changed pytz<=2024.1 to pytz>=2024.1 2024-05-31 00:55:07 +03:00

GarbageBot

License: GPL Code style: black

This bot reminds you about garbage collection for the location of your choice.

Dependencies

Use MongoDB's installation manual.

Installation

To make this bot run at first you need to have a Python interpreter, MongoDB and optionally git (if you want to update using git pull). You can also ignore git and simply download source code, should also work fine. After that you're ready to go.

In this README I assume that you're using default python in your system and your system's PATH contains it. If your default python is python3 or for example /home/user/.local/bin/python3.9 - use it instead.

  1. Install MongoDB:

  2. Download the bot:

    1. git clone -b dev https://git.end-play.xyz/GarbageReminder/TelegramBot.git (if you're using git)
    2. cd TelegramBot
  3. Create virtual environment [Recommended]:

    1. Install virtualenv module: pip install virtualenv
    2. Create venv: python -m venv .venv
    3. Activate it using source .venv/bin/activate on Linux, .venv\Scripts\activate.bat in CMD or .venv\Scripts\Activate.ps1 in PowerShell.
  4. Install project's dependencies:

    python -m pip install -r requirements.txt
    Without installing those - bot cannot work at all.

  5. Configure required keys with your favorite text editor:

    1. Copy config file: cp config_example.json config.json
    2. Open config.json using your favorite text editor. For example nano config.json, but you can also edit it with vim, mcedit, or Notepad/Notepad++ on Windows
    3. Change "bot.owner", "bot.api_id", "bot.api_hash" and "bot.bot_token" keys' values.

    If you don't know where to find bot_token and your id - here you can find some hints: get bot token, get your id, get api_hash and api_id.

  6. Configure database and API:

    • Configure database:
      1. Change database host and port in keys "database.host" and "database.port". For default local installation those will be 127.0.0.1 and 27017 respectively
      2. Change database name to the one you like in "database.name". It will be automatically created on start
      3. If you've changed user and password to access the db, you should also change "database.user" and "database.password" keys, otherwise leave them null (default).
  7. Good to go, run it!

    Make sure MongoDB is running and use python main.py to start the bot.

If you need any further instructions on how to configure your bot or you had any difficulties doing so - please use wiki in this repository to get more detailed instructions.

Localization

Bot is capable of using custom locales. There are some that are pre-installed (English, German and Ukrainian), however you can add your own locales too. Both locally and by contributing on our Weblate.

All localization files are located in the locale. Just copy locale file of your choice, name it in accordance to IETF language tags (if you want your locale to be compatible with Telegram's locales) or define your own name. Save it as json and you're good to go. If you want to change default locale for messages - edit "locale" parameter in the config.json.

We recommend to only make changes to your custom locale. Or at least always have your backup of for example en.json as your fallback.