Local Development & Testing¶
To test your features locally, there are a few possible approaches:
Install your local copy of pydis_core into a pre-existing project such as bot
Use the provided template from the dev/bot folder
See below for more info on both approaches.
What’s going to be common between them is you’ll need to write code to test your feature. This might mean adding new commands, modifying existing ones, changing utilities, etc. The steps below should provide most of the groundwork you need, but the exact requirements will vary by the feature you’re working on.
Option 1¶
Navigate to the project you want to install bot-core in, such as bot or sir-lancebot
Run
pip install /path/to/pydis_core
in the project’s environmentThe path provided to install should be the root directory of this project on your machine. That is, the folder which contains the
pyproject.toml
file.Make sure to install in the correct environment. Most Python Discord projects use poetry, so you can run
poetry run pip install /path/to/pydis_core
.
You can now use features from your local bot-core changes. To load new changes, run the install command again.
Option 2¶
Copy the bot template folder to the root of the bot-core project. This copy is going to be git-ignored, so you’re free to modify it however you like.
Run the project
Locally: You can run it on your system using
python -m bot
Docker: You can run on docker using
docker compose up -d bot
.
Configure the environment variables used by the program. You can set them in an
.env
file in the project root directory. The variables are:BOT_TOKEN
(required): Discord bot token, with all intents enabledGUILD_ID
(required): The guild the bot should monitorPREFIX
: The prefix to use for invoking bot commands. Defaults to mentions and!
ALLOWED_ROLES
: A comma seperated list of role IDs which the bot is allowed to mention
You can now test your changes. You do not need to do anything to reinstall the library if you modify your code.
Tip
The docker-compose included contains services from our other applications to help you test out certain features. Use them as needed.