TLE is a feature-packed Discord bot aimed at competitive programmers
(Codeforces, CSES, …).
It can recommend problems, show stats & graphs, run duels on your server
and manage starboards – all with a single prefix ;
.
If you have Docker ≥ 24 (or Docker Desktop on Win/Mac) you are ready to go.
Cog | What it does |
---|---|
Codeforces | problem / contest recommender, rating changes, user look-ups |
Contests | shows upcoming & live contests |
Graphs | rating distributions, solved-set histograms, etc. |
Handles | link Discord users to CF handles |
CSES | CSES leaderboard, problem info |
Starboard | pins popular messages to a channel |
CacheControl | warm-up & manage local caches |
All graphs require cairo + pango; the Docker image already contains everything.
# 1 · clone the repo
git clone https://github.com/cheran-senthil/TLE
cd TLE
# 2 · create a config file
cp .env.example .env # then edit BOT_TOKEN, LOGGING_COG_CHANNEL_ID …
# 3 · build & start the bot (first run takes ~2 min)
docker compose up -d
That’s it.
The bot will appear online in your Discord server; use
;help
inside Discord to explore commands.
git pull
docker compose build --pull # fetch newer base images
docker compose up -d # zero-downtime restart
Variable | Required | Example | Description |
---|---|---|---|
BOT_TOKEN |
✅ | MTEz… |
Discord bot token from the Dev Portal |
LOGGING_COG_CHANNEL_ID |
✅ | 123456789012345678 |
channel where uncaught errors are sent |
ALLOW_DUEL_SELF_REGISTER |
❌ | true |
let users self-register for duels |
TLE_ADMIN |
❌ | Admin |
role name that can run admin cmds |
TLE_MODERATOR |
❌ | Moderator |
role name that can run mod cmds |
Feel free to add any extra variables your cogs consume; Compose passes
every key in .env
to the container.
docker compose
mounts ./data
into the container.
It holds:
- Codeforces caches & contest writers JSON
- downloaded CJK fonts (~36 MB, fetched automatically)
You can back this directory up or move it to a dedicated volume; wiping it only means the bot will re-download items on first run.
You can hack on the code without touching your system Python:
# live-reload dev run (blocks & shows logs)
docker compose up --build
Lint & format (Ruff):
docker run --rm -v $PWD:/app -w /app python:3.11-slim \
sh -c "pip install ruff && ruff check . && ruff format --check ."
.
├─ Dockerfile # 2-stage image, installs native cairo stack
├─ compose.yaml # single-service compose file
├─ requirements.txt # runtime Python deps (no pins)
├─ .env.example # template for your secrets
├─ data/ # persisted cache & fonts (git-ignored)
├─ tle/ … # bot source code
└─ extra/ fonts.conf … # helper resources
Pull requests are welcome!
Before opening a PR, please
- run
ruff check --fix .
(auto-formats touched lines), - keep commits focused; large refactors in a separate PR.
MIT ― see LICENSE
.