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.py or main.py.
  • A requirements.txt listing 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

  1. Upload your files to the main folder with the file manager or SFTP. Don't upload venv/ or __pycache__/.
  2. On Startup, set:
    • the main file variable to your entry file (e.g. bot.py),
    • the requirements file variable to requirements.txt.
  3. Click Start. Packages are installed from requirements.txt on 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 messageFix
ModuleNotFoundError: No module named 'x'Add the package to requirements.txt and restart.
discord.errors.LoginFailure: Improper tokenCheck DISCORD_TOKEN in .env - it may have been reset.
PrivilegedIntentsRequiredEnable the intent in Discord Developer Portal → Bot → Privileged Gateway Intents.
Nothing prints at allPython 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.