def RequiresVerification(): def predicate(ctx): if getuserfromdiscord(ctx.author.id) is None: raise UserNotVerified return True return commands.check(predicate)
def admin_command(): def predicate(ctx): # Returns true if Bot itself or user is not in a private message and user has the admin role for the channel. return (ctx.me.id == ctx.author.id or (not isinstance(ctx.author, User) and next( filter(lambda role: role.id == ctx.bot.admin_role_id(), ctx.author.roles), None) is not None)) return commands.check(predicate)
def in_guild(guild_ids): return commands.check(lambda ctx: guild_check(ctx, guild_ids)) def is_user(user_ids): return commands.check(lambda ctx: user_check(ctx, user_ids))
def is_guild_admin(): return commands.check(lambda ctx: guild_admin_check(ctx)) def in_guild(guild_ids): return commands.check(lambda ctx: guild_check(ctx, guild_ids))
def is_bot_admin(): return commands.check(lambda ctx: bot_admin_check(ctx)) def is_guild_admin(): return commands.check(lambda ctx: guild_admin_check(ctx))
def is_bot_owner(): return commands.check(lambda ctx: bot_owner_check(ctx)) def is_bot_admin(): return commands.check(lambda ctx: bot_admin_check(ctx))
def is_user(user_ids): return commands.check(lambda ctx: user_check(ctx, user_ids)) def bot_owner(ctx):
def voice_command(): def predicate(ctx): return not isinstance(ctx.message.author, User) and ctx.message.author.voice is not None return commands.check(predicate)
def is_in_guild(guild_id): """check that command is in a guild""" async def predicate(ctx): return ctx.guild and ctx.guild.id == guild_id return commands.check(predicate)
def is_mod(): async def check_mod(ctx): x = check_user_is_mod(ctx) return True if x else False return commands.check(check_mod)
def is_owner(): def check_owner(ctx): x = check_user_is_owner(ctx) return True if x else False return commands.check(check_owner)