A template for a Discord bot written in Python with the py-cord
library.
- Sample config.ini file with comments
- Ready-made base bot (bot.py)
- Customizable config items
- backend.py for backend functions with the base already set up
- An example cog with a listener and a slash command
- A requirements.txt file with the required libraries needed
- Comments in the code to help you understand what's going on
- Clone the repository
- Install the required libraries with
pip install -r requirements.txt
- Edit the config.ini file with your bot's token and other settings you'd like to change
- Run the bot with
python bot.py
Adding a cog is easy. Just create a new file in the cogs
folder and add the following code:
from discord.ext import commands
class MyCog(commands.Cog):
def __init__(self, client):
self.bot = client
def setup(client):
client.add_cog(MyCog(client))
Replace MyCog
with the name of your cog. Then, add your commands and listeners to the cog.
If you'd like to contribute to this repository, feel free to make a pull request. I'll review it and merge it if it's good.
This project is licensed under the MIT License. See the LICENSE file for more details.