How to host a Discord bot 24/7

By Tabi Cloud · Updated 17 November 2026

A bot on your own PC goes offline when the PC sleeps. On a server it runs day and night. This guide covers our bot hosting panel and running a bot on a VPS.

1. Get your bot ready

  1. In the Discord Developer Portal, create an application, open Bot and copy the token. Treat it like a password.
  2. Turn on the Privileged Gateway Intents your bot uses, such as Message Content if it reads messages.
  3. Invite the bot from OAuth2 → URL Generator with the bot and applications.commands scopes.

Python or Node.js?

  • Node.js with discord.js has the largest community, many examples and fast updates for new Discord features.
  • Python with discord.py is easier to read if you are learning, and good for bots that do data work or AI.

Both are free, run well on 500 MB of RAM, and are supported on our bot hosting. Pick the language you know.

2. Host it on the bot panel

  1. Upload your code in the Files tab (or link a Git repository if your plan supports it). Do not upload node_modules or a virtual environment.
  2. In the Startup tab, set the main file, for example index.js or bot.py. Dependencies from package.json or requirements.txt are installed on start.
  3. Add your token as a variable (see below), then press Start and watch the Console for your "logged in" message.

3. Keep your token safe

  • Never write the token in your code. Put it in a .env file (DISCORD_TOKEN=...) or a panel variable, and read it with process.env.DISCORD_TOKEN (Node, with dotenv) or os.getenv("DISCORD_TOKEN") (Python, with python-dotenv).
  • Add .env to .gitignore so it never reaches GitHub. Bots scan GitHub for tokens within minutes.
  • If a token leaks, press Reset Token in the Developer Portal right away. The old one stops working.
  • The same rules apply to Telegram bot tokens from BotFather and any API keys.

4. Auto restart and logs

  • On the panel, crashed bots restart on their own. Read the Console to see why it stopped.
  • Catch errors in your event handlers so one bad command does not kill the whole bot.
  • Log to the console with times, for example console.log(new Date().toISOString(), "...") or Python's logging module, so you can trace problems later.

5. Run a bot on a VPS (pm2 or systemd)

For many bots, a dashboard or a database, a VPS gives you full control.

Node.js with pm2:

npm install -g pm2
pm2 start index.js --name mybot
pm2 save
pm2 startup   # run the command it prints, so bots start after a reboot
pm2 logs mybot

Python with systemd: create /etc/systemd/system/mybot.service:

[Unit]
Description=My Discord bot
After=network-online.target

[Service]
WorkingDirectory=/home/bot/mybot
ExecStart=/home/bot/mybot/venv/bin/python bot.py
EnvironmentFile=/home/bot/mybot/.env
Restart=always
User=bot

[Install]
WantedBy=multi-user.target

Then run sudo systemctl enable --now mybot, and read logs with journalctl -u mybot -f. Run bots as a normal user, not root.

Ready to start your server?

Join our Discord, open a ticket and our team sets everything up within minutes.