A discord bot for CTF crafting based on Pycord.
Invite CTF Helper to your server: https://discord.cnily.me/invite/bot/ctf-bot
If you want to create your own bot, clone this repository to your computer.
git clone https://github.com/Cnily03/ctf-bot.git
Install requirements.
pip install -r requirements.txt
or if you use Poetry to manage your project, install as following.
poetry install
Make file token
at root directory, which contains Token of your discord bot .
Then start the program.
python ctf-bot
Edit config.yml
at the root directory.
BotController
is a packed abstract class of discord.Bot
, which can help control the bot more easily.
class BotController:
def __init__(self, bot: discord.Bot):
self.bot = bot
def use(self, plugin: AppPlugin):
plugin.apphandler(self.bot)
AppPlugin
is a abstract class for developers to create various plugins with colorful functions.
The implementation of API to connect with bot
is method apphandler
with a param bot
in type discord.Bot
.
class AppPlugin:
def apphandler(self, bot: discord.Bot): pass
class CustomPlugin(AppPlugin):
# do something here
def apphandler(self, bot: discord.Bot):
#do something here
bot = discord.Bot()
app = BotController(bot)
app.use(CustomPlugin())
Many functions in this project is implemented in this way.
All the commands python file is in commands
directory.
Remember to modify register_args
in __main__.py
after adding or removing a command.