Set your bot token (environment variables)
The safe way to give your bot its Discord token on Victus — Startup variables and .env files read via process.env / os.environ — plus what to do if a token leaks.
Your bot token is a password for your bot account. Anyone who has it can control the bot completely, so it must never be written in your source code or committed to Git. On Victus you supply it as an environment variable and your code reads it at runtime. There are two ways to do that.
Option A — Startup variable (simplest)
- 1Open your bot in the panel and go to the Startup tab.
- 2Paste your token into the token / environment-variable field the egg provides. Values set there are injected into the container as real environment variables.
- 3Save, then Restart so the new value is picked up.
- 4Read it in code with process.env.DISCORD_TOKEN (Node) or os.environ["DISCORD_TOKEN"] (Python).
Option B — a .env file via the Files tab
Never hardcode or commit your token
Do not write bot.run("MTA1...") or client.login("MTA1..."). If a token ever lands in a public repo, GitHub scanning and Discord will often auto-invalidate it — and attackers scrape leaked tokens within minutes. Keep .env in your .gitignore.
If your token leaks, reset it immediately
Go to the Discord Developer Portal → your application → Bot → Reset Token. Then update the value on the Startup tab or in .env and restart. The old token stops working the instant you reset it.
Changing a variable needs a restart
Environment variables are read when the process starts. After editing a Startup variable or your .env, press Restart — a running bot will not pick up the new value on its own.