discord_bot_template.py
A minimal and open-source discord.py boilerplate for kick-starting bot projects.
I spend a lot of time developing bots for different communities on discord, and I find myself constantly rewriting the same basic boilerplate for each project. After searching for an existing template with no luck, I decided to write my own that'll suit any type of application.
So this repository includes an all inclusive bare-bones boilerplate for discord.py bot development that you can use as a basic skeleton for your next project.
Prerequisites
- Python 3.6 +
- The pip package management tool.
Disclaimer
Slash commands can take some time to register on guilds (usually an hour or two.) If you'd like to test a slash command beforehand, use the guild_ids in the command decorator to register them instantly.
@commands.slash_command(
name="command",
description="Command description",
guild_ids=[GUILD_ID1, GUILD_ID2] # The ID(s) of the guild(s) you wish to test.
)
Installation
- Clone the repository.
git clone https://github.com/tarranprior/discord_bot_template.py. - Navigate to the project folder.
cd "discord_bot_template.py". - Install the dependencies.
pip install -r requirements.txt. - Create an application at Discord Developer Portal. Build a bot, and copy the token.
- Invite the bot to your server/guild.
- Update the values in configuration
- Run the bot.
python discord_bot.py. - Start developing!
Configuration
-
Update the values in
SAMPLE.envand rename to.env.DISCORD_TOKEN = YOUR_BOT_TOKEN DISCORD_ADMIN = YOUR_USER_ID
-
Optional: Update the values in
config.json." "status": "discord_bot_template.py" }">{ "prefix": ">" "status": "discord_bot_template.py" }
Usage
This bot includes a handful of features that are useful for all development projects. For example, developer.py commands.
config- Update the bot's configuration (prefix, status etc.)purge- Deletes n messages.
License
This project is licensed under the MIT License - see the LICENSE file for details.