member.py 文件源码

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

项目:curious 作者: SunDwarf 项目源码 文件源码
def _sorted_roles(self) -> 'List[dt_role.Role]':
        if not self._member.guild:
            return []

        roles = []
        for id in self._member.role_ids:
            try:
                roles.append(self._member.guild.roles[id])
            except (KeyError, AttributeError):
                pass

        return sorted(roles)

    # opt: the default Sequence makes us re-create the sorted role list constantly
    # we don't wanna cache it, without introducing invalidation hell
    # so we just put `__iter__` on `_sorted_roles`
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号