Fix Deployment (Docker/Pillow/Fonts) & Implement Advanced Alerts Cog#542
Closed
soadmahmud wants to merge 17 commits intocheran-senthil:masterfrom
Closed
Fix Deployment (Docker/Pillow/Fonts) & Implement Advanced Alerts Cog#542soadmahmud wants to merge 17 commits intocheran-senthil:masterfrom
soadmahmud wants to merge 17 commits intocheran-senthil:masterfrom
Conversation
added 8 commits
January 19, 2026 20:37
…rtup crash and corrected rank logic
added 7 commits
January 21, 2026 19:28
Collaborator
|
I think it's very unlikely we will accept much other than bugfixes. Fixing the font download is a bugfix I'm happy to accept. Similar for the docker setup issues, but there we have a bunch of PRs already. |
Contributor
Author
|
Understood. I’ll submit a pull request only if I find any bugs or issues in the existing codebase. |
algmyr
added a commit
that referenced
this pull request
Jan 31, 2026
algmyr
added a commit
that referenced
this pull request
Jan 31, 2026
Now targets github hosted files which should be more stable.
algmyr
added a commit
that referenced
this pull request
Jan 31, 2026
Co-authored-by: Soad Mahmud <108691772+soadmahmud@users.noreply.github.com>
algmyr
added a commit
that referenced
this pull request
Jan 31, 2026
Now targets github hosted files which should be more stable. Co-authored-by: Soad Mahmud <108691772+soadmahmud@users.noreply.github.com>
Collaborator
|
Extracted the relevant fixes into #543. Added you as co-author to the relevant commits. |
algmyr
added a commit
that referenced
this pull request
Jan 31, 2026
Co-authored-by: Soad Mahmud <108691772+soadmahmud@users.noreply.github.com>
algmyr
added a commit
that referenced
this pull request
Jan 31, 2026
Now targets github hosted files which should be more stable. Co-authored-by: Soad Mahmud <108691772+soadmahmud@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes critical deployment issues preventing the bot from running on modern Docker environments (Debian 12/Ubuntu 24.04). It also completely re-implements the missing alerts module with robust contest reminders, ranklists, and milestone celebrations.
🔧 Infrastructure & Bug Fixes
Dockerfile Fixes:
Updated system dependencies (libcairo2-dev, pkg-config, libgirepository1.0-dev) to allow pycairo and PyGObject to compile correctly on Python 3.11.
Fixed AttributeError: 'FreeTypeFont' object has no attribute 'getsize' by pinning Pillow<10.0.0.
Font Downloader Fix:
Replaced broken Google Storage links (403 Forbidden) with direct GitHub raw links for NotoSansCJK.
Removed zip extraction logic as the new source provides raw .ttc files.
Configuration (constants.py):
Added logic to automatically convert Role IDs from strings to integers in .env, preventing MissingAnyRole errors.
Database Handling:
Fixed a crash in alerts logic where user data was returned as tuples instead of objects, causing AttributeError: 'tuple' object has no attribute 'handle'.
🚀 New Features (Alerts Cog)
Re-wrote tle/cogs/alerts.py from scratch with the following features:
1. Robust Contest Reminders
Supports Codeforces, AtCoder, LeetCode, and CodeChef.
Direct API Connections:
Codeforces: Uses official API directly (bypassing internal wrapper to prevent attribute errors).
AtCoder: Uses Kenkoooo API for stability.
Others: Uses kontests.net as a fallback.
Sends alerts 24 hours, 1 hour, and 15 minutes before contests.
2. Automatic Ranklists & Rating Updates
Automatically detects when a Codeforces round finishes and ratings are updated.
Filters results to show only server members.
Smart Retry Logic: Looks back 14 days with a 5-day timeout to catch delayed Div. 4 rating updates without getting stuck in infinite loops.
Instant Role Update: Triggers a cache reload immediately after posting results to update Discord role colors faster.
3. Milestone Celebrations
Detects when a user promotes to a new rank (e.g., Pupil → Specialist).
Posts a congratulatory embed with the user's Codeforces Profile Picture.
Automatically triggers the ;plot rating command to show their progress graph.
📝 New Commands