Why a bot goes offline when your PC does
A Discord bot doesn't live on Discord. It's a program, written with a library such as discord.js or discord.py, that runs on some computer and keeps a connection open to Discord's Gateway. Discord's documentation describes those connections as persistent WebSockets: the bot has to open one, keep it alive and reconnect when it drops. Close the laptop, restart Windows or lose power, and the bot goes offline with it.
Bots that only answer slash commands through an HTTP endpoint work differently, but most bots built with discord.js or discord.py use the Gateway, and those need a machine that never sleeps.
The free options, honestly
| Option | What you get | The catch |
|---|---|---|
| Your own PC | Free, and full control | Offline whenever the PC sleeps, restarts or loses its connection |
| Heroku | No free plan any more | Heroku stopped offering free plans on 28 November 2022 |
| Render, free tier | Free web services | Only web services, Postgres and Key Value are free; a free web service spins down after 15 minutes without inbound traffic, and Render says not to use free instances in production |
| Oracle Cloud Always Free | Small virtual machines: two AMD ones with 1 GB each, or Arm cores with 12 GB in total | You install, update and secure the Linux server yourself, and Oracle may reclaim Always Free machines that stay under 20% of CPU, network and (on Arm) memory use for 7 days |
A small bot rarely uses more than a few percent of a machine, so it's exactly the kind of workload idle rules catch. Keep-alive tricks, like wrapping the bot in a web service and pinging it so it never sleeps, depend on rules the provider can change and that it says aren't meant for production. For a bot your community relies on, the honest options are a machine you keep on yourself or a host that runs it 24/7.
How much RAM a Discord bot needs
Less than people expect, until it plays music. A bot's memory is the runtime itself plus what it caches about each server it's in. These are the estimates from our bot calculator; what actually uses a bot's memory is explained in the help center:
| Your server | RAM to start with | Plan that fits | Price |
|---|---|---|---|
| discord.py, 1 server, 10 commands | 0.25 GB | $0.75/month | |
| discord.js, 1 server, 10 commands | 0.5 GB | $0.75/month | |
| discord.js, 10 servers, 30 commands | 1 GB | $1.50/month | |
| Java (JDA), 1 server, 10 commands | 0.75 GB | $1.50/month | |
| discord.js, music in one voice channel | 1 GB | $1.50/month | |
| discord.js, music with Lavalink in 5 channels | 2 GB | $3.00/month |
Putting your bot online on our panel
Pick the runtime
Node.js, Python or Java, chosen when you order. The panel's software updater changes its version later.
Upload the project, not the whole folder
Your code and your
package.jsonorrequirements.txt, through the file manager or SFTP. Leavenode_modulesand virtual environments out: dependencies install on the server. Your first deploy, step by step.Keep the token out of your code
Put your bot token in an environment file on the server, or in the startup variables, never in a file you share or push to GitHub. Keeping your token safe.
Start it and read the console
The live console shows your bot's logs as they happen; when it says it's logged in, it's online. Schedules can restart it automatically, for example once a day. Restarts, crashes and schedules.
What it costs
| Plan | RAM | CPU | NVMe | Price |
|---|---|---|---|---|
| 512 MB | 0.5 vCores | 5 GB | $0.75/month | |
| 1 GB | 1 vCore | 10 GB | $1.50/month | |
| 2 GB | 1.5 vCores | 20 GB | $3.00/month | |
| 4 GB | 2 vCores | 40 GB | $6.00/month |
Every plan runs on the same node as our game servers. If you also run a Minecraft server for the same community, give the bot its own plan: a crash in one never takes the other down with it.
If you remember one thing
A bot that people rely on needs a machine that never sleeps. Free tiers work for testing, with catches that are easy to miss; for anything your community uses every day, $0.75 a month buys it a place that stays on.
Questions people ask
On your own PC if it never turns off, or on a free cloud tier with conditions: Render's free web services sleep after 15 minutes without inbound traffic, and Oracle can reclaim idle Always Free machines. Heroku no longer has free plans.
Our calculator puts a small discord.py bot at 0.25 GB and a discord.js one at 0.5 GB. More servers and music push it up; a music bot with Lavalink starts at 2 GB on our plans.
Yes. Node.js, Python and Java are the three runtimes you can pick when you order, and you can change the version later from the panel.
No, unless it plays music or draws images. Our smallest plan has 0.5 vCores, enough for commands and a database.
About this article: It comes from what I have learned running EnduranceNodes, and it is published here first. We sell Minecraft hosting, so everything I say about us can be checked on this site, and I point out where we are not the best fit.
