fix cache population for guild langs and prefixes
@@ -13,12 +13,12 @@ class Database(commands.Cog):
return [r[0] for r in botban_records]
async def fetch_all_guild_langs(self):
- lang_records = await self.db.fetch('SELECT lang FROM guilds WHERE lang != $1 AND lang != $2', None, 'en_us')
- return [r[0] for r in lang_records]
+ lang_records = await self.db.fetch('SELECT gid, lang FROM guilds WHERE lang != $1 AND lang != $2', None, 'en_us')
+ return dict((r[0], r[1],) for r in lang_records) # needs to be a dict
async def fetch_all_guild_prefixes(self):
- prefix_records = await self.db.fetch('SELECT prefix FROM guilds WHERE prefix != $1 AND prefix != $2', None, '/')
- return [r[0] for r in prefix_records]
+ prefix_records = await self.db.fetch('SELECT gid, prefix FROM guilds WHERE prefix != $1 AND prefix != $2', None, '/')
+ return dict((r[0], r[1],) for r in prefix_records) # needs to be a dict
async def fetch_user(self, uid):
user = await self.db.fetchrow('SELECT * FROM users WHERE uid = $1', uid)
