Host your Discord bot for free (Node.js or Python)

Create a free Discord bot server on Torchlite, make the bot in the Discord developer portal, paste its token, invite it, and run your own discord.js or discord.py code from GitHub.

5 min readBy Torchlite teamUpdated

Host your Discord bot for free (Node.js or Python)
On this page

Torchlite hosts Discord bots on the same panel as the game servers, for free. You get a small server that is made for one bot: 512 MB of RAM, half a CPU core and 3 GB of disk, which is plenty for a discord.js or discord.py bot that moderates, greets, runs commands or keeps score for your community.

It comes with a starter bot, so you do not need to write any code to get something online. This guide goes from nothing to a working bot, then shows how to run your own code.

Create the server

  1. Open Create a server and pick the Bot plan, under the three game plans.
  2. Pick Discord bot (Node.js) for discord.js, or Discord bot (Python) for discord.py. If you do not know which, pick Node.js.
  3. Finish the wizard. The panel installs the starter bot, which takes a minute.

A bot does not use up your account's free game server: every account can have one game server and one Discord bot.

Make the bot in Discord

The bot itself lives in your Discord account. Torchlite only runs its code.

  1. Go to the Discord Developer Portal and click New Application. Give it the name your bot should have.
  2. Open Bot in the menu on the left and click Reset Token. Copy the token that appears.
  3. Still on that page, leave the three Privileged Gateway Intents switched off. The starter bot does not need them. Your own code may: switch on only the ones it asks for.

Paste the token and start

  1. In the panel at game.torchlite.host, open your bot server and go to Startup.
  2. Paste the token in Bot token. It saves when you click out of the field.
  3. Go back to the Console and press Start (or Restart if it is running).

The console prints Online as YourBot#1234 in 0 server(s). when it logs in. If it says the token is wrong, copy it again from the portal; a space at the start or the end is the usual cause.

Invite the bot to your server

  1. In the Developer Portal, open OAuth2, then URL Generator.
  2. Tick the scopes bot and applications.commands.
  3. Under Bot Permissions, tick what the bot needs. For the starter bot, Send Messages is enough.
  4. Open the URL at the bottom, pick your Discord server and click Authorize.

Type / in a channel: /ping, /uptime, /roll and /help show up. New slash commands can take a few minutes to appear the first time.

Make it yours

There are two ways to change what the bot does.

Edit the files in the panel. Open Files. The Node.js bot is index.js, the Python bot is bot.py. Each command is a short block you can copy to add your own. Save, then restart. Extra packages go in package.json or requirements.txt; the server installs them by itself at the next start.

Deploy from GitHub. If your bot already lives in a repository:

  1. In Files, delete everything (the starter bot) so the folder is empty.
  2. In Startup, set Git repository to the https address of the repository, for example https://github.com/you/my-bot, and Branch if it is not the default one.
  3. For a private repository, also fill in Git username and Git access token. On GitHub, make a fine-grained token with read-only access to that repository's contents.
  4. Set Main file to the file your bot starts from, for example src/index.js or main.py.
  5. Go to Settings and click Reinstall Server. The panel clones the repository.

With Update on start left at 1, every start pulls the latest code first, so pushing to GitHub and pressing Restart is your whole deploy.

Keeping it online

Like every free server, a bot has to be renewed from the panel, after a short ad break. On the Bot plan:

  • Press Renew once every 24 hours. The button opens in the last 6 hours, and the time left is kept, so renewing a little early costs nothing.

If you miss a renew, the bot stops and nothing is lost: press Start when you are back. The renewal guide has the details. And like any server, a bot is deleted after 5 days with nothing done on it in the panel (a start, a file, a setting), so keep your code on GitHub too.

What a bot may not do

Our terms apply to bots too. In short: no selfbots (a bot logged in as a normal user account), no spam, raids or mass DMs, nothing that breaks Discord's own rules, and nothing unrelated to the bot, such as crypto mining. A bot server that does any of this is removed.

Common problems

The console says "No bot token yet"

The Bot token field in Startup is empty. Paste the token and restart.

"Used disallowed intents" or the bot crashes on login

Your code asks for a privileged intent (Members, Presence or Message Content) that is switched off in the Developer Portal. Switch it on under Bot, or remove it from the code.

Slash commands do not show up

Global commands can take a few minutes the first time. Check that you invited the bot with the applications.commands scope, and restart it once.

It runs out of memory

512 MB is a lot for a bot, but a music bot with a big queue or a cache of every member can fill it. Node.js stops with a "heap out of memory" error before the server is killed; trim what the bot keeps in memory.

Stuck on a step?

Ask on the forum. Your question links back to this guide, so whoever answers knows where you are.

Ask about this guide

About the author

Torchlite team

The people who run Torchlite

We build and run the Torchlite panel and the nodes. Every guide is checked on our own servers before it goes up, and updated when the panel changes.

Found a mistake? Tell us on Discord

Related guides

All guides →