Docs · Running your bot

Startup settings: token, bot file, language and Git

All docs

Open Startup in the panel. Changes save by themselves a moment after you stop typing, and apply the next time the bot starts.

What happens when the bot starts

The startup command at the top of the page is snow-run. It does these things in order, and prints a line starting with [SnowServers] for each one:

  1. Git. If Git repository is set, clone it into an empty server, or pull new commits. Git deploy.
  2. Starter bot. If the server is empty and no repository is set, add a small starter bot (Python and JavaScript; Java has none).
  3. Packages. Install from requirements.txt or package.json, only when that file (or the language version) changed since the last start.
  4. Run. Work out which file starts your bot and run it.
  5. If it stops by itself, print a hint for the usual errors, and send a crash alert if you set one up.

Bot token

Paste your token here, not into your code. Your program receives it as an environment variable called BOT_TOKEN:

# Python
import os
TOKEN = os.environ["BOT_TOKEN"]

// JavaScript
const token = process.env.BOT_TOKEN;

Reset the token in the Discord Developer Portal? Paste the new one here and restart.

Bot file

Leave it empty and the file is found for you. The console's Starting: line says what it picked.

  • Python: bot.py, main.py, app.py, run.py, index.py, src/main.py, src/bot.py, __main__.py, in that order. If none of those exist and there is exactly one .py file in the top folder that is not a helper such as config.py or setup.py, that one.
  • JavaScript: the start script in package.json, then its main file, then index.js, bot.js, main.js, app.js, src/index.js and a few more.
  • Java: the only .jar in the top folder, or else in build/libs (Gradle) or target (Maven), preferring one ending in -all, -with-dependencies, -shaded or -fat.

Set it yourself when that guess is wrong. It accepts:

  • a file, in the top folder or a subfolder: main.py, src/bot.py, dist/index.js, build/libs/bot-all.jar,
  • a Python package run as a module: -m mybot,
  • a script from package.json: npm start or npm run prod.

Language and version

The Docker Image box picks both: Python 3.10 to 3.14, Node.js 20, 22 or 24, or Java 17, 21 or 25. New servers start on whatever you chose at checkout (Python 3.12, Node.js 22 or Java 21 unless you changed it).

You can switch language here too. Restart after switching. The first start on a new version reinstalls your packages, so it takes a little longer.

Git repository, branch and updates

  • Git repository: a link to your repository on GitHub, GitLab, Codeberg or Bitbucket.
  • Git branch: leave empty for the repository's default branch.
  • Update from Git on start: on by default. Every start pulls your newest commits.
  • Git access token: only for private repositories.

The details, including what happens to files you edited here: Git deploy.

Crash alert webhook

A Discord webhook link. If your bot stops on its own, a message goes there with the reason and its last output. Setting it up.

Other secrets

There is one box on this page for the bot token. For anything else (an OpenAI key, a database password), use a .env file:

  1. Create a file called .env in the top folder with New File:
    OPENAI_API_KEY=sk-...
    DATABASE_URL=postgresql://...
  2. Load it when your bot starts. Python: add python-dotenv to requirements.txt, then from dotenv import load_dotenv; load_dotenv(). JavaScript: add dotenv to package.json, then require("dotenv").config().

A .env file is never overwritten by Git deploy. Two cautions: files are included in backups, so a .env is in every backup you download, and it must never be committed to a public repository.

Environment variables you get for free

  • SERVER_MEMORY: your plan's memory in MB, for example 1024.
  • TZ: the server clock's time zone, Europe/Berlin. If your bot schedules things, work in UTC in your code.
  • HOME: /home/container, the top folder.

Something here wrong or out of date? Tell us and it gets fixed.