From 93e22a8364a179c1248e9c2dc815a3ed5181342f Mon Sep 17 00:00:00 2001 From: esefxdz Date: Tue, 20 Oct 2026 13:12:57 +0300 Subject: [PATCH] statchannel: ignore steam's bogus zero player counts Steam's GetNumberOfCurrentPlayers occasionally answers 200 with player_count: 0 for a valid appid. Both Strinova stat channels were renamed to "0" on the same 09:48 tick on 2026-10-20 (the only zero in ~300 renames over 3 days), and the name sat wrong until the next 10-minute tick. Skip the rename on a non-positive count so the channel keeps its last good value, and log it so the next one is visible. !strinova had the same bug and would reply "0 players online right now". Co-Authored-By: Claude Opus 5 --- cogs/statchannel.py | 3 +++ cogs/sysinfo.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/cogs/statchannel.py b/cogs/statchannel.py index 5b213d9..a4c38cf 100644 --- a/cogs/statchannel.py +++ b/cogs/statchannel.py @@ -31,6 +31,9 @@ class StatChannel(commands.Cog): async with session.get('https://api.steampowered.com/ISteamUserStats/GetNumberOfCurrentPlayers/v1/?appid=1282270') as r: data = await r.json() count = data['response']['player_count'] + if not isinstance(count, int) or count <= 0: + print(f'stat channel update skipped (channel {channel_id}): steam returned {count!r}') + return channel = self.bot.get_channel(channel_id) if channel: await channel.edit(name=f'Strinova Players From Steam: {count:,}') diff --git a/cogs/sysinfo.py b/cogs/sysinfo.py index 6a3395f..06483ae 100644 --- a/cogs/sysinfo.py +++ b/cogs/sysinfo.py @@ -117,6 +117,9 @@ class SysInfo(commands.Cog): async with session.get('https://api.steampowered.com/ISteamUserStats/GetNumberOfCurrentPlayers/v1/?appid=1282270') as r: data = await r.json() count = data['response']['player_count'] + if not isinstance(count, int) or count <= 0: + await ctx.reply('🎮 Strinova — Steam is not returning a player count right now, try again in a bit') + return await ctx.reply(f'🎮 Strinova — {count:,} players online right now')