Answer the question
In order to leave comments, you need to log in
How can I make a command so that only people of a certain role can use it?
I want the clear command only for people with the role "757315805242458202" and that the message that he sends is deleted after 3 seconds, but I'm a noob and don't know how to do it
@bot.command()
async def clear(ctx, amount=None):
await ctx.channel.purge(limit=int(amount)+1)
await ctx.channel.send(':: Сообщения успешно удалены')
Answer the question
In order to leave comments, you need to log in
https://discordpy.readthedocs.io/en/latest/ext/com...
@bot.command()
@commands.has_any_role( 757315805242458202)
async def clear(ctx, amount=None):
await ctx.channel.purge(limit=int(amount)+1)
await ctx.channel.send(':: Сообщения успешно удалены')
@bot.command()
@commands.has_permissions( administrator = True)
async def clear(ctx, amount=None):
await ctx.channel.purge(limit=int(amount)+1)
await ctx.channel.send(':: Сообщения успешно удалены')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question