Help Center
Keep your bot token safe
How to protect your token and what to do if it leaks.
Quick steps
- Treat your bot token like a password. Anyone who has it can control your bot.
- Store it only as an environment variable in your bot settings. Do not put it in code, screenshots, public repositories or support messages.
- Hartwell staff will never ask you for your token.
- 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.
- 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
- Get your bot ready before you upload The five checks that prevent most deployment problems.
- My bot is offline or keeps stopping Why a bot goes offline and how to bring it back.
- Common reasons a bot will not start Quick fixes for the errors that most often stop a bot from coming online.
Still stuck? Open a support request from your dashboard, or use /support in the Hartwell Discord server.