N
N
NiicKz2020-08-18 19:11:55
Python
NiicKz, 2020-08-18 19:11:55

How to fix @client.event error in discord.py?

I added the @client.event line in my bot on discord.py, then I start the bot and I get the error NameError: name 'client' is not defined, what should I do?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
shurshur, 2020-08-18
@NiicKz

It is necessary that the creation of the client goes to the first decorator.

client = discord.Client()
# или если используется discord.ext.commands:
# client = commands.Bot(command_prefix='%')

@client.event
async def ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question