Code Checker Telegram Bot (open source)
View on GitHub:
github.com/sukhrobyangibaev/code_checker
Code Checker is an interactive Telegram bot designed to bring daily coding challenges and automated code evaluation directly to Telegram users. Built with Python and leveraging the python-telegram-bot
library, it provides a seamless experience for both challenge creators and participants, making it ideal for coding clubs, study groups, and competitive programming communities.
The bot supports a full workflow: admins can post new challenges, users submit solutions as text or .py
files, and the bot automatically tests submissions, updates leaderboards, and tracks user progress—all within Telegram.
Key Features
- Daily Coding Challenges: Admins can easily add new problems, including descriptions, sample solutions (as text or images), and custom test cases.
- Automated Code Testing: User submissions are run against challenge-specific tests via a secure REST API (e.g., Glot.io), with instant feedback and detailed error reporting.
- Real-time Leaderboards: The bot maintains both all-time and daily leaderboards, ranking users by points, solution speed, and code length.
- Persistent User Progress: All user stats, solved challenges, and submissions are stored in a local SQLite database for reliability and easy backup.
- Rich Telegram Integration: Supports text and file submissions, inline HTML formatting, and photo-based solutions. Admin-only commands allow for challenge management and solution posting.
- Error Reporting: Robust error handling with automatic logging and developer notifications for quick troubleshooting.
Technical Architecture
- Backend: Written in Python, using the
python-telegram-bot
library for async Telegram API integration. The bot uses SQLite for persistent storage of users, challenges, and submissions. - Code Execution: Integrates with external code execution APIs (like Glot.io) to safely run user code against challenge-specific test suites.
- Database: Three main tables—Users, Challenges, and Solvers—track all relevant data, including user progress, challenge metadata, and submission results.
- Admin Workflow: Admins can add new challenges through a guided conversation, including uploading solution images or text and test files.
- Security & Logging: All actions are logged, and errors are reported to the developer via Telegram for rapid response.
Example Workflow
- User joins and starts the bot:
The bot registers the user and provides instructions. - Admin posts a new challenge:
Through a multi-step conversation, the admin submits the problem description, solution, and test cases. - Users submit solutions:
Users send code as text or.py
files. The bot runs the code, checks results, and updates leaderboards. - Leaderboards and solutions:
Users can view daily and all-time rankings, and after the challenge, the admin can post the official solution.
Technologies Used
- Python 3
- python-telegram-bot
- SQLite
- REST APIs (for code execution)
- AsyncIO
- dotenv (for environment configuration)
This project demonstrates how Telegram bots can be used to automate and gamify coding practice, making learning and competition more accessible and engaging for everyone.