How to Host a Discord Bot 24/7

Your bot is only online while its code is running. Here are the five ways to keep it running, what each one costs, and how to fix the errors that stop bots from starting.

Kodari TeamUpdated Oct 3, 2026 · 10 min read
On this pageWhat a bot needsYour own computerA Raspberry Pi or old PCA VPSFree hostingManaged bot hostingSide by sideWhy it won't startFAQ
Kodari Discord bot hosting24/7 hosting with a full server panel. Open
console
$ pip install -r requirements.txt
Successfully installed discord.py python-dotenv
$ python bot.py
Logged in as TicketBot#4821
Synced 6 slash commands
Ready in 3 servers
The moment every bot is waiting for. The hard part is keeping it there when you close your laptop.

A Discord bot is a program. When it runs, it connects to Discord and shows as online. When it stops, it goes offline. That's why your bot works perfectly while you test it and disappears the moment you close your terminal, shut your laptop, or your PC goes to sleep. Hosting a bot 24/7 simply means running that program somewhere that never stops.

There are five realistic ways to do that. They range from free and fiddly to a few dollars a month and hands off. This guide walks through each one honestly, with the commands you need, and ends with the errors that stop most bots from starting and how to fix them.

What a bot needs to stay online

Whatever you choose, a hosted bot needs the same few things:

  • A machine that's always on. If it sleeps, reboots for updates, or loses power, your bot goes with it.
  • The right runtime. Python for discord.py bots, Node.js for discord.js bots, with your packages installed.
  • Something that restarts it. Bots crash. A process manager brings yours back without you noticing.
  • Your token, kept secret. In a .env file or an environment variable, never in the code you share.
  • Enough memory. A small bot in a few servers usually fits comfortably in 512 MB. Music bots and bots in many large servers need more.
  • A way to see logs. When something breaks, the console output is how you find out why.

Option 1: Your own computer

The way everyone starts. Run python bot.py or node bot.js and your bot is online. It costs nothing and it's perfect for building and testing.

The catch is obvious: your bot is only online while your computer is on and the terminal is open. Sleep mode, restarts, and closing the window all take it offline. Fine for a bot only you use. Not fine for a server that relies on it.

Option 2: A Raspberry Pi or old PC at home

A Raspberry Pi uses very little power and can run a small bot for years. An old laptop works too. After the hardware, it's close to free.

You become the hosting company, though. Power cuts, router restarts, SD cards wearing out, and system updates are all on you. If you enjoy tinkering, it's a great project. If you just want the bot online, it's more work than it looks.

Option 3: A VPS

A VPS is a small server you rent by the month. You get full control and it stays on, but you set up everything yourself. The usual steps:

  1. Rent a server and connect to it with SSH.
  2. Install Python or Node.js.
  3. Copy your bot's files over and install its packages.
  4. Put your token in a .env file on the server.
  5. Run the bot with a process manager so it restarts after crashes and reboots.

For a discord.js bot, pm2 is the common process manager:

Keep a Node.js bot running with pm2
npm install -g pm2
pm2 start bot.js --name my-bot
pm2 save
pm2 startup

For a discord.py bot, a systemd service does the same job on most Linux servers. Save this as /etc/systemd/system/my-bot.service, then run sudo systemctl enable --now my-bot:

A systemd service for a Python bot
[Unit]
Description=My Discord bot
After=network-online.target

[Service]
WorkingDirectory=/home/bot/my-bot
ExecStart=/usr/bin/python3 bot.py
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target

After that, every change means copying files over again and restarting. You're also responsible for security updates on the server. It works well if you're comfortable on a Linux command line.

Option 4: Free hosting

Free hosting for Discord bots exists, and it can be fine for a hobby bot. Before you rely on it, read the limits carefully. Free plans often cap the hours you can run each month, put your bot to sleep when it's idle, share a small amount of memory between many users, or ask you to renew every few days.

A Discord bot that sleeps is a bot that doesn't answer commands. If your server depends on it for moderation or tickets, those limits matter more than the price.

Option 5: Managed bot hosting

Managed hosting runs the server for you. You upload the bot, it stays online, and you get a panel to control it. This is what Kodari's Discord bot hosting does, from $3.00 a month:

Kodari Discord bot hostingFrom $3.00 a month
  • Your bot gets its own server, online 24/7, with Python 3.13 or Node.js 22 and your packages installed for you.
  • A full server panel with the live console, start, stop and restart, and a file manager.
  • A daily backup and a public URL for webhooks or a dashboard.
  • Your token and intents are checked before anything is charged.
  • If the bot can't start, you get the reason in plain words, and Fix with AI hands the error to the AI.

If you don't have a bot yet, Kodari can also write it for you from a plain English description, in discord.py, discord.js or TypeScript.

Side by side

Online 24/7SetupCost
Your computerOnly while it's onNoneFree
Raspberry PiYes, if the power stays onMediumHardware once
VPSYesHighMonthly
Free hostingOften limitedLowFree
Kodari hostingYesOne clickFrom $3.00/month

Why your bot won't start, and how to fix it

Most bots that fail on a new host fail for one of a handful of reasons. Here's what the error looks like and what to do.

PrivilegedIntentsRequired or "Used disallowed intents"

Your code asks for a privileged intent, usually Message Content, Server Members or Presence, that isn't enabled for your bot. discord.py raises PrivilegedIntentsRequired and discord.js says Used disallowed intents. Open the Discord Developer Portal, pick your application, go to Bot, and turn the intent on under Privileged Gateway Intents. Then restart.

Invalid token

discord.py shows LoginFailure: Improper token has been passed and discord.js shows An invalid token was provided. The token is wrong, has extra spaces, or was reset. Reset it on the Bot page of the Developer Portal and paste the new one into your .env file.

ModuleNotFoundError or "Cannot find module"

A package isn't installed on the host. Make sure it's listed in requirements.txt for Python or package.json for Node.js, and that the host installs them before starting the bot.

Missing Permissions or Missing Access

The bot is online but can't do what it was asked in your server. Re-invite it with the permissions it needs, or give its role those permissions in Server Settings. Check the channel's own permission overrides too.

The bot is online but slash commands don't show

The commands were never registered with Discord, or the bot was invited without the applications.commands scope. Make sure your code syncs its commands on start, and re-invite the bot with both the bot and applications.commands scopes.

Hosting a bot isn't hard. Finding out why it stopped at 3am is. Whatever you choose, make sure you can see its logs.

Frequently asked questions

How do I keep my Discord bot online 24/7?

Run it on a machine that never turns off, with a process manager that restarts it after crashes. That can be a Raspberry Pi at home, a VPS with pm2 or systemd, or managed bot hosting that handles it for you.

Can I host a Discord bot for free?

Yes, on your own computer or on a free host, with limits. Your computer only keeps the bot online while it's on, and free hosts often cap hours or sleep idle bots. On Kodari, new accounts get 10 free credits plus 50 more for joining the Discord, which covers 10 days of Basic hosting.

How much RAM does a Discord bot need?

A small bot in a few servers usually runs well in 512 MB. Bots in many large servers, music bots, and bots that keep a lot of data in memory need 1 to 2 GB.

Why does my bot go offline when I close my laptop?

Because the bot is a program running on your laptop. When it stops, Discord shows the bot as offline. To keep it online, run it on a machine that stays on.

How do I update a hosted bot?

Upload the changed files and restart the bot. On a VPS that means copying files and running pm2 restart or systemctl restart. On Kodari, ask the AI for the change and press Restart with latest code.

DiscordHostingdiscord.pydiscord.jsVPS
Want your bot online in a minute instead?Its own server, a full panel, and a daily backup. Free credits when you sign up.
See Discord bot hosting