Each server has a set of variables in the panel. The template reads them on every start, so restart the bot after you change one.
Variables on every plan
- Bot token (
BOT_TOKEN) holds your Discord bot token. Your code reads it from the environment. It isn't written into the startup command, and the start scripts don't print it. - Main file (
MAIN_FILE) is the entry file on Node (defaultindex.js) and Python (defaultmain.py). - Jar file (
JAR_FILE) is the jar JDA runs (defaultbot.jar). - Build on start (
BUILD_ON_START), JDA only: at1, it runs the GradleshadowJarbuild before start.
Extra variables for GitHub deploy
- Git repository (
GIT_REPO) is an optional clone URL. Leave it empty to upload files yourself. - Git branch (
GIT_BRANCH) is the branch to clone and update from. The default ismain. - Git token (
GIT_TOKEN) is available on paid plans for private repositories. Free supports public repositories only. - Auto update (
AUTO_UPDATE) is0or1. At1, the first start clones the repository, and every later start fetches the branch and resets tracked files to it.
Reading the token in code
client.login(process.env.BOT_TOKEN);client.run(os.environ["BOT_TOKEN"])JDABuilder.createLight(System.getenv("BOT_TOKEN"))Don't commit the token or put it in a config file you upload. If you use a .env file locally, add it to .gitignore and leave it off the server. The variable already does that job.
If a token leaks
- Reset the token in the Discord developer portal right away. The old one stops working at once.
- Paste the new token into Bot token.
- Restart the bot.
The git token
Leave Git token empty for a public repository. For a private one, use a token that can only read that repository, such as a fine-grained GitHub token with read-only access to contents. The template hands it to git through a helper, so it never appears in the clone URL. If the console says git clone failed or git update failed, check the token and the branch name.
You can turn on git for a server that already has files. Set the variables and restart. Nothing is deleted: files with the same names as files in the repository move to a pre-git-backup- folder, and files git doesn't track, such as a local database, are left alone.
For a full walkthrough, including how to get backed-up files back and how to reinstall with git connected, read deploy discord.js.
Still stuck? Contact support