Reputation: 31
I want my code to check if the the message author has perms to delete messages but at the same time if I(bot owner) am the author i want it to work regardless of perms
@client.command(aliases = ['clear'])
@commands.has_permissions(manage_messages = True)
async def purge(ctx , number : int = None):
if number is None:
await ctx.send("Please enter number of messages to delete with the command")
await ctx.message.delete()
else:
await ctx.channel.purge(limit = number + 1)
here is my code
Upvotes: 0
Views: 36
Reputation: 15689
Use the commands.check_any
decorator
@client.command(aliases=["clear"])
@commands.check_any(commands.has_permissions(manage_messages=True), commands.is_owner())
async def purge ...
Upvotes: 3