Guide
Keep a Discord bot online 24/7: why bots go offline and what actually works
A bot is online while its process runs and stays connected to Discord. It goes offline when the process crashes, the token stops working, or the host stops it. Most "my bot keeps going offline" problems are crashes, so start there.
Why bots go offline
- Crashes: an unhandled error ends the process. Log errors instead of letting them throw (see below).
- Token reset: if the token leaked or was reset in the Developer Portal, the bot cannot log in until you put the new one in
.env. - Out of memory: large caches or music processing exceed the plan's RAM. Check the RAM calculator.
- The host stops it: free hosting usually has conditions. On our free tier, that is the weekly check-in.
Stop crashes first
Catch errors at the top level so one bad interaction does not take the bot down:
// discord.js
client.on('error', (err) => console.error('Client error:', err));
process.on('unhandledRejection', (err) => console.error('Unhandled rejection:', err));
# discord.py
@tree.error
async def on_app_command_error(interaction, error):
print(f'Command error: {error!r}')On the Bot page, the crash and restart timeline shows when the bot stopped, and a crash loop (the bot dying again right after each start) is called out so you know to read the log instead of restarting again.
Your options for running around the clock
| Option | Online when | Cost |
|---|---|---|
| Free bot tier | While you use the panel or app, or press Keep online, at least once every 7 days. After 7 days without that, the bot is stopped (never deleted), with a reminder 24 hours before. Pressing Start brings it back. | Free, with ads in the panel |
| Always On add-on | Keeps one free bot running without the weekly check-in. It stays a free bot with the same resources; ads stay. If the add-on lapses, the bot goes back to the weekly check-in and is not suspended. | $1.00 per 3 months |
| Paid plan (Dirt and up) | Always online. No check-ins, no ads. | From the pricing page |
| Enzonic Deploy | Always online, deployed from git with every push. Good for bots that also serve a website or API. | See enzonic.dev/deploy, from Enzonic, the company behind discord-hosting.cloud |
Do not use "uptime pinger" tricks
Some free hosts sleep idle web apps, and old tutorials work around that by adding a web server to the bot and pinging it every few minutes from an outside monitor. Do not do this: it breaks the terms of those hosts, it does nothing for crashes or token problems, and on our free tier a ping from a monitor does not count as a check-in. Pick one of the options above instead.