Ejemplo n.º 1
0
def RequiresVerification():
    def predicate(ctx):
        if getuserfromdiscord(ctx.author.id) is None:
            raise UserNotVerified

        return True

    return commands.check(predicate)
Ejemplo n.º 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)
Ejemplo n.º 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))
Ejemplo n.º 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))
Ejemplo n.º 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))
Ejemplo n.º 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))
Ejemplo n.º 7
0
def is_user(user_ids): return commands.check(lambda ctx: user_check(ctx, user_ids))

def bot_owner(ctx):
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)