The BluScreen Discord bot is designed to integrate with the Blugold Group's activities and operations and to enable functionality directly through the Discord server. It facilitates seamless synchronization between Discord and the main website for managing CTFs, challenges, bounties and more.
- Slash commands featuring modals and simple GUI
- Sync CTF challenge points from the main website with users' Discord nicknames
- View CTFs, Challenges, and Submit Flags
- Create and manage CTFs and Challenges
- Daily reminders for closing-soon CTFs
- Display a leaderboard for CTFs/similar events
- Link Discord account with main site through a simple OTP system
- Commands for admins and server members to view and manage features from the main site
This Discord bot is developed in Python. It makes use of Nextcord, a fork of discord.py. Nextcord was used as discord.py has been abandoned in the past. The two are relatively similar, and porting between them is fairly easy.
Cogs are groups of alike commands. They are great at preventing long files and for allowing future ease-of-development and documentation.
Views contains files for UI-based code. Commands that make use of modals, custom UI, etc, will have a file in views/.
utils/ contains utility-based functions. api.py contains functions primarily for contacting the main site via its API endpoints.
Commands follow common Discord bot command structure: /<command> <arguments>. Below is a list of all currently implemented commands:
/leaderboardDisplay the current CTF challenge points leaderboard in the server/listctfsDisplay a list of CTFs, with their associated IDs, names, descriptions, and start/end dates/listchallengesView challenges for a selected CTF, as well as buttons to submit FLAG{}s.
/syncpointsUpdates all users' server nicknames to include their current challenge points total (e.g., points earned from CTF challenges on the main site). Note: This command skips over bots and server owners. Bots are excluded by default, and server owners' nicknames cannot be changed by bots due to Discord's role hierarchy./createctfCreate a new CTF, specifying name, start date, and end date./createchallengeAdd a new challenge to an existing CTF
- Event Reminders sends automated reminders to a specified channel when a specified amount of time is left before the CTF closes.
- Sync Points automatically runs
/syncpointsat a specified frequency
- Clone this repository:
git clone https://github.com/EekRats/BluScreenBot cd BluScreenBot - Install the required dependencies:
pip install -r requirements.txt
- Create a file named
.envcontaining:DISCORD_TOKEN=<token from Discord Bot Developer Portal> API_URL=<API route for main site. blugold.group/api/ at time of writing> BLU_API_KEY=<BLU_API_KEY also defined on main site> - Edit
config.pyto customize bot behavior:- Set the Discord Guild ID, automatic syncpoints frequency, time left to CTF reminder, and more.
COMMAND_PREFIXis deprecated and mostly unused. Slash commands are now implemented
- Run the bot:
python bot.py
BluScreen is designed to run alongside the Blugold Group's main website. Ensure that:
- The bot can access the site's API
- The bot has the necessary permissions on the Discord server
Contributions to BluScreen are welcome and encouraged! If you have any ideas or want to fix inevitable bugs, feel free to submit a pull request, create a fork, or open an issue; or, just mess around with the code and learn something new!
This project is licensed under the MIT License. See the LICENSE file for details. This software will, to the best of its ability, abide by the principles of Free and Open Source Software, meaning it is to be shared, modified, contributed to, etc.