fix redis wanting bytes

This commit is contained in:
Nexus 2024-09-19 01:52:32 +01:00
parent d9cc1e2651
commit ff81adde75

View file

@ -58,7 +58,7 @@ class MemeteraCounter(niobot.Module):
key = "june_wordcount_%s" % word
self.log.debug("Fetching redis key %r", key)
stored = await self.bot.redis.get(key)
stored = stored or 0
stored = int(stored) if stored else 0
stored += count
await self.bot.redis.set(key, count)
self.log.debug("June has now said %r %d times", word, stored)
@ -76,6 +76,7 @@ class MemeteraCounter(niobot.Module):
lines.append("```md")
for key in await self.bot.redis.keys("june_wordcount_*"):
value = await self.bot.redis.get(key)
value = int(value)
if raw:
lines.append(f"* {key}: {value}")
else: