A collection of utilities and extensions for discord.py bots.
- Python 3.10+
- discord.py 2.0+
You can run your own bot without writing any code.
You will need the following:
- Your own Discord Application with a bot token.
- A configuration file for the bot.
- A Python 3.10+ environment.
- It is recommended to use a virtual environment for this.
- You can use pyenv to build and run Python 3.10.
- If you have poetry, you can
poetry installinstead of usingpip. (Just make sure that dev dependencies are also installed.) Otherwise, you need to install a few packages withpip:- Run
pip install commanderbotto install the bot core package. - Run
pip install git+https://github.com/Rapptz/discord.py.git@848d752to install the latest (and final) version of the discord.py 2.0 beta from GitHub.
- Run
The first thing you should do is check the CLI help menu:
python -m commanderbot --helpThere are three ways to provide your bot token:
- (Recommended) As the
BOT_TOKENenvironment variable:BOT_TOKEN=put_your_bot_token_here - As a CLI option:
--token put_your_bot_token_here - Manually, when prompted during start-up
Here's an example that provides the bot token as an argument:
python -m commanderbot bot.json --token put_your_bot_token_hereThe current set of configuration options is limited. Following is an example configuration that sets the command prefix and loads the status and faq extensions.
Note that with this configuration, the
faqextension will require read-write access tofaq.jsonin the working directory.
{
"command_prefix": ">",
"extensions": [
"commanderbot.ext.status",
{
"name": "commanderbot.ext.faq",
"enabled": true,
"options": {
"database": "faq.json",
"prefix": "?"
}
}
]
}