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
评论列表
文章目录