From de8f05f1d84f8cdd74458a062b0c6f8e74ee527d Mon Sep 17 00:00:00 2001 From: gsd Date: Sat, 11 Mar 2023 20:24:20 +0300 Subject: [PATCH] =?UTF-8?q?=D1=8F=20=D0=BA=D1=80=D1=83=D1=82=D0=BE=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- other_ext/stats_loader.py | 3 +-- other_ext/stats_presence.py | 6 ++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/other_ext/stats_loader.py b/other_ext/stats_loader.py index d90a4a4..3997bd7 100644 --- a/other_ext/stats_loader.py +++ b/other_ext/stats_loader.py @@ -7,7 +7,7 @@ class Extension: def __init__(self, core): self.core = core - async def task(self, timeout = 60): + async def task(self, timeout = 15): await self.core.wait_until_ready() while True: await self.updater() @@ -15,7 +15,6 @@ class Extension: async def updater(self): try: - print("Load stats from backend") self.core.stats = await self.core.GetStats() except: traceback.print_exc() \ No newline at end of file diff --git a/other_ext/stats_presence.py b/other_ext/stats_presence.py index a02047c..848422d 100644 --- a/other_ext/stats_presence.py +++ b/other_ext/stats_presence.py @@ -9,7 +9,7 @@ class Extension: def __init__(self, core): self.core = core - async def task(self, timeout = 3): + async def task(self, timeout = 5): await self.core.wait_until_ready() while True: await self.updater() @@ -28,7 +28,9 @@ class Extension: server = list(self.core.stats['servers'].values())[self.show_stats_prev] addr = server['address'].split(":") - act = discord.Streaming(name = f"{server['name']} - {server['player_count']}", url=f"https://{addr[0]}/connect/{addr[1]}") + #act = discord.Streaming(name = f"{server['name']} - {server['player_count']}", url=f"https://{addr[0]}/connect/{addr[1]}") + # https://stackoverflow.com/a/59126629 + act = discord.Activity(type=discord.ActivityType.watching, name = f"{server['name']} - {server['player_count']}") await self.core.change_presence(activity=act) except: traceback.print_exc() \ No newline at end of file