This python package runs simple telegram bot. Current functionality:
-
Antispam: Bot will block any user who will send message to chat with words from listbanned_phrasesinconfig.yaml.-
/bancommand: If someone replies some message with/bancommand, bot will run the same check. You can run/ban_add <phrase>to add some phrase from the sus message to the list of banned phrases, and after successfull poll, reply to sus message with/ban. Now bot will detect banned phrase in sus message and will ban the user. -
/ban_addcommand:/ban_add <phrase>starts poll to add thephraseto the list of banned phrases. Count of voters defined inconfig.yamlfile, for more details please checkREADME.mdin config repository. If poll decision will be to add phrase to the list, bot will save new list and push changes to the config repository.
-
-
Chat join approval: If some user will send request to join the chat, bot will automatically approve it. Ifbotwill send request to join the chat, it will be declined.
In order to run the bot, you will need to create and obtain bot token using BotFather.
In order to run the bot you need make command. It's not mandatory, you still can trigger it using python directly, but for simplification Makefile is prepared.
If you don't have make command, you can install it using your package manager, for example:
sudo dnf install -y make
Bot configuration file is stored in a separate repository (check .gitmodules) and accessed using git submodules.
Bot can update it's configuration file and then push these changes to the repo. Also it's periodically checks for latest updates from repository.
If you don't have git command, you can install it using your package manager, for example:
sudo dnf install -y git
But in order to keep your changes separately, you will need to create your own repository with config.yaml file, and update git submodules to sync config/ to your repository. Also you need to configure your system (git ssh keys), so than bot can push changes to that repository.
In order to manage python version, mise is used. You can install it using make:
make prepare
This will update your PATH variable in ~/.bash_profile, so you will need to reload it:
source ~/.bash_profile
To run the bot:
make TOKEN='<BOT_TOKEN>'
You also can use environment variable TELEGRAM_TOKEN:
export TELEGRAM_TOKEN='<BOT_TOKEN>'
make