Skip to content

n3sfan/CTFBot

Repository files navigation

CTFBot

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.

Features

  • /ctfcreate slash 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.

Tech Stack

  • Node.js 18+
  • Express
  • Discord Interactions API
  • CTFtime public API
  • CTFd registration flow helper

Setup

Create a Discord application and bot, then copy the environment template:

cp .env.sample .env
npm install

Fill .env with Discord application credentials, guild settings, and the CTF account information used by the registration helper.

Register slash commands:

npm run register

Run the bot locally:

npm run dev

For production:

npm start

Discord interactions require a public HTTPS endpoint. During development, use a tunnel such as ngrok and set the Discord interaction endpoint to /interactions.

Environment Variables

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.

Status

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.

License

MIT

About

Discord bot for CTF club operations with CTFtime event sync and CTFd registration helpers.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors