diff --git a/bot/extensions/custom_roles/commands.py b/bot/extensions/custom_roles/commands.py index 9703e8bd..dcf28da9 100644 --- a/bot/extensions/custom_roles/commands.py +++ b/bot/extensions/custom_roles/commands.py @@ -109,7 +109,9 @@ async def myrole( @app_commands.describe(channel="New channel") async def log_channel(self, interaction: discord.Interaction, channel: discord.TextChannel): """Set custom role log channel""" - query = """UPDATE configs SET custom_role_log_channel_id = $1 WHERE guild_id = $2""" + query = """UPDATE configs + SET custom_role_log_channel_id = $1 + WHERE guild_id = $2""" await Config.execute(query, channel.id, interaction.guild.id) return await interaction.response.send_message(f"Log Channel set to {channel.mention}") diff --git a/bot/extensions/custom_roles/events.py b/bot/extensions/custom_roles/events.py index c0dab71d..a3cdad94 100644 --- a/bot/extensions/custom_roles/events.py +++ b/bot/extensions/custom_roles/events.py @@ -16,7 +16,8 @@ def __init__(self, bot: core.DiscordBot): self.updated_at: dict[int, datetime] = {} async def get_custom_roles_logs_channel(self): - query = """SELECT * FROM configs WHERE guild_id = $1""" + query = """SELECT * FROM configs + WHERE guild_id = $1""" data = await Config.fetchrow(query, self.bot.guild.id) return self.bot.guild.get_channel(data.custom_role_log_channel_id) diff --git a/bot/extensions/levelling/commands.py b/bot/extensions/levelling/commands.py index 767a2386..6f26ce5a 100644 --- a/bot/extensions/levelling/commands.py +++ b/bot/extensions/levelling/commands.py @@ -489,8 +489,11 @@ async def xp_boost(self, interaction: discord.Interaction, multiplier: int): """Change the xp multiplier""" if 0 < multiplier <= 10: self.xp_boost = multiplier - query = """UPDATE configs SET xp_boost = $1 - WHERE guild_id = $2""" + query = """ + UPDATE configs + SET xp_boost = $1 + WHERE guild_id = $2 + """ await Config.execute(query, multiplier, interaction.guild.id) return await interaction.response.send_message(f"XP multiplied by {multiplier}x.") else: @@ -505,8 +508,11 @@ async def min_xp(self, interaction: discord.Interaction, xp: int): ) if 0 < xp <= 100: self.min_xp = xp - query = """UPDATE configs SET min_xp = $1 - WHERE guild_id = $2""" + query = """ + UPDATE configs + SET min_xp = $1 + WHERE guild_id = $2 + """ await Config.execute(query, xp, interaction.guild.id) return await interaction.response.send_message(f"Min XP gained each message updated to {xp}") else: @@ -521,8 +527,10 @@ async def max_xp(self, interaction: discord.Interaction, xp: int): ) if 1 < xp <= 500: self.min_xp = xp - query = """UPDATE configs SET max_xp = $1 - WHERE guild_id = $2""" + query = """ + UPDATE configs + SET max_xp = $1 + WHERE guild_id = $2""" await Config.execute(query, xp, interaction.guild.id) return await interaction.response.send_message(f"Max XP gained each message updated to {xp}") else: @@ -531,7 +539,9 @@ async def max_xp(self, interaction: discord.Interaction, xp: int): @config.command(name="info") async def current_config(self, interaction: discord.Interaction): """Return the current configuration settings""" - query = """SELECT * FROM configs where guild_id = $1""" + query = """ + SELECT * FROM configs + WHERE guild_id = $1""" x = await Config.fetchrow(query, interaction.guild.id) return await interaction.response.send_message(x) diff --git a/bot/models/configs.py b/bot/models/configs.py index 045707ba..cc045361 100644 --- a/bot/models/configs.py +++ b/bot/models/configs.py @@ -11,9 +11,10 @@ class Config(Model): @classmethod async def ensure_exists(cls, guild_id: int): - query = """INSERT INTO configs (guild_id) + query = """ + INSERT INTO configs (guild_id) VALUES ($1) ON CONFLICT (guild_id) - DO UPDATE SET guild_id = configs.guild_id - RETURNING *""" + DO UPDATE SET guild_id = configs.guild_id + RETURNING *""" return await cls.fetchrow(query, guild_id)