if statement for discord if admin code example
Example: discord py check if user is administrator
from discord.ext.commands import Bot, has_permissions, CheckFailure
client = Bot()
@client.command(pass_context=True)
@has_permissions(administrator=True)
async def whoami(ctx):
msg = "You're an admin {}".format(ctx.message.author.mention)
await client.send_message(ctx.message.channel, msg)
@whoami.error
async def whoami_error(error, ctx):
if isinstance(error, CheckFailure):
msg = "You're an average joe {}".format(ctx.message.author.mention)
await client.send_message(ctx.message.channel, msg)