A Telegram bot designed to monitor GitHub repositories for new commits and notify users automatically.
The GitHub Commit Monitor Bot continuously tracks specified GitHub repositories and sends real-time notifications about new commits directly to your Telegram chat. It supports both public and private repositories with configurable monitoring intervals.
| Feature | Description |
|---|---|
| Multi-Repository Support | Monitor multiple GitHub repositories simultaneously |
| Real-Time Notifications | Instant alerts for new commits with detailed information |
| Private Repository Support | Monitor private repositories with proper GitHub token permissions |
| Multi-Language Interface | Available in English and Persian (Farsi) |
| Configurable Check Intervals | Adjustable monitoring frequency (default: 60 seconds) |
| Manual Check Capability | Trigger immediate repository checks on demand |
| Statistics Tracking | View monitoring statistics and system status |
| Admin Controls | Restrict bot access to authorized users only |
Before setting up the bot, ensure you have:
- GitHub Account with repositories to monitor
- Telegram Account and the Telegram app
- Python 3.7+ installed on your system
- Open Telegram and search for
@BotFather - Send
/newbotcommand - Follow the prompts to name your bot
- Save the provided bot token securely
- Go to GitHub Settings → Developer settings → Personal access tokens → Tokens (classic)
- Click "Generate new token (classic)"
- Name your token (e.g., "Telegram Bot Monitor")
- Select these scopes:
repo(for private repository access)public_repo(if only monitoring public repositories)
- Click "Generate token" and copy it immediately
- Clone or download the bot files to your server
- Install required dependencies:
pip install pyTelegramBotAPI requests python-dotenv
- Create a
.envfile with the following configuration:BOT_TOKEN=your_telegram_bot_token_here GITHUB_TOKEN=your_github_personal_access_token_here ADMIN_CHAT_IDS=your_telegram_user_id_here CHECK_INTERVAL=60 DATABASE_PATH=github_bot.db LOG_FILE=github_bot.log LOG_LEVEL=INFO - Replace
your_telegram_user_id_herewith your actual Telegram user ID (you can get this from@userinfoboton Telegram)
- Start the bot with:
python bot.py
- The bot will test the GitHub API connection and start monitoring
- Open Telegram and start a chat with your bot
- Send
/startto initialize the bot
| Command | Description | Example |
|---|---|---|
/start |
Initialize the bot and display welcome message | /start |
/help |
Display detailed usage instructions | /help |
/add |
Add a repository to monitor | /add username/repository-name |
/remove |
Remove a repository from monitoring | /remove username/repository-name |
/list |
List all monitored repositories | /list |
/check |
Manually check for new commits | /check |
/stats |
Display bot statistics and status | /stats |
/status |
Check GitHub API connection status | /status |
/language |
Change bot interface language | /language |
- Add repositories using the format:
username/repository-name - The bot automatically detects the default branch
- Notifications include:
- Commit message
- Author information
- Timestamp
- File change statistics
- Direct links to the commit and repository
- Database: SQLite for storing user preferences and repository data
- API Integration: GitHub REST API v3
- Monitoring: Background thread with configurable interval
- Error Handling: Comprehensive logging and error recovery
- Security: Admin-only access with configurable user IDs
Common issues and solutions:
- Bot not responding: Verify the bot token in
.envfile - Repository not found: Ensure the repository exists and the GitHub token has proper permissions
- No notifications: Check if the repository has new commits and verify the bot is running
- Connection errors: Validate GitHub token and internet connectivity
github-monitor-bot/
├── bot.py # Main bot application
├── config.py # Configuration settings
├── database.py # Database operations
├── github_api.py # GitHub API interactions
├── monitor.py # Repository monitoring logic
├── translation_manager.py # Multi-language support
├── translations.json # Language strings
└── .env # Environment variables (create this)
For additional assistance:
- Review the
/helpcommand in the bot - Check the log file for error messages
- Verify all tokens and IDs are correctly configured
The bot will automatically reconnect if temporary network issues occur and continue monitoring your repositories according to the configured interval.