From a43f3de8bcafd0da55e1b3bfb9e2904598e16274 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Tue, 16 Jan 2024 10:36:02 +0000 Subject: [PATCH] fix(aurora): fixed bad request --- aurora/configuration/commands.py | 5 +---- aurora/configuration/menus/overrides.py | 23 ++++++++++++++++------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/aurora/configuration/commands.py b/aurora/configuration/commands.py index 3244a8e..11b226e 100644 --- a/aurora/configuration/commands.py +++ b/aurora/configuration/commands.py @@ -22,10 +22,7 @@ class Configuration(Mixin): @aurora_settings.command(name="user") async def aurora_settings_core(self, ctx: commands.Context): """Manage Aurora's user overriddable settings.""" - if ctx.guild is not None and (ctx.author.guild_permissions.administrator or ctx.author.guild_permissions.manage_guild): - view = None - else: - view = Overrides(ctx) + view = Overrides(ctx) await ctx.send(embed=await embed(ctx), view=view) @aurora_settings.command(name="addrole", aliases=["removerole"]) diff --git a/aurora/configuration/menus/overrides.py b/aurora/configuration/menus/overrides.py index be1c41a..244ad78 100644 --- a/aurora/configuration/menus/overrides.py +++ b/aurora/configuration/menus/overrides.py @@ -12,38 +12,47 @@ class Overrides(ui.View): @ui.select(cls=ui.Select, placeholder="Auto Evidence Format", row=0, options=[ SelectOption(label="Enabled", value=True, emoji="✅"), SelectOption(label="Disabled", value=False, emoji="❌"), - SelectOption(label="Default", value=None, emoji="🔁") + SelectOption(label="Default", value='None', emoji="🔁") ]) async def auto_evidenceformat(self, interaction: Interaction, select: ui.Select): # pylint: disable=unused-argument await interaction.response.defer() if self.ctx.author != interaction.user: await interaction.followup.send("You cannot change this setting for other users.", ephemeral=True) return - await config.user(self.ctx.author).auto_evidenceformat.set(select.values[0]) + if select.values[0] == 'None': + await config.user(self.ctx.author).auto_evidenceformat.clear() + else: + await config.user(self.ctx.author).auto_evidenceformat.set(select.values[0]) await interaction.message.edit(embed=await embed(self.ctx)) @ui.select(cls=ui.Select, placeholder="Epheremal", row=1, options=[ SelectOption(label="Enabled", value=True, emoji="✅"), SelectOption(label="Disabled", value=False, emoji="❌"), - SelectOption(label="Default", value=None, emoji="🔁") + SelectOption(label="Default", value='None', emoji="🔁") ]) async def ephemeral(self, interaction: Interaction, select: ui.Select): # pylint: disable=unused-argument await interaction.response.defer() if self.ctx.author != interaction.user: await interaction.followup.send("You cannot change this setting for other users.", ephemeral=True) return - await config.user(self.ctx.author).history_ephemeral.set(select.values[0]) + if select.values[0] == 'None': + await config.user(self.ctx.author).history_ephemeral.clear() + else: + await config.user(self.ctx.author).history_ephemeral.set(select.values[0]) await interaction.message.edit(embed=await embed(self.ctx)) @ui.select(cls=ui.Select, placeholder="Inline", row=2, options=[ SelectOption(label="Enabled", value=True, emoji="✅"), SelectOption(label="Disabled", value=False, emoji="❌"), - SelectOption(label="Default", value=None, emoji="🔁") + SelectOption(label="Default", value='None', emoji="🔁") ]) - async def inline(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument + async def inline(self, interaction: Interaction, select: ui.Select): # pylint: disable=unused-argument await interaction.response.defer() if self.ctx.author != interaction.user: await interaction.followup.send("You cannot change this setting for other users.", ephemeral=True) return - await config.user(self.ctx.author).history_inline.set(button.values[0]) + if select.values[0] == 'None': + await config.user(self.ctx.author).history_inline.clear() + else: + await config.user(self.ctx.author).history_inline.set(select.values[0]) await interaction.message.edit(embed=await embed(self.ctx))