K
K
kiber_byblik_natasha2020-08-17 21:58:35
Python
kiber_byblik_natasha, 2020-08-17 21:58:35

@client.command error?

When writing an ordinary task via @client.command, an error pops up... NameError
Code:

@client.command( pass_context = True )
@commands.has_permissions( administrator = True )

async def clear( ctx, amount = 1000 ):
  await ctx.channel.purge( Limit = amount + 1 )

Mistake:
Traceback (most recent call last):
  File "allax.py", line 9, in <module>
    @client.command( pass_context = True )
NameError: name 'client' is not defined

Answer the question

In order to leave comments, you need to log in

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

Is the client exactly defined as a discord.Client or discord.ext.commands.Bot instance? Maybe in your copy-paste it is called bot, not client?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question