A comprehensive guide and example collection for building Discord bots with discord.py. This repository serves as a masterclass for both beginners and experienced developers looking to create feature-rich Discord bots.
Visit our comprehensive documentation to learn about:
- Creating your first Discord bot
- Understanding slash commands and hybrid commands
- Working with views, buttons, and interactive components
- Implementing cogs for better code organization
- Creating custom converters and checks
- Building pagination systems
- Error handling best practices
- Audio playback functionality
- Custom help commands
- And much more! ✨
- Python 3.9 or higher
- Git
- A Discord account and a bot token (Get one here)
-
Clone the repository
git clone https://github.com/FallenDeity/discord.py-masterclass.git cd discord.py-masterclass
-
Install Poetry (if you don't have it)
pip install poetry
-
Install dependencies
poetry install
-
Windows users only: Extra step for Cairo (required for documentation), use if cairo is giving you issues
pipwin install cairocffi
-
Set up your bot token
Create a
.env
file in the root directory:TOKEN=your_bot_token_here
-
Run an example
poetry run python examples/creating-a-bot/main.py
We love contributions! Whether you're fixing a bug, adding a new example, improving documentation, or suggesting new features, your help is appreciated.
Please read our Contributing Guidelines to get started. We welcome contributions of all kinds:
- Bug fixes
- New features and examples
- Documentation improvements
- Feature suggestions
poetry run mkdocs serve
Visit http://127.0.0.1:8000/discord.py-masterclass/
to view the documentation.
We use several tools to maintain code quality:
- Black: Code formatting
- isort: Import sorting
- Ruff: Fast Python linter
Run all checks:
poetry run black .
poetry run isort .
poetry run ruff check .
or use the pre-commit hooks:
poetry run pre-commit run --all-files
We appreciate all contributions from the community! A big thank you to everyone who has contributed to this project.
Triyan Mukherjee 💻 |
Vitness 💻 |
Mikołaj Kruczek 💻 |
thegamecracks 💻 |
Enrique Bos 💻 |
Snipy7374 💻 |
sarthak 💻 |
Krypton 💻 |
If you find this repository helpful, please consider giving it a star ⭐! It helps others discover this resource.