Ask coding questions

← Back to all posts
How to hide bot token?
DannMunar

I want to share my bot but i dunno how to hide token, anyone free to help? tia :)

Voters
ArcheryAce
SHOYA17
petterhollmes
MioszStaczyk
DannMunar
Comments
hotnewtop
JanekKocz

i also need help, they removed .env

Saaem07

@JanekKocz Python
Click on Secrets on left side of screen, then give game TOKEN in key and add the token in Value area then go to your discord bot main.py and then import os and then go to last line and type this bot.login(os.environ.get("TOKEN") and run the bot all your problems get solved

CodingCactus

you can store it in a .env file, which means that no one else can see it

DannMunar

thank you i hid it now :)
@CodingCactus

CodeLongAndPros
DannMunar

thanks its now hidden :)
@CodeLongAndPros

Saaem07

PYTHON
Click on Secrets on left side of screen, then give game TOKEN in key and add the token in Value area then go to your discord bot main.py and then import os and then go to last line and type this bot.login(os.environ.get("TOKEN") and run the bot all your problems get solved