core.py 文件源码

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

项目:nyx 作者: Cappycot 项目源码 文件源码
def status(self, ctx, color, *words):
        if any(color == a for a in green):
            color = Status.online
        elif any(color == a for a in yellow):
            color = Status.idle
        elif any(color == a for a in red):
            color = Status.dnd
        elif any(color == a for a in gray):
            color = Status.offline
        else:
            color = None
        if len(words) > 0:
            mention = ctx.bot.user.mention
            if ctx.guild is not None:
                mention = ctx.guild.get_member(ctx.bot.user.id).mention
            words = " ".join(words).replace(mention, "@" + ctx.bot.user.name)
            activity = Game(name=words)
            words = '"{}"'.format(words)
        else:
            activity = None
            words = "nothing"
        await self.nyx.change_presence(game=activity, status=color)
        await respond(ctx, 'I changed my status to {}...'.format(words))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号