← All posts

Host a discord.py Bot 24/7: Python Hosting That Just Works

October 17, 2026 discord.pydiscord bot hostingpython hostingdiscord.py tutorial24/7 bot hosting

For discord.py bot hosting, you need a host that runs Python 3.11, installs your requirements.txt automatically, persists your data files, and restarts the bot after a crash without looping. AtrbCode provides all of that on plans from $0.70 per month. Upload your bot project, store the token as an encrypted secret, and your bot runs 24/7.

What discord.py bot hosting requires to run 24/7

A discord.py bot is a Python asyncio application. To stay online it needs:

After the code runs, the rest is process management: ensuring it starts on boot, doesn't stop when you close your browser, and has enough RAM for your intents, caches, and music playback extras. That is why you host a discord.py bot instead of running it on your laptop.

From your laptop to an always-on host: deployment steps

Move your bot from a local Python process to a managed host in six steps.

  1. Create a bot application in the Discord Developer Portal. Go to Discord Developer Portal, create an application, add a bot, and copy the token. Keep that token private.
  2. Prepare your project folder. Have your main Python script, a requirements.txt that lists discord.py and any other dependencies, plus any cogs, config files, and data folders.
  3. Choose a plan. AtrbCode offers fixed monthly plans for Discord bot hosting:
Plan RAM Price per month
Starter Bot 256 MB $0.70
Pro Bot 512 MB $1.49
Ultra Bot 1024 MB $2.99

If your bot uses caching, voice, or large libraries, pick a plan with more RAM.
4. Upload your project. In the panel, upload your project files. The panel installs your requirements.txt dependencies and starts the bot. Multi-file projects with cogs and folders work as they are.
5. Add your token as an encrypted secret. Do not hardcode the token. Use the AtrbCode secret store, which encrypts it and checks your code for accidental token leaks. See Keep your Discord bot token safe.
6. Start the bot and check the logs. The panel shows console output. Confirm the bot logs in and your slash commands sync. If something fails, the error is in the logs; My Discord bot is offline or keeps crashing explains how to read it.

Automatic dependency installs: requirements.txt handled for you

When you upload a discord.py bot, the host must install the same Python packages you use locally. AtrbCode reads your requirements.txt during deployment and installs every listed package. If you don't include a requirements.txt, the panel can detect imports from your code and install the matching packages automatically.

Pin your dependency versions for reproducible builds. For example, discord.py==2.3.2 and aiohttp==3.9.5 ensure the same behavior on the host as on your laptop. Avoid relying on global packages that are not listed.

Persistent data and token security on AtrbCode

Discord bots often write files: a SQLite database for levels or warns, a JSON config that users edit from a dashboard, or cached messages. On AtrbCode, the /app/data directory is persistent. Store any file that must survive code updates or restarts there.

Token security is part of the hosting flow. AtrbCode stores secrets encrypted and has a token check that warns you if the bot token appears in your code. Never commit a token to a public repository; use the secret store and read the token from the environment.

Common crash causes for discord.py bots and how to fix them

Most discord.py outages are not host failures; they are code or configuration problems.

FAQ

Does AtrbCode support Python 3.11 for discord.py?

Yes. AtrbCode runs Python 3.11 for Discord bots. Your code and dependencies must be compatible with that version.

Can I host a discord.py bot for free?

No. AtrbCode does not offer a free Discord bot plan. Paid hosting starts at $0.70 per month for 256 MB RAM. Running on your own computer is free but goes offline when your machine sleeps or closes.

How do I keep my bot's database or files from being deleted?

Store files in the persistent /app/data directory. That folder survives code updates and restarts.

Does AtrbCode restart my bot if it crashes?

Yes. AtrbCode automatically restarts a crashed bot. If it crashes repeatedly in a loop, the host stops the loop and emails you so you can fix the code before restarting.

Can I use cogs and multiple Python files?

Yes. Upload your project with cogs, config folders, and other files. Multi-file projects work as they are. See Upload a multi-file bot (cogs, folders).

Ready to move your discord.py bot from your laptop to an always-on host? Start with the Discord bot hosting plans. Follow the step-by-step guide at Host a Discord bot 24/7 (Python, Node.js or Java) to deploy in minutes.

Need a website or a Minecraft server?

AtrbCode builds custom sites and hosts game servers from $0.69/month.

See what we do