Skip to content

dimasma0305/ctf-assistant

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

CTF Assistant Bot

A comprehensive Discord bot designed for CTF (Capture The Flag) teams to manage competitions, coordinate team activities, and track events from CTFTime.org.

Documentation License: ISC Discord

Features

  • ๐Ÿ CTFTime Integration: Automatically fetch and schedule CTF events from CTFTime.org
  • ๐Ÿ‘ฅ Role Management: Automated role assignment with reaction-based signup system
  • ๐Ÿ“… Event Scheduling: Create Discord scheduled events for upcoming CTFs
  • ๐Ÿ’ฌ Channel Organization: Automatically create dedicated channels for each CTF
  • ๐Ÿ”’ Private Events: Support for internal team competitions with password protection
  • ๐ŸŽฎ Team Activities: Notification system for team coordination and updates
  • ๐Ÿ“Š Event Tracking: Monitor current and upcoming CTF competitions
  • ๐Ÿ—„๏ธ Database Integration: MongoDB integration for persistent data storage

Quick Start

Prerequisites

  • Bun or Node.js 18+
  • MongoDB database
  • Discord Bot Token with appropriate permissions

Installation

  1. Clone the repository:

    git clone https://github.com/dimasma0305/ctf-assistant.git
    cd ctf-assistant
  2. Install dependencies:

    bun install
    # or
    npm install
  3. Configure environment variables:

    cp .env.example .env
    # Edit .env with your configuration
  4. Start the bot:

    bun start
    # or
    npm start

Development Mode

Run with auto-reload:

bun dev
# or
npm run dev

Documentation

๐Ÿ“š Full Documentation - Comprehensive guide with examples and troubleshooting

Quick links:

Commands Overview

CTFTime Commands

Manage external CTF competition participation.

Command Description Permissions
/ctftime current Display currently running CTFs Everyone
/ctftime upcoming [days] Show upcoming CTF events Everyone
/ctftime schedule <id> Schedule a CTF event Managers
/ctftime delete [id] Delete CTF resources Managers
/ctftime archive <id> Archive a CTF event Managers
/ctftime rebind <id> Fix role assignment system Managers
/ctftime help Show help information Everyone

Notify Commands

Automated notification system for CTF updates.

Command Description Permissions
/notify register [channel] [event_type] Register channel for notifications Mabar Manager
/notify unregister [channel] Unregister from notifications Mabar Manager
/notify list View registered notification channels Managers

Solve Commands

Challenge tracking and team leaderboards.

Command Description Permissions
/solve init Initialize challenges from platform JSON Everyone
/solve challenge [players] Mark challenge as solved Everyone
/solve delete Delete solve record Server Owner
/solve list List all solved challenges Everyone
/solve leaderboard Display solve leaderboard Everyone
/solve refresh Refresh challenges from platform Everyone

Event Commands

Command Description Permissions
/event gen Generate event registration form link Manage Events

Clean Commands

Command Description Permissions
/clean all [limit] Delete recent messages in channel Manage Messages
/clean username <user> [limit] Delete messages from specific user Manage Messages

CTFEvent Commands

Command Description Permissions
/ctfevent role Create challenge author role assignment Everyone
/ctfevent rebind <id> Rebind role listeners to message Everyone

Utility Commands

Command Description Permissions
/ping Check bot status Everyone
/join Join CTF event (in development) Everyone
/mencari Team recruitment utilities Manage Roles

Configuration

Environment Variables

Create a .env file with the following variables:

# Discord Configuration
DISCORD_TOKEN=your_discord_bot_token
CLIENT_ID=your_discord_client_id
GUILD_ID=your_discord_guild_id

# Database Configuration
MONGODB_URI=mongodb://localhost:27017/ctf-assistant

# Optional Configuration
NODE_ENV=production

Required Discord Permissions

The bot requires these permissions:

  • Manage Roles
  • Manage Channels
  • Manage Events
  • Send Messages
  • Embed Links
  • Add Reactions
  • Read Message History

Required Discord Roles

Create these roles in your Discord server:

  • Mabar Manager: Full bot administration
  • Gas Mabar: Can schedule CTF events
  • CTF Waiting Role: Auto-assigned to CTF participants

Development

Project Structure

ctf-assistant/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ Commands/          # Slash commands
โ”‚   โ”‚   โ”œโ”€โ”€ Public/        # Public commands (CTFTime, Notify)
โ”‚   โ”‚   โ””โ”€โ”€ ...
โ”‚   โ”œโ”€โ”€ Events/            # Discord event handlers
โ”‚   โ”œโ”€โ”€ Functions/         # Utility functions
โ”‚   โ”œโ”€โ”€ Database/          # MongoDB schemas
โ”‚   โ””โ”€โ”€ Model/             # TypeScript interfaces
โ”œโ”€โ”€ docs/                  # Documentation
โ”œโ”€โ”€ scripts/               # Utility scripts
โ””โ”€โ”€ index.ts              # Entry point

Building Documentation

# Install documentation dependencies
pip install -r docs/requirements.txt

# Serve documentation locally
npm run docs:serve

# Build documentation
npm run docs:build

# Deploy to GitHub Pages
npm run docs:deploy

See docs/CONTRIBUTING.md for detailed documentation guidelines.

Database Scripts

# Populate database with sample data
npm run populate-db

# Clear and repopulate database
npm run populate-db:clean

Contributing

We welcome contributions! Please see our Contributing Guide for details.

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Troubleshooting

Common Issues

Bot not responding to commands:

  • Verify the bot is online and has proper permissions
  • Check slash commands are registered (restart bot if needed)

Permission denied errors:

  • Ensure user has required roles (Mabar Manager or Gas Mabar)
  • Verify bot permissions in server settings

CTF scheduling fails:

  • Verify the CTF ID from CTFTime.org is correct
  • Check bot has "Manage Roles" and "Manage Channels" permissions

For more troubleshooting help, see the documentation.

Technology Stack

  • Runtime: Bun / Node.js
  • Language: TypeScript
  • Framework: Discord.js v14
  • Database: MongoDB with Mongoose
  • Documentation: MkDocs Material
  • CI/CD: GitHub Actions

License

This project is licensed under the ISC License - see the LICENSE file for details.

Support

Acknowledgments


Made with โค๏ธ by the TCP1P team for CTF teams worldwide.

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 98.9%
  • Other 1.1%