How to make a .env?

ive been using .json to keep my token for like 6 days but only now realised it was public… so i was told make a .env but that doesn’t seem to work anymore?

1 Like

Use the Secrets tab. You can find this in the Tools section of the file tree.


and how to i run this in my code? like how do i use my ‘token’ yes i know its explained but i don’t understand

Once you made the secrets you would refer to it by putting (if you are using Javascript):

process.env.<secret name>

And Python:

os.getenv("<secret name>")

In the Tools section, hit “Secrets”

Screen Shot 2022-12-20 at 4.05.34 PM

Then, set the name of your token.

Screen Shot 2022-12-20 at 4.06.06 PM

This does the equivalent of creating an env file with BOT_TOKEN=...

Is there a difference between using os.getenv() and os.environ[]?

1 Like

2 different ways to get it I guess. That’s how you get it in Python and I never really used secrets in Python.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.