Bot hosting keeps your Discord or chat bot online around the clock, even when your own computer is off. The service pulls the code from your Git repository. You can choose between the Node.js, Python and Java runtimes. You manage the bot in the same panel as your game servers.
What you need first
- Your bot's code in a Git repository on GitHub, GitLab or Codeberg.
- Your bot's token. For Discord you find it in the Developer Portal of your application.
- For a private repository, an access token with read access, on GitHub for example a personal access token.
Do not put the bot token into the repository. You enter it as a secret value when you order.
Order bot hosting
Open the Apps page, pick the bot card and click Configure service. In the order wizard you also find bot hosting in the Apps category. In the Configuration step you fill in these fields:
- Runtime: Node.js, Python or Java.
- Source: Public or Private. With "Private" the Access token field appears.
- Git URL: the https address of your repository, for example
https://github.com/your-name/your-bot. - Start file: the file your bot starts with. The extension must match the runtime:
.jsfor Node.js,.pyfor Python,.jarfor Java. - Secret values (bot token etc.): enter your bot token here.
- Memory (RAM): 1, 2 or 4 GB.
What happens at startup
During setup the service clones your repository. On every start it prepares the code for the chosen runtime:
- Node.js: If there is a
package.jsonin the repository, the service runsnpm installand then starts the start file withnode. - Python: If there is a
requirements.txtin the repository, the service installs the packages from it and then starts the start file. - Java: The service starts the start file with
java -jar. The finished jar has to be in the repository, nothing gets built.
Read the bot token in your code
The bot token reaches your bot as the environment variable BOT_TOKEN. This is how you read it:
// Node.js
const token = process.env.BOT_TOKEN;
# Python
import os
token = os.environ["BOT_TOKEN"]
// Java
String token = System.getenv("BOT_TOKEN");
Manage the bot in the panel
Open the service under My servers and click Service. You find four areas there:
- Start file: Use Edit (pencil icon) to change the file your bot starts with. After saving, a running bot restarts.
- Pull from git: Fetches the latest state from your repository and restarts the bot. From then on the service pulls the current state on every start.
- Credentials & secrets: Replace the bot token here, and for a private repository the access token. The panel does not show the old value, you just enter the new one.
- Logs: Go to console shows you live what your bot prints.
Files and backups
If your bot writes its own data, such as an SQLite file, it is stored on the server. Use Backups to create a backup before you roll out bigger changes. If your bot needs to store data permanently or share it with other programs, a database from the Apps page is a better fit.
Common errors
- Please enter a valid Git URL: https addresses from GitHub, GitLab and Codeberg are allowed, with or without
.gitat the end. SSH addresses likegit@github.com:name/bot.gitdo not work. - The start file must match the selected runtime: Check the extension, for example
bot.pyinstead ofbot.jsfor Python. - Cannot find module (Node.js) or No such file or directory (Python): The start file is not in the main folder of the repository or has a different name. Under Start file, enter the path relative to the repository, for example
src/index.js. - The bot does not log in: Read your library's message in the console. Usually the token is wrong or expired. Create a new one in Discord and enter it under Credentials & secrets.
- A change from Git does not show up: Click Pull from git. Without this step the bot keeps the state from the setup.