A powerful and lightweight Discord bot for hosting and managing Capture The Flag (CTF) challenges in your server.
โจ Includes dynamic scoring, real-time flag validation, modals for admins, and a competitive leaderboard system.
- ๐ ๏ธ Create, edit, and delete CTF challenges via interactive modals
- ๐งฉ Flag submission with automatic validation
- ๐ Dynamic point system based on number of solves
- ๐ข Auto-announcement of new challenges
- ๐งโ๐คโ๐ง User profiles and leaderboard
- ๐ Separate help commands for users and admins
- ๐พ Data stored locally using SQLite
Each challenge begins with 1000 base points. As more players solve it, the point value decreases using the formula below:
points = Math.max(100, 1000 - (solves * 50));
- ๐ฅ First solver: 1000 points
- ๐ Each additional solver: -50 points
- โ Minimum value: 100 points
This scoring system promotes fast solving and balanced competition.
,help
Shows:
- How to submit flags
- View user stats and rank
- Access leaderboard
- General usage guide
,help-admin
Displays:
- Challenge management tools
- Format and category setup
- Required bot permissions
- Announcement and submission channel setup
๐ To use admin commands, set your admin role ID in the
.env
file:
ADMIN_ROLE_ID=your_discord_admin_role_id
Create a .env
file and fill in the following:
DISCORD_TOKEN=your_bot_token_here
ADMIN_ROLE_ID=your_discord_admin_role_id
ANNOUNCEMENT_CHANNEL=channel_id_for_announcements
SUBMISSION_CHANNEL=channel_id_for_flag_submissions
Refer to .env.example
for a prefilled template.
The bot uses SQLite to persist all data.
users
โ User ID, username, total points, rank, challenges solvedchallenges
โ Challenge info: name, category, difficulty, flag, pointssubmissions
โ Track when users submit flags and earn points
git clone https://github.com/hyperdargo/Discord-CTF-Bot
cd Discord-CTF-Bot
npm install
npm install discord.js dotenv sqlite sqlite3
Copy .env.example
to .env
and fill in your credentials.
node index.js
Admins can manage challenges directly through Discord modals. Fields include:
- name โ Challenge name
- difficulty โ Easy / Medium / Hard
- description โ Brief explanation
- category โ Web, Crypto, Forensics, etc.
- flag_format โ Expected format (e.g.,
flag{}
) - flag โ Actual flag
- links โ Optional resources
Release archive includes:
index.js
โ Main bot logic.env.example
โ Config templatepackage.json
โ Node.js dependency filerequirements.txt
โ Optional dependencies
Supported archive formats: .zip
, .tar
, .rar
, .7z
Contributions are welcome! Please open an issue or submit a pull request for any improvements.
This project is licensed under the MIT License - see the LICENSE file for details.
Enjoy the CTF Bot! ๐ถ If you like the bot, consider giving it a โญ on GitHub!