Skip to content

FallenDeity/discord.py-masterclass

Discord.py Masterclass

Code formatter and linter License: MIT Python Version discord.py

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.

Documentation

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! ✨

Quick Start

Prerequisites

  • Python 3.9 or higher
  • Git
  • A Discord account and a bot token (Get one here)

Installation

  1. Clone the repository

    git clone https://github.com/FallenDeity/discord.py-masterclass.git
    cd discord.py-masterclass
  2. Install Poetry (if you don't have it)

    pip install poetry
  3. Install dependencies

    poetry install
  4. Windows users only: Extra step for Cairo (required for documentation), use if cairo is giving you issues

    pipwin install cairocffi
  5. Set up your bot token

    Create a .env file in the root directory:

    TOKEN=your_bot_token_here
  6. Run an example

    poetry run python examples/creating-a-bot/main.py

Contributing

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

Development

Running the Documentation Locally

poetry run mkdocs serve

Visit http://127.0.0.1:8000/discord.py-masterclass/ to view the documentation.

Code Quality

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

Contributors

We appreciate all contributions from the community! A big thank you to everyone who has contributed to this project.

Triyan Mukherjee
Triyan Mukherjee

💻
Vitness
Vitness

💻
Mikołaj Kruczek
Mikołaj Kruczek

💻
thegamecracks
thegamecracks

💻
Enrique Bos
Enrique Bos

💻
Snipy7374
Snipy7374

💻
sarthak
sarthak

💻
Krypton
Krypton

💻

If you find this repository helpful, please consider giving it a star ⭐! It helps others discover this resource.

About

A tutorial/guide explaining all features in discord.py and how to make a discord bot from scratch.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 9