Blog·Game servers

How to Host a Discord Bot 24/7 (Node.js and Python)

A **Discord bot** that only runs on your laptop is offline half the time. Here is how to host it **24/7**, whether you wrote it in **Node.js** with discord.js or in **Python** with discord.py.

What a Discord bot needs to run

  • A running process that never sleeps.
  • Its bot token from the Discord Developer Portal.
  • The right gateway intents enabled for the events you use.
  • An internet connection: bots connect outbound to Discord, so you do not open any ports.

discord.js (Node.js) or discord.py (Python)?

Both are mature and well documented. Choose the language you know. On a host you upload your project, install dependencies from package.json or requirements.txt, and set the start command.

Keep the token out of your code

Store the bot token as an environment variable in the panel and read it in your code. Never commit it to a public repository; if it leaks, reset it in the Developer Portal immediately.

Uptime, restarts and logs

Use the live console to read logs, and restart the bot from the panel when you deploy a change. Add error handling so one failed command does not crash the process.

How much memory does a bot use?

Most bots use far less than 1 GB. Bots with large caches, music or many servers use more. The smallest game server plan is plenty for most bots.

When your bot grows

Discord requires sharding once a bot is in around 2,500 servers. Plan for it early, and move to a larger plan when memory pressure shows up in the console.

Host it

See Discord bot hosting for details: console, file manager, restarts and backups on NVMe in Frankfurt.

The best bot host is the one you forget about: it just stays online.

Prêt à passer à la pratique ?

Lancez un VPS Ryzen avec stockage NVMe en moins de deux minutes, les tarifs bêta sont disponibles.

Voir les offres VPS