CTFBot is a Discord bot for running CTF club operations from a server slash command. It connects Discord, CTFtime, and CTFd workflows so a student security club can create event channels, sync upcoming CTF events, and prepare team accounts faster.
/ctfcreateslash command for creating a Discord channel for an ongoing CTF event.- CTFtime integration for reading upcoming events and creating Discord scheduled events.
- CTFd registration helper for creating a team/account on supported CTFd instances.
- Discord role and category handling for isolating CTF event channels.
- Node.js 18+
- Express
- Discord Interactions API
- CTFtime public API
- CTFd registration flow helper
Create a Discord application and bot, then copy the environment template:
cp .env.sample .env
npm installFill .env with Discord application credentials, guild settings, and the CTF account information used by the registration helper.
Register slash commands:
npm run registerRun the bot locally:
npm run devFor production:
npm startDiscord interactions require a public HTTPS endpoint. During development, use a tunnel such as ngrok and set the Discord interaction endpoint to /interactions.
| Variable | Purpose |
|---|---|
APP_ID |
Discord application ID. |
DISCORD_TOKEN |
Discord bot token. |
PUBLIC_KEY |
Discord application public key for request verification. |
GUILD_ID |
Discord server ID. |
BOT_URL |
Public URL used in the Discord bot user agent. |
CTF_CATEGORY |
Discord category name where CTF channels are created. |
CTF_NAME |
Team/account name for CTFd registration. |
CTF_EMAIL |
Email for CTFd registration. |
PORT |
Optional HTTP port, defaults to 3000. |
This is a small club-operations tool. The code is intentionally direct and currently focuses on the workflows needed by the club rather than being a full multi-server Discord SaaS bot.
MIT