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 <[email protected]>
This commit is contained in:
esefandClaude Opus 5 committed 2026-10-20 13:12:57 +03:00
1 parent d514601651
commit 93e22a8364
2 files changed
+6

No files matched your search

+3
View File
@@ -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')