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.
Step-by-step guide
- Download the ZIP above, check its SHA-256 and unzip it.
- In the Discord Developer Portal create an application, open Bot, reset the token and copy it into DISCORD_TOKEN.
- Copy
.env.exampleto.env(or.dev.varsfor Workers) and paste the values. Never commit it. - Install dependencies and run the tests: they pass without network access.
- Run it locally with the commands in the Setup section and send your bot a message.
- Push the folder to a private GitHub repository so a host can build it.
Deploy on Railway
- Press Deploy on Railway below and sign in (it opens a new Railway project).
- Choose Deploy from GitHub repo and pick your repository. Railway detects the included
Dockerfile. - Open Variables and add:
DISCORD_TOKEN, GUILD_ID (optional). - No public domain is needed: the bot opens an outbound gateway connection.
- Watch the deploy logs until the bot reports it is running, then test it. Set a usage limit in your Railway workspace settings.
Affiliate link (referral code 8Mexkc): BotNetwork may earn a commission at no extra cost to you. The button opens Railway's new-project page; this template is not a published one-click Railway template, so you connect your own repository. Railway bills by usage: check its pricing page.
Next steps
- Related tutorial or comparison
- Tool: bot command generator
- Tool: permissions calculator
- Railway vs Vultr
Run with Docker
docker build -t discord-py .
docker run --rm --env-file .env discord-py