Startup → Docker Image → Python 3.13. Then upload these files.
The files
requirements.txt lists your packages, one per line:
discord.py>=2.4
python-dotenv
bot.py is the bot:
import os
import discord
from dotenv import load_dotenv
load_dotenv()
intents = discord.Intents.default()
client = discord.Client(intents=intents)
@client.event
async def on_ready():
print(f"Logged in as {client.user}")
client.run(os.environ["DISCORD_TOKEN"])
.env holds the token: DISCORD_TOKEN=your-token-here.
Don’t upload a venv folder. On start we install everything in requirements.txt (or your pyproject.toml), then run the first of main.py, bot.py, app.py, run.py that exists. Another name? Type it in Main file.
Good to know
- Message content: set
intents.message_content = True, and switch on Message Content Intent in the Developer Portal → your app → Bot. - Pycord or nextcord: put
py-cordornextcordinrequirements.txtinstead ofdiscord.py. Never install two of them together: they share the namediscordand break each other. - Print shows up late? It doesn’t here: output goes to the console right away.
- Voice and music: add
PyNaCltorequirements.txt.ffmpegis already installed. - A library needs an older Python: pick Python 3.12 in Docker Image.
- Stop sends Ctrl+C, which discord.py handles: the bot logs out cleanly.
More help: Run your Discord bot 24/7.