Docs › Discord bots › Course
Part 5: Keep your bot online 24/7 on ESN Hosting
Part 5 of the Python Discord bot course: why the bot goes offline with your PC, then upload it to ESN Hosting, set bot.py and the token, start it, and add restarts and backups.
- Part 1: Create the bot account
- Part 2: Hello world with a /ping command
- Part 3: Real commands, embeds, buttons and cogs
- Part 4: Save data with SQLite
- Part 5: Keep it online 24/7 on ESN (you are here)
Right now your bot lives on your computer. Close the terminal, shut the lid or lose Wi-Fi, and it goes offline, because your computer is the server. To keep it online all the time it needs to run on a machine that never turns off. This part moves it to ESN Hosting.
1. Get a bot server #
Pick a bot plan on the ESN plans page. Bot hosting starts at $0.50/month, and the smallest plan is enough for this course's bot. Choose the Discord bot (Python) type. If you're new to ESN, create an account first.
2. Upload your files #
- Open your server on the panel and go to Files.
- Upload
bot.py,requirements.txtand thecogsfolder (zip it, upload the zip, then use Unarchive). They must be in the top folder, not inside another folder. - Don't upload
.venvor__pycache__. The server installs packages itself fromrequirements.txt. - Upload
data.dbonly if you want to keep the points from your computer.
Your requirements.txt from Part 4:
discord.py
python-dotenv
aiosqlite
3. Add your token #
In Files choose New File, put one line in it and save it as .env in the top folder:
DISCORD_TOKEN=paste-your-token-hereYour code already reads it with load_dotenv(), so nothing else changes.
4. Set the start file and Python version #
- Open Startup. The Main Python File variable is
main.pyby default. Change it tobot.py. It saves on its own. - In Docker Image, pick Python 3.12 to match the course.
5. Start it #
Go to Console and press Start. Each start installs the packages from requirements.txt first (slow the first time, quick after), then runs your bot. Wait for:
Loaded 2 cog(s), synced 6 slash command(s)
Logged in as YourBot#1234 (ID: ...)Your bot is online and stays online after you close the panel and turn off your computer. The panel can keep showing Starting for a bot; if the console shows the login line, it's running.
6. Add a daily restart and backups #
- Restart schedule: in Schedules, create a daily restart at a quiet time. It clears memory build-up. See schedules.
- Backups: your points live in
data.db. Make a backup before big changes and download a copy now and then. See backups.
Updating your bot later #
Edit the code on your computer, test it there with a separate test bot (its own application and token) if you can, then upload the changed files over the old ones and press Restart.
You finished the course #
You built a bot with slash commands, embeds, buttons, cogs and a database, and it runs 24/7. Ideas for what's next: a welcome message (needs the Server Members intent), moderation commands with permission checks, or reaction roles with buttons. Stuck on anything? Ask in the ESN Systems Discord.
FAQ #
Why does my bot go offline when I turn off my PC?
Because the bot is a program running on your PC. When the PC sleeps or the terminal closes, the program stops and Discord shows the bot as offline. A host runs it on a machine that stays on.
How much RAM does this bot need?
Very little. A small discord.py bot like this one usually runs comfortably in the smallest bot plan. See how much RAM a Discord bot needs.
The console says ModuleNotFoundError.
The package is missing from requirements.txt, or the file is named wrong or isn't in the top folder. See fix ModuleNotFoundError.
Still stuck? Use the live chat on the panel or ask in the ESN Systems Discord. Last updated November 3, 2026.