K
K
kiber_byblik_natasha2020-08-16 02:10:16
Python
kiber_byblik_natasha, 2020-08-16 02:10:16

python discord decorators?

Error when writing commands in Python Simple

code:

@client.command( pass_context = True )

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


Mistake:
Traceback (most recent call last):
  File "C:\Users\Бублик\Desktop\Питончик\allax.py", line 29, in <module>
    async def clear( ctx, amount = 1000 ):
  File "C:\Users\Бублик\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\commands\core.py", line 1228, in decorator
    result = command(*args, **kwargs)(func)
  File "C:\Users\Бублик\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\commands\core.py", line 1389, in decorator
    raise TypeError('Callback is already a command.')
TypeError: Callback is already a command.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
h3ll0h1bana, 2020-08-16
@kiber_byblik_natasha

@client.command( pass_context = True )
@commands.has_permissions( administrator = True )
async def clear( ctx, amount : int ):
await ctx.channel.purge( limit = amount )

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question