utility.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:aryas 作者: lattkkthxbbye 项目源码 文件源码
def in_channel(name):
    """
    Checks if command is sent in a given channel ignores high roles.
    To be used as a decorator
    :param name: name of the channel
    """
    def predicate(ctx):
        if ctx.message.channel.is_private:
            return False

        # Adapted from discord.ext.core.has_any_role
        user_roles = functools.partial(discordutils.get, ctx.message.author.roles)
        if any(user_roles(name=role) is not None for role in ['Admin', 'Moderator', 'Support']):
            return True

        return ctx.message.channel.name == name

    return commands.check(predicate)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号