➕ Add to Discord | ⭐ Vote on TOP.GG
An advanced and reliable Discord bot that automatically posts upcoming Capture The Flag (CTF) events from CTFtime.org to your server.
Stay organized, never miss a competition, and keep your CTF team informed automatically!
CTFTime is an independent website. This project is not affiliated with the CTFTime development team and does not intend to replace them. The name "CTFTimeBot" was chosen solely to make the bot's purpose immediately clear: the bot uses publicly available data on CTFtime.org by performing HTTP (GET) requests to the "upcoming events" page to retrieve events. For official information, updates, or issues related to the listed data, consult CTFtime.org or contact their team directly. This project does not in any way represent CTFtime.org. Profile images and any other multimedia content used come from their respective public sources; the copyright for such content is and remains assigned to the rightful owners, and this project does not claim ownership.
- 🔥 Firebase Realtime Database Integration: Complete migration from local JSON files to cloud-based persistent storage
- ☁️ Persistent Configuration: All settings survive bot restarts, crashes, and redeployments automatically
- Multi-server support: Each server (guild) has its own independent scheduling and configuration
- Robust scheduler management: The scheduler task is now tracked per-guild with a global registry, ensuring reliable status and restart
- Automatic scheduler restart: Any change to schedule channel, time, or timezone immediately cancels and restarts the scheduler for that server
- Auto-recovery on restart: Bot automatically restores all server configurations and schedulers from Firebase on startup
- Scheduler status and logs:
/scheduler_logsand/debugnow show accurate, real-time information about the scheduler and configuration for each server - Help command cleaned up:
/help_ctfnow only lists working and available commands - Advanced debug tools: Improved
/debugoutput, including config, permissions, and script checks - Safer task handling: The bot prevents duplicate or zombie scheduler tasks and always reflects the latest config
- Improved error handling: More robust feedback and error messages for all commands
- Cleaner code and documentation: All commands and help texts are up-to-date and reflect the real bot capabilities
- 24/7 hosting ready: Optimized for Render.com with automatic keep-alive and environment variable support
- ⏰ Automatic Daily Updates
The bot fetches and posts a list of upcoming CTF events every day at your preferred time. - 🔥 Firebase Cloud Storage
All configurations are stored in Firebase Realtime Database - survive restarts, crashes, and redeployments automatically. - ☁️ Zero Data Loss
Your settings persist forever in the cloud, no local file dependencies. - 🌍 Complete Timezone Support
Configurable for any timezone worldwide (Europe/Rome, America/New_York, Asia/Tokyo, etc.). - 🕐 Customizable Schedule Time
Set your preferred time for daily messages (not just midnight!). - 🗑️ Automatic Channel Cleanup
Automatically clears previous messages before sending updates. - 📅 CTF Events at a Glance
Displays event name, date, duration, and direct link for each upcoming competition. - 🔧 Advanced Debug Tools
Complete monitoring and diagnostic system for administrators. - 🌐 Data from CTFtime.org
Always up to date using official data directly from the CTFtime website. - 🏢 Multi-server aware
Each Discord server has its own independent configuration and scheduler. - 🔄 Automatic scheduler restart
Any change to channel, time, or timezone restarts the scheduler for that server. - 🔁 Auto-recovery
Bot automatically restores all configurations and restarts all schedulers after any restart. - 🛡️ Reliable scheduler status/logs
/scheduler_logsand/debugalways reflect the real state of the scheduler and config. - 🧹 Clean and up-to-date help
/help_ctfonly shows working commands.
| Command | Description |
|---|---|
/upcoming |
Immediately shows upcoming CTF events |
/upcoming_events |
Alias for /upcoming |
/help_ctf |
Shows all available commands |
| Command | Description |
|---|---|
/set_schedule_channel |
Sets current channel for daily messages (restarts scheduler) |
/unset_schedule_channel |
Removes scheduled channel (stops scheduler) |
/schedule_status |
Shows current scheduler status |
| Command | Example | Description |
|---|---|---|
/set_schedule_time <hour> [minute] |
/set_schedule_time 8 30 |
Sets time for messages (restarts scheduler) |
/get_schedule_time |
- | Shows currently set time |
/reset_schedule_time |
- | Resets time to midnight (restarts scheduler) |
| Command | Example | Description |
|---|---|---|
/set_timezone <timezone> |
/set_timezone Europe/Rome |
Sets timezone (restarts scheduler) |
/get_timezone |
- | Shows currently set timezone |
/list_timezones [region] |
/list_timezones Europe |
Lists available timezones |
/reset_timezone |
- | Resets to Europe/Rome (restarts scheduler) |
⚠️ Note: These commands require administrator permissions
| Command | Description |
|---|---|
/test_schedule |
Tests scheduled sending (with channel cleanup) |
/force_schedule |
Forces immediate sending of scheduled message |
/test_now |
Quick test without message deletion |
/clear_channel |
Clears all messages from scheduled channel |
/debug |
Shows detailed debug information (per-server) |
/scheduler_logs |
Checks scheduling task status (per-server, always accurate) |
/restart_scheduler |
Restarts scheduling task for this server |
1. /set_schedule_channel # In the channel where you want messages (restarts scheduler)
2. /set_schedule_time 8 0 # Set time (e.g., 08:00, restarts scheduler)
3. /set_timezone Europe/Rome # Set your timezone (restarts scheduler)
/schedule_status # Check that everything is configured
/test_now # Quick test
/force_schedule # Complete test with cleanup
The bot supports all standard timezones. Some examples:
Europe:
Europe/Rome(Italy)Europe/London(United Kingdom)Europe/Paris(France)Europe/Berlin(Germany)
America:
America/New_York(USA East)America/Los_Angeles(USA West)America/Chicago(USA Central)America/Toronto(Canada)
Asia:
Asia/Tokyo(Japan)Asia/Shanghai(China)Asia/Mumbai(India)Asia/Dubai(UAE)
Oceania:
Australia/SydneyPacific/Auckland
Use /list_timezones to see all available timezones or /list_timezones [region] for a specific region.
🎯 Invite CTFTime Notifier Bot from TOP.GG
The bot is hosted 24/7 and ready to use! Simply click the link above to add it to your Discord server.
Once invited to your server:
- Set your channel: Run
/set_schedule_channelin the channel where you want daily updates - Customize (optional):
/set_schedule_time 9 0- Set time (e.g., 09:00)/set_timezone Europe/Rome- Set your timezone
- Done! The bot will automatically post CTF events daily 🎉
Make sure the bot has these permissions:
- ✅ Send Messages - To post updates
- ✅ Manage Messages - To clear old messages
- ✅ Embed Links - To show formatted event cards
- Discord Bot Token: Create a bot at Discord Developer Portal
- Firebase Project: Set up Firebase Realtime Database (see FIREBASE_SETUP.md)
- Hosting Platform: Recommended: Render.com (free tier available)
git clone https://github.com/Mrk756/CtfTimeBot.git
cd CtfTimeBotFollow the complete guide in FIREBASE_SETUP.md to:
- Create a Firebase project
- Enable Realtime Database
- Download service account credentials
- Get your database URL
- Go to Render Dashboard
- Click "New +" → "Web Service"
- Connect your GitHub repository
- Configure:
- Name:
ctftime-bot(or your choice) - Environment:
Python 3 - Build Command: (leave empty, auto-detected from
requirements.txt) - Start Command: (auto-detected from
Procfile:python main.py) - Plan: Free
- Name:
In Render, go to Environment tab and add:
| Variable | Value | Where to Find |
|---|---|---|
DISCORD_TOKEN |
Your Discord bot token | Discord Developer Portal |
FIREBASE_DATABASE_URL |
https://your-project.firebaseio.com/ |
Firebase Console → Realtime Database |
FIREBASE_CREDENTIALS |
Entire JSON from credentials file | Downloaded from Firebase (paste full JSON) |
Important: For FIREBASE_CREDENTIALS, paste the entire content of your Firebase credentials JSON file.
Click "Create Web Service" - Render will automatically:
- Install dependencies from
requirements.txt - Start the bot with the
Procfile - Keep it running 24/7
git clone https://github.com/Mrk756/CtfTimeBot.git
cd CtfTimeBot
pip install -r requirements.txtCreate a .env file:
DISCORD_TOKEN=your_discord_bot_token
FIREBASE_DATABASE_URL=https://your-project-default-rtdb.firebaseio.com/
FIREBASE_CREDENTIALS_PATH=firebase-credentials.jsonPlace your Firebase credentials JSON file as firebase-credentials.json in the project root.
python main.pyRender free tier sleeps after 15 minutes of inactivity. Use UptimeRobot (free) to ping your bot every 5 minutes:
- Sign up at UptimeRobot
- Create a new monitor:
- Monitor Type: HTTP(s)
- URL: Your Render URL (e.g.,
https://ctftime-bot.onrender.com) - Monitoring Interval: 5 minutes
- Save - your bot will never sleep! 🎉
python-dotenv # Environment variables
nextcord # Discord API wrapper
beautifulsoup4 # HTML parsing for CTFtime.org
requests # HTTP requests
flask # Keep-alive web server
firebase-admin # Firebase Realtime Database
All automatically installed from requirements.txt.
- ✅ Never commit
.envfile or Firebase credentials to Git - ✅ Use environment variables for all secrets
- ✅ Firebase credentials are in
.gitignore - ✅ Configure Firebase security rules (see FIREBASE_SETUP.md)
- Check with
/scheduler_logsif the task is active (per-server, always up-to-date) - Verify configuration with
/debug(per-server) - Try
/restart_schedulerif necessary (reliable, per-server)
- Use
/list_timezonesto see valid timezones - Check current timezone with
/get_timezone - Reset with
/reset_timezoneif necessary
The bot needs these permissions:
- ✅ Send Messages
- ✅ Manage Messages (for channel cleanup)
- ✅ Embed Links
- Check
FIREBASE_DATABASE_URLis correct (no trailing/issues) - Verify
FIREBASE_CREDENTIALScontains valid JSON - Ensure Firebase security rules allow service account access
- Check Render logs for specific error messages
This should never happen with Firebase! The bot automatically restores all configurations when it comes back online.
If you experience issues:
- Use
/debugto check your current configuration - Try
/restart_schedulerto manually restart the scheduler - Contact support if the problem persists
2025 Major Updates:
- Multi-server support with per-guild configuration and scheduling
- Global scheduler task registry for robust status and restart
- Automatic scheduler restart on every config change (channel, time, timezone)
/scheduler_logsand/debugalways reflect the real state/help_ctfcleaned up and always up-to-date- Improved error handling and feedback
- No more zombie or duplicate scheduler tasks
Want to self-host or contribute to the bot? Here's what you need to know:
- Language: Python 3.13+
- Discord Library: nextcord
- Database: Firebase Realtime Database
- Web Scraping: BeautifulSoup4 + Requests
- Hosting: Render.com (or any Python hosting platform)
- Keep-Alive: Flask web server
git clone https://github.com/Mrk756/CtfTimeBot.git
cd CtfTimeBot
pip install -r requirements.txtFollow the complete guide in FIREBASE_SETUP.md to:
- Create a Firebase project
- Enable Realtime Database
- Download service account credentials
- Configure security rules
Create a .env file:
DISCORD_TOKEN=your_discord_bot_token
FIREBASE_DATABASE_URL=https://your-project-default-rtdb.firebaseio.com/
FIREBASE_CREDENTIALS_PATH=firebase-credentials.jsonOr for cloud deployment (e.g., Render):
DISCORD_TOKEN=your_discord_bot_token
FIREBASE_DATABASE_URL=https://your-project-default-rtdb.firebaseio.com/
FIREBASE_CREDENTIALS=<paste entire Firebase credentials JSON>python main.py- Fork this repository
- Create a new Web Service on Render
- Connect your GitHub repository
- Add environment variables (see step 3 above)
- Deploy! The
Procfileandrequirements.txthandle the rest
Render Configuration:
- Build Command: (auto-detected from
requirements.txt) - Start Command:
python main.py(fromProcfile) - Environment: Python 3
CtfTimeBot/
├── main.py # Main bot logic & commands
├── firebase_db.py # Firebase database abstraction
├── webserver.py # Flask keep-alive server
├── upcoming_events.py # CTFtime.org scraper
├── requirements.txt # Python dependencies
├── Procfile # Render deployment config
├── .env # Environment variables (local)
├── .gitignore # Git ignore rules
├── README.md # This file
└── FIREBASE_SETUP.md # Firebase setup guide
- ✅ Never commit
.envorfirebase-credentials.json - ✅ Use environment variables for all secrets
- ✅ Configure Firebase security rules (see
FIREBASE_SETUP.md) - ✅ Keep dependencies updated
Contributions are welcome! To contribute:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Areas for contribution:
- Bug fixes
- New features (e.g., more CTF platforms)
- Documentation improvements
- Code optimization
- FIREBASE_SETUP.md - Complete Firebase setup guide
- requirements.txt - Python dependencies
- Procfile - Deployment configuration
This project is open source and available under the MIT License.
- Need help? Use
/help_ctfin Discord - Bug reports: GitHub Issues
- Vote for the bot: TOP.GG ⭐
- CTF events data from CTFtime.org
- Built with nextcord
- Persistent storage with Firebase
- Hosted on Render
- Available on TOP.GG
Keep your CTF team always updated! 🚀
➕ Add to Discord | ⭐ Vote on TOP.GG | 🐛 Report Issues
Need help? Check FIREBASE_SETUP.md for detailed setup instructions or open an issue on GitHub.