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.txt
file 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.txt
file in the root of the repo.
- For the ease of development, you can copy the
docker-compose.debug.yml
file 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
LOGLEVEL
env 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_FILE
env variable. - You can change the path to the file with bot admin ids
by passing a
BOT_ADMINS_FILE
env variable. - You can change the path to the file with your token
by passing a
BOT_TOKEN_FILE
env variable. - Or you can just directly pass the token via a
BOT_TOKEN
env variable. - And you can change the path to bot's tmp directory
by passing a
TMP_DIR
env variable.
Just open a pull request or an issue! I'll be grateful.
rust
branch: an abandoned attempt to rewrite the same bot in Rust.python-old
branch: my old Telegram bots, written in Python a long time ago (not too proud of that code).java
branch: an abandoned attempt to rewrite my old bots into Java.