asmbot.py 文件源码

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

项目:Discord-ASM-Bot 作者: Emzi0767 项目源码 文件源码
def game_watch(self):
        if self.gamewatch_running:
            return

        self.gamewatch_running = True
        try:
            lop = datetime.datetime(2015, 1, 1, 0, 0, 0, tzinfo=datetime.timezone.utc)
            asmbot.log("Gamewatch for shard {} initialized".format(self.shard_id), tag="ASM GAME")

            while not self.is_closed:
                cop = datetime.datetime.now(datetime.timezone.utc)
                tdelta = cop - lop

                if tdelta.seconds >= 900:
                    lop = cop
                    await self.change_presence(game=discord.Game(name="LLVM"))

                await asyncio.sleep(0.1)

        except CancelledError:
            pass

        except Exception as e:
            asmbot.logex(e, tag="ASM GAME")

        finally:
            self.gamewatch_running = False
            asmbot.log("Gamewatch for shard {} closed".format(self.shard_id), tag="ASM GAME")

    # Error handling
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号