roles.py 文件源码

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

项目:Chiaki-Nanami 作者: Ikusaba-san 项目源码 文件源码
def convert(self, ctx, arg):
        if not ctx.guild:
            raise commands.NoPrivateMessage

        self_roles = await _get_self_roles(ctx)
        if not self_roles:
            message = ("This server has no self-assignable roles. "
                       f"Use `{ctx.prefix}asar` to add one.")
            raise commands.BadArgument(message)

        temp_guild = copy.copy(ctx.guild)
        temp_guild.roles = self_roles

        with temp_attr(ctx, 'guild', temp_guild):
            try:
                return await super().convert(ctx, arg)
            except commands.BadArgument:
                raise commands.BadArgument(f'{arg} is not a self-assignable role...')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号