ESN Docs

Docs › Discord bots

How to host a discord.py bot 24/7

3 min readUpdated Nov 3, 2026

Run your discord.py bot around the clock on ESN, without leaving your computer on. About 10 minutes from upload to online.

Before you start #

You need an ESN account (create one) and a bot plan from $0.50/month on the plans page. Most small bots run fine on Nano (256 MB) or Starter (512 MB); see how much RAM a bot needs.

  • Your bot works on your own computer with python main.py (or your main file).
  • A requirements.txt in the same folder that lists your packages, for example discord.py and python-dotenv. One package per line.
  • Your bot token from the Discord Developer Portal (how to get it).

Get your code ready #

import os
import discord
from discord.ext import commands
from dotenv import load_dotenv

load_dotenv()

intents = discord.Intents.default()
intents.message_content = True  # only if you use prefix commands or read messages

bot = commands.Bot(command_prefix="!", intents=intents)

@bot.event
async def on_ready():
    print(f"Logged in as {bot.user}")

bot.run(os.getenv("DISCORD_TOKEN"))

Put DISCORD_TOKEN=your-token-here in a .env file next to your main file. If you set message_content = True, also turn on Message Content Intent in the Developer Portal under Bot, or the bot will fail to connect (see privileged intents required).

Upload it to ESN #

  1. Open your server from the panel dashboard. It should be set up as Discord bot (Python).
  2. Go to Files and upload your files, or upload a .zip and choose Unarchive. Your main file, requirements.txt and .env must be in the top folder. Don't upload a venv folder. See uploading files.
  3. Go to Startup. The Main Python File is main.py by default. If your bot starts from bot.py, change it.
  4. On the same page, the Docker Image box offers Python 3.12 or 3.13. Current discord.py works on both.

Start it and keep it online #

  1. Go to Console and press Start. Every start runs pip install -r requirements.txt and then your main file.
  2. Wait for your own line, like Logged in as MyBot#1234. That means it's online.
  3. Close the tab. The bot keeps running on ESN when your PC is off.
  4. Added a package? Add it to requirements.txt and press Restart.

Common discord.py errors #

  • LoginFailure: Improper token has been passed: wrong or reset token. See fix it here.
  • PrivilegedIntentsRequired: turn the intent on in the Developer Portal. See this fix.
  • ModuleNotFoundError: No module named 'discord': the package is missing from requirements.txt. Note the package is discord.py, not discord. See this fix.
  • Missing intents argument: pass intents= to your client or bot. See this fix.
  • Keeps disconnecting: see discord.py bot keeps disconnecting.

FAQ #

Do I need a venv on the server?

No. The server installs your requirements.txt on every start. Leave your local venv folder out of the upload.

Does this work for py-cord or nextcord?

Yes. Put that package in requirements.txt instead of discord.py and the same steps apply.

Will my Python bot stay online when my PC is off?

Yes. It runs on ESN's servers, not your computer.

How much does it cost?

ESN bot hosting starts from $0.50/month. All plans are on panel.esnoffical.com/plans.

Host it on ESN. Discord bot hosting from $0.50/month, with a full control panel. See plans · or ask in the ESN Systems Discord.

Still stuck? Use the live chat on the panel or ask in the ESN Systems Discord. Last updated November 3, 2026.