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:
- Python 3.11: AtrbCode runs Python 3.11, so code that runs on your machine runs on the host.
- Dependency installation: Your bot's imports must be installed. On AtrbCode, adding a
requirements.txtmakes the panel install all packages automatically. - A place for files that survive restarts: Use the persistent
/app/datadirectory for SQLite databases, JSON files, or caches. Files there are kept when you upload new code. - Crash recovery: If your bot throws an unhandled exception, AtrbCode restarts it. If it crashes repeatedly, the panel stops the loop and emails you so you can read the error.
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.
- 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.
- Prepare your project folder. Have your main Python script, a
requirements.txtthat listsdiscord.pyand any other dependencies, plus any cogs, config files, and data folders. - 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.
- Missing privileged intents. If your bot needs message content, members, or presences, enable those intents in the Discord Developer Portal. Otherwise the gateway closes the connection.
- Blocking the event loop. Using
requestsortime.sleepinside an async function freezes the bot. Replace them withaiohttpandasyncio.sleep. - Incomplete
requirements.txt. A missing package or a wrong version causes an import error on startup. Test locally in a fresh virtual environment before deploying. - Discord rate limits. Sending too many API requests returns a 429. Add exponential backoff or use libraries that handle it.
- Crash loops. If a bot crashes on startup every time, AtrbCode stops the restart loop and emails you. Read the error log, fix the code, and redeploy. The guide My Discord bot is offline or keeps crashing walks through diagnostics.
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.