22 August 2026 · 10 min read
How to Keep a Discord Bot Online 24/7 — Free vs Paid Compared
Everything you need to know to keep a Python Discord bot online 24/7. Why free tiers fail, what paid always-on hosting costs, and the fastest way to go from local bot to permanent uptime.
Keeping a Discord bot online 24/7 sounds simple but has a specific technical requirement: the Python process must run continuously on a server with a stable internet connection, without ever being paused or killed.
This guide explains why bots go offline, why free options fail, and the fastest path to permanent uptime.
Why Discord bots go offline
A Discord bot stays online by maintaining a WebSocket connection to Discord's gateway servers. The gateway expects a heartbeat from your bot every 41.25 seconds (configurable). If the connection drops — because the process was killed, the server lost internet, or the host paused the container — Discord closes the session and shows your bot as offline.
Common reasons the process stops:
- Running on a laptop that sleeps
- Free hosting tier pausing the container due to inactivity
- Unhandled Python exception crashing the process
- Host rebooting for maintenance without auto-restart
All four have the same result: your bot appears offline in Discord.
The free tier trap
Every few months a new "host your Discord bot for free" guide goes viral. Here is why they all stop working:
Replit
Replit's free Deployments enter "sleep mode" after a period of no traffic. Your Discord bot serves no HTTP traffic — it only has an outbound WebSocket connection to Discord. The sleep timer fires almost immediately.
The old Replit trick (UptimeRobot pinging a web endpoint to prevent sleep) only works if your Replit app serves HTTP. A pure discord.py bot does not.
Verdict: Does not work for 24/7 Discord bots on the free tier.
Render free web service
Render sleeps free web services after 15 minutes of no HTTP requests. A Background Worker (which does not sleep) is only available on paid plans at $7/mo.
Verdict: Free tier sleeps bots. Paid Background Worker works at $7/mo.
Railway
Railway removed their free tier in 2023. The Hobby plan ($5/mo) works but is usage-based.
Verdict: No free tier. Paid plans work.
Glitch
Glitch projects sleep after 5 minutes of inactivity on the free plan. There is no reliable way to prevent this for a Discord bot.
Verdict: Does not work reliably.
Oracle Always Free
Oracle's Always Free VMs are real servers — they do not sleep. However, Oracle aggressively reclaims "idle" VMs, and you must manage a full Linux server yourself.
Verdict: A full VPS, not a managed service. Works if you know Linux.
What actually works
| Method | Cost | Setup time | Linux needed? | Crash email? |
|---|---|---|---|---|
| getDiscordBot | $4.99/mo | 5 min | No | ✅ |
| Railway (paid) | ~$5–9/mo | 20 min | No | ❌ |
| Render Background Worker | $7/mo | 20 min | No | ❌ |
| PebbleHost | ~$1–3/mo | 15 min | No | ❌ |
| VPS (Hetzner/DO) | ~$4–6/mo | 45+ min | Yes | ❌ |
| Oracle Always Free | $0 | 60+ min | Yes | ❌ |
How to go from local bot to always-on in 5 minutes
If you already have a working bot.py locally, here is the fastest path:
1. Sign up for getDiscordBot
Go to getdiscordbot.com/accounts/signup/. 1-month free trial, no credit card.
2. Create a new bot
Click New Bot in the dashboard.
3. Paste your code
In the Code tab, paste your bot.py. Here is a working minimal example:
import os
import discord
from discord.ext import commands
intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix="!", intents=intents)
@bot.event
async def on_ready():
print(f"Online: {bot.user}")
@bot.command()
async def ping(ctx):
await ctx.send(f"Pong! {round(bot.latency * 1000)}ms")
bot.run(os.getenv("TOKEN"))
4. Add requirements.txt
In the Packages tab:
discord.py>=2.3.0
5. Add your token
In the Secrets tab, add:
- Key: TOKEN
- Value: your bot token from discord.com/developers/applications
6. Deploy
Click Deploy. The dashboard shows live logs:
Installing discord.py>=2.3.0...
Starting python bot.py...
Online: YourBot#1234
Your bot is now online 24/7.
Preventing crashes (the other half of "always online")
Even with a perfect host, your bot goes offline if the code crashes. Protect against the most common failures:
@bot.event
async def on_message(message):
if message.author == bot.user:
return
# Guard against None content (webhooks, system messages)
if not message.content:
return
await bot.process_commands(message)
@bot.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandNotFound):
return # ignore unknown commands silently
if isinstance(error, commands.MissingPermissions):
await ctx.send("I need more permissions to do that.")
return
# Log and re-raise unexpected errors
import traceback
traceback.print_exc()
On getDiscordBot, even if your bot does crash, it auto-restarts within seconds and emails you the crash logs.
Monitoring: know before your members do
A bot that crashed and restarted is fine. A bot that crashed and stayed down for 6 hours is a problem.
Built-in on getDiscordBot: You get an email the moment the bot crashes with the last 50 lines of logs. This is enough to diagnose 90% of issues.
On a VPS or Railway: You need to set up external monitoring yourself — Uptime Kuma, Betterstack, or a cron job that pings your bot's HTTP health endpoint (if you built one).
The cost of 24/7 uptime
Genuine 24/7 uptime for a Discord bot costs money. Here is what the first year looks like:
| Option | Month 1 | Months 2–12 | Year 1 total |
|---|---|---|---|
| getDiscordBot Starter | Free (trial) | $4.99 × 11 | $54.89 |
| Railway Hobby | $5–9 | $5–9 × 11 | $60–108 |
| Render Background Worker | $7 | $7 × 11 | $84 |
| VPS (Hetzner CX11) | $4.50 | $4.50 × 11 | $54 + time |
getDiscordBot and a VPS are similar in annual cost. getDiscordBot saves you the time cost of server management.
Start now
Start the free 1-month trial →
No credit card. Your bot goes from local to always-on in 5 minutes.
See also: Why your bot keeps going offline → · Cheapest always-on hosting →
FAQ
How do I keep a Discord bot online 24/7?
Run your bot on a cloud host that keeps the process alive without sleeping it. getDiscordBot ($4.99/mo) is purpose-built for Python Discord bots — paste bot.py, add your token, deploy. The bot stays online 24/7 without you managing a server.
Can I keep a Discord bot online for free?
Not reliably. All major free tiers (Replit, Render free, old Railway free) sleep the process after inactivity. Discord bots run on WebSockets, not HTTP, so they trigger sleep timers immediately. getDiscordBot has a 1-month free trial with no card required.
Does Replit keep a Discord bot online 24/7?
No. Replit's free Deployments sleep after inactivity. Even with paid Replit, the experience is not optimised for persistent Discord gateway connections. Purpose-built hosts are a better fit.
How long does it take for Discord to show my bot as online?
When your bot successfully authenticates and connects to the gateway, Discord shows it as online within 1-2 seconds. If it appears offline, check that your bot token is correct and that the process started without errors.
Does my bot go offline when I close my laptop?
Yes, if the bot is running locally. The process lives on your machine. Closing the laptop or losing internet drops the WebSocket. Move your bot to a cloud host so it runs independently of your computer.
getDiscordBot facts: Python 3.10–3.12 (discord.py, nextcord, py-cord, hikari). Paste bot.py, set TOKEN, stay on the Discord gateway. Starter $4.99/mo (1 bot, 128MB). Pro $9.99/mo (3 bots).