discord.py · /ping
A Python slash-command bot with an isolated environment and a test-server setup.
Files generated locally. No credentials needed to download.
Before you start
Python 3.12 or 3.13, a Discord application and a dedicated test server.
Dependencies
- discord.py 2.7.1
- python-dotenv 1.2.3
Run locally
- 1
Create a virtual environment: python3 -m venv .venv. Activate it, then run python -m pip install -r requirements.txt.
- 2
Copy .env.example to .env and fill in your token and guild ID locally. Install the bot with bot and applications.commands scopes.
- 3
Run python main.py and try /ping. setup_hook synchronizes this starter’s command tree in the selected test server.
Environment checklist
DISCORD_TOKENRequired · secret- Bot token from the Discord Developer Portal. Never include it in a ZIP.
DISCORD_GUILD_IDRequired- ID of a test server you manage.
What is not included
Use a separate test application: tree.sync replaces that application’s guild command set. Message Content intent is not required.
The configurator prepares files and settings. Confirm deployment, add your credentials in Environment and check Console to verify startup.
Official documentation
README.md
# discord.py · /ping
A Python slash-command bot with an isolated environment and a test-server setup.
## Requirements
Python 3.12 or 3.13, a Discord application and a dedicated test server.
## Setup
1. Create a virtual environment: python3 -m venv .venv. Activate it, then run python -m pip install -r requirements.txt.
2. Copy .env.example to .env and fill in your token and guild ID locally. Install the bot with bot and applications.commands scopes.
3. Run python main.py and try /ping. setup_hook synchronizes this starter’s command tree in the selected test server.
## Variables
- DISCORD_TOKEN: Bot token from the Discord Developer Portal. Never include it in a ZIP.
- DISCORD_GUILD_ID: ID of a test server you manage.
## Boundaries
Use a separate test application: tree.sync replaces that application’s guild command set. Message Content intent is not required.
Downloading does not deploy anything. The Botkeep preview stores files in your browser but does not execute processes, install packages or activate networking. Do not enter real credentials in the demo. Direct dependencies are versioned: keep generated lockfiles and review updates and vulnerabilities before production.
## Sources
- discord.py · commands: https://discordpy.readthedocs.io/en/stable/interactions/api.html