This is the source code of my Telegram bot.
- Git, lol
- Python (3.10 or later) or Docker (preferably with docker-compose)
- A Telegram Bot API token
- Clone the repo, obviously.
- Save your token into the
token.txtfile in the root of the repo. - You might want to make yourself an admin of the bot.
To do that, put your Telegram id to the
admins.txtfile in the root of the repo.
- For the ease of development, you can copy the
docker-compose.debug.ymlfile todocker-compose.override.yml: it increases the verbosity of logging and disables auto-restarts of the service. - Just run
docker-compose up- Set up a
venv:
python3.10 -m venv venv
source venv/bin/activate- Install the dependencies:
pip install -r requirements.txt- Run the code:
python3 -m junior- You can change logging verbosity by passing a
LOGLEVELenv variable. Like this if you're on Linux:
LOGLEVEL=DEBUG python3 -m junior- You can change the path to the sqlite database file
by passing a
DATABASE_FILEenv variable. - You can change the path to the file with bot admin ids
by passing a
BOT_ADMINS_FILEenv variable. - You can change the path to the file with your token
by passing a
BOT_TOKEN_FILEenv variable. - Or you can just directly pass the token via a
BOT_TOKENenv variable. - And you can change the path to bot's tmp directory
by passing a
TMP_DIRenv variable.
Just open a pull request or an issue! I'll be grateful.
rustbranch: an abandoned attempt to rewrite the same bot in Rust.python-oldbranch: my old Telegram bots, written in Python a long time ago (not too proud of that code).javabranch: an abandoned attempt to rewrite my old bots into Java.