def bot_has_permissions(**perms):
def predicate(ctx):<EOL><INDENT>guild = ctx.guild<EOL>me = guild.me if guild is not None else ctx.bot.user<EOL>permissions = ctx.channel.permissions_for(me)<EOL>missing = [perm for perm, value in perms.items() if getattr(permissions, perm, None) != value]<EOL>if not missing:<EOL><INDENT>return True<EOL><DEDENT>raise BotMissingPermissions(missing)<EOL><DEDENT>return check(predicate)<EOL>
Similar to :func:`.has_permissions` except checks if the bot itself has
    the permissions listed.

    This check raises a special exception, :exc:`.BotMissingPermissions`
    that is inherited from :exc:`.CheckFailure`.