Template

Discord bot (Python, discord.py 2)

App commands with a CommandTree, default intents only, guild sync for fast iteration and mentions disabled.

Download ZIP (5.0 KB)

SHA-256: 1e5236190975f271965326e018ec57932bac7bde5075d33ade5750c922c845f3 (checksum file)

Stack: Python 3.10+, discord.py 2.x · License: MIT · Files: 12

What it includes

App commands with a CommandTree, default intents only, guild sync for fast iteration and mentions disabled.

File tree

discord-py/
├── bot/
│   ├── __init__.py
│   ├── logic.py
│   └── main.py
├── tests/
│   └── test_logic.py
├── .dockerignore
├── .env.example
├── .gitignore
├── Dockerfile
├── LICENSE
├── README.md
├── requirements-dev.txt
└── requirements.txt

Setup

unzip discord-py.zip && cd discord-py
python -m venv .venv && . .venv/bin/activate
pip install -r requirements-dev.txt
cp .env.example .env
set -a; . ./.env; set +a; python -m bot.main
pytest -q

Fill in .env with credentials from the platform's official developer console. Never commit it: the included .gitignore excludes it.

Run with Docker

docker build -t discord-py .
docker run --rm --env-file .env discord-py

Official documentation

https://discordpy.readthedocs.io

All templates