Need help with discord bot

so there was a new update recently that doesn’t allow you to make .env files anymore how do I integrate my token to my now?

Hi @QuicT !

Welcome to the forum!

The place to store secret has moved.
You will need to click on the lock icon on the far left of the screen and place your keys there.

ok so i have done that now how do i use this in my code

Now that you have added the token you can start using it in your code'TOKEN'))

If you are following along with beau’s tutorial then everything else should be the same.

The env files were the only major change on replit since the tutorial came out.

If you chose to import the variable into your code then this works too.

my_secret = os.environ['TOKEN']

so would i be assigning the value as TOKEN?

i tried that and it didnt work

so this is what ive got for the purpose of not leaking my token i changed it out let me know what you think

I went ahead and create a new topic for you.

You should be using the value of your bot.

Here is the example bot from the video.

Can you try using the my_secret variable instead?
You will need to click on insert like shown in the picture.

And then add this to the bottom of your code.

my_secret = os.environ['TOKEN']

If it works, then it should say you are logged in with your bot number.

Otherwise, what error messages are you getting?

You can still share your replit link without fear of leaking out your token if it was created properly.

I would be able to see all of your files except for the env secret keys.

OHHHHHH thank you so much i get it now

1 Like

i had it switched so in value i had token instead of the actual token

Oh ok cool.

Glad to help :grinning:

You should be able to follow along with the rest of the video because there are no other major changes to replit since the video was made.

crap its still not working lol
im getting nothing for a output

If it is not working then you should be getting some sort of error message.

What does it say?

i will run it and it wont say anything just blank screen

hmmm…that’s weird.

Can I see your replit link?

Hi again!
I was able to look at your code.

I found two issues.

You have a typo here
('We have logged in as {0.usert}

It should be user not usert.

Your indentation is off.
These lines of code should be all the way to the far left.

  my_secret = os.environ['TOKEN']

They shouldn’t be indented in like that way you have it now.

Remember that in python indentation matters.

Hope that helps!

1 Like

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