Reputation: 1782
I want to check if the author is an admin before he/she uses the command in the rewrite branch of discord.py
I tried:
@client.command() #Command to delete messages in bulk.
async def clear(ctx, amount=100):
if ctx.message.author.server_permissions.administrator:
await ctx.channel.purge(limit = amount+1)
await ctx.send(str(amount) + ' messages deleted.')
else:
await ctx.send('No can do mister!')
But this returned an error, I'm guessing because it doesn't work for the rewrite branch. Any ideas?
Upvotes: 0
Views: 1382
Reputation: 368
Instead of using:
ctx.message.author.server_permissions.administrator
You want to use:
ctx.message.author.guild_permissions.administrator
Upvotes: 1