add support for users which aren't in the leaderboards table
@@ -145,7 +145,7 @@ class MechaKaren:
commands_dump = list(self.commands.items())
self.commands.clear()
- await self.db.executemany("UPDATE leaderboards SET commands = commands + $2 WHERE user_id = $1", commands_dump)
+ await self.db.executemany("INSERT INTO leaderboards (user_id, commands) VALUES ($1, $2) ON CONFLICT DO UPDATE leaderboards SET commands = commands + $2 WHERE user_id = $1", commands_dump)
async def start(self, pp):
self.db = await asyncpg.connect(
