Skip to content
Sign upLog in
← Back to Community
Discord Bot problems
Profile icon
NarwhalFanatic

Ok so i have started using discord and made this bot a while ago, and it worked fine but now when i try to run it it gives me an error with the first line being about client.run() im very confused.

These are the errors ive been getting. Please run the bot yourself to see the full list.

error

I have a chat filter built in so if you are not comfortable with seeing explicit words please dont look.

Answered by Theboys619 [earned 5 cycles]
View Answer
Voters
Profile icon
NarwhalFanatic
Comments
hotnewtop
Profile icon
Coder100

wrong token!

Profile icon
NarwhalFanatic

@Coder100
I dont think its the wrong token because i have gone in and regenerated the token and re-pasted it and it still give me the same error.

Profile icon
Coder100

can you like copy and paste the entire contents

@NarwhalFanatic

Profile icon
Coder100

OHHH I GOT IT NOW!!


@NarwhalFanatic

.env is not python!! It is CASE SENSITIVE and cannot have quotation marks because it is a shell file.

TOKEN=abcdeg

correct

TOKEN = abcdeg

incorrect

Profile icon
Theboys619

I think my answer seems to work check it out below or above idk. But I think it has to do with the mirror package of discord.py. Delete or remove the discord package from your packages on the side and install discord.py. Install it using pip if it doesn't install from the sidebar thing (pip install discord.py). Also import discord.py like import discord

@NarwhalFanatic

Profile icon
NarwhalFanatic

@Coder100
i have the env working but am still getting the same errors

Profile icon
NarwhalFanatic

@Theboys619
I uninstalled discord then re-installed it and it seems to be working! Thanks for all the help Guys!

Profile icon
NarwhalFanatic

@Coder100
@Theboys619
@AAbhayBhat
hanks for all the help Guys!

Profile icon
Coder100

Alright, for future people, https://docs.repl.it/repls/secret-keys

basically, create a .env file (exactly that, cannot be token.env, anything.env only .env):

KEY=VALUE # No spaces
Profile icon
PattanAhmed

@NarwhalFanatic
Hi,
It's wrong token!

Hope this helps.

Profile icon
Theboys619

Delete the token.env and create a new file just named .env with the token in it like you did before.

If its not .env I don't know if os.getenv will pick it up, but also repl will show your token to everyone if its not just .env.

Profile icon
Theboys619

Also try deleting the package discord (mirror) and downloading the package discord.py instead. If it doesn't install press ctrl+shift+s to open a shell and install it using pip. pip install discord.py

@Theboys619

Profile icon
EpicGamer007

ok, for ur bad words thing, i suggest using tolower() for it so u dont have to write it many times. I mean, how will u catch it if a words was LiKe ThIs...

Profile icon
NarwhalFanatic

@AbhayBhat
I will try to add that functionality once the bot is up and running!

Profile icon
Coder100

Anyways, the thing is, we will never be able to see your error because repl.it will not show the .env file for us, thus breaking the bot (no .env file, no token)

Profile icon
NarwhalFanatic

@Coder100
oohhhh it would show u the wrong error i will look up a tutorial to do that

Profile icon
NarwhalFanatic

@NarwhalFanatic
I beleive i have added the .env file correctly

Profile icon
Coder100

alright then

@NarwhalFanatic

Profile icon
Coder100

from what I can see, that's the only error

@NarwhalFanatic

Profile icon
matthewproskils

Post On Stack Overflow

Profile icon
matthewproskils

ooof... i acidentally scrolled down