A modular Telegram group management bot running with Python based on Pyrogram.
- Python 3.8 or higher (recomended).
- Telegram API key.
- Telegram Bot Token
- MongoDB Database.
Set up your bot configuration variables by renaming confing.env_sample
to config.env
and edit it with your own values.
Install all required dependencies by running
pip3 install -r requirements.txt
.
Once everyting set up, start the client by running
python3 -m anjani_bot
We try our best to simplify module creation.
All you need is a <plugin>.py
file in anjani_bot/plugins
.
Import the Client from anjani_bot import anjani, plugins
.
Create a class that inherit with plugins.Plugins
And give that Class name attribute to name the plugin. eg:
from anjani_bot import anjani, plugin
class class_name(plugin.Plugin):
name: "plugin name"
Then to add a handler use a decorator @anjani.on_command("<trigger>")
or other update handler. Command Trigger can be a string
or a list of strings
.
The __migrate__()
function is used for migrating chats - when a chat is upgraded to a supergroup, the ID changes, so it is necessary to migrate it in the DB.
You may send us a pull request to help translating other languages.