From 9ef06824a7ca5b1314c0c6e9dc77c318b86a79ec Mon Sep 17 00:00:00 2001 From: "Dusty.P" Date: Fri, 20 Apr 2018 19:49:01 -0800 Subject: [PATCH] Switching to fetchval --- geeksbot.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/geeksbot.py b/geeksbot.py index 0102e79..f8894bb 100644 --- a/geeksbot.py +++ b/geeksbot.py @@ -69,8 +69,8 @@ class Geeksbot(commands.Bot): @staticmethod async def get_custom_prefix(bot_inst, message): - return bot_inst.db_con.fetchval('select prefix from guild_config where guild_id = $1', - message.guild.id) or bot_inst.default_prefix + return await bot_inst.db_con.fetchval('select prefix from guild_config where guild_id = $1', + message.guild.id) or bot_inst.default_prefix async def load_ext(self, ctx, mod=None): self.load_extension('{0}.{1}'.format(extension_dir, mod)) @@ -122,14 +122,14 @@ async def unload(ctx, mod): async def on_message(ctx): if not ctx.author.bot: if ctx.guild: - if int(bot.db_con.fetchval("select channel_lockdown from guild_config where guild_id = $1", - ctx.guild.id)): - if ctx.channel.id in json.loads(bot.db_con.fetchval("select allowed_channels from guild_config " - "where guild_id = $1", - ctx.guild.id)): + if int(await bot.db_con.fetchval("select channel_lockdown from guild_config where guild_id = $1", + ctx.guild.id)): + if ctx.channel.id in json.loads(await bot.db_con.fetchval("select allowed_channels from guild_config " + "where guild_id = $1", + ctx.guild.id)): await bot.process_commands(ctx) elif ctx.channel.id == 418452585683484680: - prefix = bot.db_con.fetchval('select prefix from guild_config where guild_id = $1', ctx.guild.id) + prefix = await bot.db_con.fetchval('select prefix from guild_config where guild_id = $1', ctx.guild.id) prefix = prefix[0] if prefix else bot.default_prefix ctx.content = f'{prefix}{ctx.content}' await bot.process_commands(ctx)