fix wordcount

This commit is contained in:
Nexus 2024-09-20 01:23:38 +01:00
parent 9be4f0d55a
commit cace903669

View file

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