Deploy a Python bot
Host a discord.py, Pycord, Telegram or any other Python bot on NGP Cloud.
1. Prepare your project
Your folder needs:
- Your main file, for example
bot.pyormain.py. - A
requirements.txtlisting every package you import:
discord.py==2.4.0
python-dotenv==1.0.1
aiohttp
2. Pick your Python version
On the panel's Startup tab, choose a Docker Image matching the Python version you develop with (3.11 or newer is a good default).
3. Upload and configure
- Upload your files to the main folder with the file manager or SFTP. Don't upload
venv/or__pycache__/. - On Startup, set:
- the main file variable to your entry file (e.g.
bot.py), - the requirements file variable to
requirements.txt.
- the main file variable to your entry file (e.g.
- Click Start. Packages are installed from
requirements.txton boot, then your bot runs.
Load your token safely
Keep your token in a .env file instead of your code:
import os
from dotenv import load_dotenv
import discord
load_dotenv()
TOKEN = os.getenv("DISCORD_TOKEN")
intents = discord.Intents.default()
intents.message_content = True
client = discord.Client(intents=intents)
client.run(TOKEN)
More in Environment variables for bots.
Common errors
| Console message | Fix |
|---|---|
ModuleNotFoundError: No module named 'x' | Add the package to requirements.txt and restart. |
discord.errors.LoginFailure: Improper token | Check DISCORD_TOKEN in .env - it may have been reset. |
PrivilegedIntentsRequired | Enable the intent in Discord Developer Portal → Bot → Privileged Gateway Intents. |
| Nothing prints at all | Python buffers output - use print(..., flush=True) or the logging module. |
Still stuck? Open a ticket on Discord - run /ticket in any channel, pick a department, and include your Server ID or Invoice ID so we can jump straight in.