def RequiresVerification():
    def predicate(ctx):
        if getuserfromdiscord(ctx.author.id) is None:
            raise UserNotVerified

        return True

    return commands.check(predicate)
Beispiel #2
0
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)
Beispiel #3
0
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))
Beispiel #4
0
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))
Beispiel #5
0
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))
Beispiel #6
0
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))
Beispiel #7
0
def is_user(user_ids): return commands.check(lambda ctx: user_check(ctx, user_ids))

def bot_owner(ctx):
Beispiel #8
0
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)
Beispiel #10
0
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)
Beispiel #11
0
def is_owner():
    def check_owner(ctx):
        x = check_user_is_owner(ctx)
        return True if x else False

    return commands.check(check_owner)