Help Center

Keep your bot token safe

How to protect your token and what to do if it leaks.

Quick steps

  1. Treat your bot token like a password. Anyone who has it can control your bot.
  2. Store it only as an environment variable in your bot settings. Do not put it in code, screenshots, public repositories or support messages.
  3. Hartwell staff will never ask you for your token.
  4. If it might have leaked, open the Discord developer portal and reset the token immediately, then update the environment variable on Hartwell and restart your bot.
  5. Remove the old token from any code you shared, and check your bot for unexpected activity.

Common ways tokens leak

  • Committing a config or .env file to a public GitHub repository.
  • Pasting code with the token into a forum, chat or support request.
  • Sharing screenshots of code or settings.
  • Giving the token to someone offering to "fix" the bot.

Protect it

  • Add .env and configuration files containing secrets to your .gitignore.
  • Store the token only as an environment variable in your Hartwell bot settings.
  • Give the bot only the permissions it needs in your Discord server.

If it leaked

Reset the token in the Discord developer portal immediately. The old token stops working at once. Update the variable on Hartwell, restart the bot, and check your Discord server's audit log for changes you did not make.

Never share your password, a bot token, a private key or card details with anyone, including Hartwell staff.

Related articles

Still stuck? Open a support request from your dashboard, or use /support in the Hartwell Discord server.

← All help articles