Ask coding questions

← Back to all posts
How to hide discord token with new secrets system
WhyThoBro (0)

So with the new secret system, they removed env files which is what you use to use to hide your discord bot's token. I couldn
't find any other posts about discord bot tokens specifically and how to make it work so I thought I'd make one for myself and anyone else who might be wondering.

InvisibleOne (2934)

The new secrets system works pretty much the same as an env. You should read this:

WhyThoBro (0)

@InvisibleOne I might be dumb but whenever I type['BOT_TOKEN']) it gives me an error in the console. In the value tab in the secrets I type TOKEN=(my bots token)
I'm not sure whats wrong. BOT_TOKEN is my key in the secrets.

WhyThoBro (0)

Hey I'm still wondering this, does anyone know?

InvisibleOne (2934)

Put the name of the secret as BOT_TOKEN and then the value as just the bot's token, you don't need TOKEN=(bot_token)
Then you should be able to get it with

WhyThoBro (0)

Thank you so much it worked