Norske-Nokkelsnikere / nokkelvokter-old

A work in progress Discord bot for use in CTFs
GNU General Public License v3.0
0 stars 0 forks source link

Zookeeper

This bot is still work in process. It is a fork of fiskebot, which is again a fork of eptbot, which is again a fork of igCTF, which is again a fork of NullCTF.

Install

Configuration is done through environment variables. They can be defined in an .env file, or used directly, see here for more information.

The only required variable is DISCORD_TOKEN, the rest will use the default values as specified in the table below. See config.py for more information.

Name Default Comment
DISCORD_TOKEN Required! Bot token, see config.py for more information
MONGODB_URI mongodb://mongo:27017 URI for the MongoDB instance
LOGGING_LEVEL INFO The level of logging for alerting, etc. Uses the logging levels specified here
LOGGING_FORMAT %(asctime)s:%(levelname)s:%(name)s: %(message)s Logging format, see here
LOGGING_FILE If enabled, will send logging to this file
LOGGING_DISCORD_LEVEL ERROR The minimum level for logging into the logging channel (CHANNEL_LOGGING_ID)
ARCHIVE_ACCESS_TO_ALL_USERS false Should all the users in the Discord Server gain access to the CTF channels when the CTF is archived? Set to true if so.
COMMAND_PREFIX ! Prefix for all the bot commands (i.e. !done)
MAINTAINERS Comma-separated list with profile IDs of the bot maintainers, these users have permission to export and delete CTFs
GUILD_IDS Comma-separated list with guild IDs of where the bot should run. Used for executing CTF channel cleanup manually
CATEGORY_WORKING working Category where channels for challenges that are currently being worked on during a CTF
CATEGORY_DONE done Category where channels for challenges that are marked as done during a CTF
CATEGORY_ARCHIVE_PREFIX archive Category to move channels to when the CTF is over. There is a max limit on 50 channels per category. The bot wil automatically move channels to new categories when needed
CHANNEL_EXPORT export The channel to upload exports to
CHANNEL_LOGGING_ID If enabled, will send logging to this channel, based on the LOGGING_DISCORD_LEVEL logging level
CHANNEL_NAME_DELIMITER The delimiter for the channel names, must be one of -, or _. Results in -: #ctf-challenge-name, and _: #ctf_challenge_name
CTFTIME_TEAM_ID CTFtime ID for the !ctftime team command
CTFTIME_TEAM_NAME CTFtime name for the !ctftime team command
REACT_FOR_CHALLENGE False If participants has to react to message to join challenge-threads

start

docker-compose up --build -d

develop

The /bot folder is mounted into the container, so you just need to restart to get your updated changes.

docker-compose build
docker-compose up # ctrl-c to stop and run up again to restart

linting

This codebase uses the PEP 8 code style. We enforce this with isort, black & flake8. In addition to the standards outlined in PEP 8, we have a few guidelines (see setup.cfg for more info):

First build the tester Docker image

$ make build

Format the code with black & isort

$ make fixme

To check if it is formatted properly, run:

$ make check

A git pre-commit hook for automatically linting before comitting can be found in git-hook, to install it:

$ cp git-hook .git/hooks/pre-commit

How to Use

The main use for fiskebot is to easily set up a CTF for your discord server to play as a team. The following commands listed are probably going to be used the most.


The following commands use the api from ctftime

Have a feature request? Make a GitHub issue.

Please upvote this feature request https://github.com/discord/discord-api-docs/discussions/6084