Skip to content
Pat Host
Servers Free hosting Pricing Guides FAQ About Status Discord Open panel
Home / Guides / Hosting a Discord bot
Guide

Hosting a Discord bot

Published 20 November 2026 · Last checked 28 November 2026

Pat Host can run your Discord bot, or any small program, in Python, Node.js, Rust or Go. This guide goes from an empty server to a bot that is online in your Discord server.

Before you start: the bot account

If your bot already runs on your own computer, skip this part. Otherwise:

  1. Open the Discord Developer Portal and create a new application.
  2. In the application, add a bot and copy its token. The token is the bot's password: keep it secret.
  3. Turn on any privileged intents your code needs, such as reading message content or the member list.
  4. Use the OAuth2 URL generator to make an invite link with the bot scope and the permissions it needs, then invite it to your Discord server.

Test the bot on your own computer first if you can. A bot that works locally usually works on Pat Host straight away.

Create a Bots & Code server

  1. In the panel's free server creator, choose Bots & Code. You need a linked Discord account; see creating a free server.
  2. Pick the language: Python, Node.js, Rust or Go.
  3. Choose a location and, if you like, a name, then create it.

Unlike game servers, a bot server does not start on its own after it is created, because there is no code on it yet.

Get your code onto the server

There are two ways.

Upload the files

Open the Files tab and upload your project, or connect with an SFTP client using the details in the Settings tab. Upload your source code and your dependency list, but not folders that can be rebuilt, such as node_modules, target or a Python virtual environment. They are large and are created on the server anyway.

Use a Git repository

In the Startup tab, enter your repository address and branch. For a private repository, also enter your Git username and an access token. Then reinstall the server from the Settings tab so the code is fetched. If you upload your files by hand instead, set the user upload option in the Startup tab so a reinstall does not try to fetch from Git.

Language notes

Python

Check the Startup tab: it holds the settings for which file to run and which packages to install. List your packages in a requirements file, such as requirements.txt, so they can be installed for you.

Node.js

Make sure your package.json is in the top folder and lists every dependency. The Startup tab holds the settings for which file runs.

Rust

Put Cargo.toml in the top folder. On start the server builds and runs your project with cargo run --release, and extra arguments can be set in the Startup tab. The first build compiles every dependency and can take a while; later starts are faster. Large projects can run out of memory or disk while compiling at free-tier sizes, so keep dependencies lean.

Go

Put go.mod in the top folder. On start the server runs go build and then your program. The Go version your go.mod asks for is downloaded automatically the first time, which uses some disk once. The build target defaults to the top folder and can be changed in the Startup tab. Go servers do not pull from Git automatically on start; to update from your repository, reinstall the server.

Keep your token safe

  • Do not put the token in code you push to a public repository. Keep it in a separate file, such as .env or a config file, and upload that file to the server by hand.
  • Never paste the token in a support ticket or public chat. Staff will never ask for it.
  • If the token leaks, reset it in the Developer Portal at once, then update it on the server.

Start it and read the console

Press Start. The Console tab shows everything your bot prints, including errors. If it stops straight away, the last lines of the console usually say why: a missing package, a wrong file name, or an invalid token. If the bot runs a small web page or webhook, the Network tab shows the address and port it can be reached on.

Keeping the bot running

Bot servers do not go to sleep the way game servers do. But a bot has no players to show it is being used, so the inactivity timer still runs. Press Renew in the panel before the countdown runs out, or the server will be suspended. See keeping your free server.

The free tier is for bots and small programs. Using a bot server to run a game server, a proxy or VPN for other people's traffic, or a cryptocurrency miner is against our Terms of Service and gets the server suspended.

Pat Host

Free Minecraft, Mindustry and bot servers in the UK, Australia and Canada, paid plans there and in Texas, and one hub address for every server: play.pathost.xyz.

Pat Host

  • Server browser
  • How the hub works
  • Free hosting
  • Guides
  • About Pat Host
  • Panel

Paid plans

  • Plans
  • Custom plan
  • How to order
  • FAQ

Help

  • FAQ
  • Contact
  • Discord
  • Server status
  • Terms of Service
  • Privacy Policy
© 2026 Pat Host Not an official Minecraft product. Not approved by or associated with Mojang or Microsoft.