Z
Z
ZETIFINT2021-06-27 14:34:06
Python
ZETIFINT, 2021-06-27 14:34:06

Help, I made a clear command and I need people with a certain right to be able to use it?

Help, I made the clear command, but I don’t know what right the
code is responsible for managing messages:

@bot.command()
@commands.has_permissions(manage_message=True)
async def clear( ctx, amout = 100 ):
  time = 2
  await ctx.channel.purge( limit = amout + 1 )
  await ctx.send( f'>>> *Очистка* \n Было очищенно { amout } сообщение(ий)' )
  await asyncio.sleep(time)
  await ctx.channel.purge( limit = 1 )

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vindicar, 2021-06-27
@ZETIFINT

Read the has_permissions documentation .

The permissions passed in must be exactly like the properties shown under discord.Permissions.

Those. requested permissions must be written exactly as listed by reference. Compare:
You have: manage_message
Link: manage_messages

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question