From a5b0055256160b4e699222689964ad2c0e3a1b8a Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Mon, 15 Jan 2024 15:09:01 +0000 Subject: [PATCH] fix(aurora): hopefully fixed erroring views --- aurora/configuration/menus/core.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/aurora/configuration/menus/core.py b/aurora/configuration/menus/core.py index d7e78d8..d04e569 100644 --- a/aurora/configuration/menus/core.py +++ b/aurora/configuration/menus/core.py @@ -11,27 +11,45 @@ class Overrides(ui.View): @ui.button(label="Auto Evidence Format", style=ButtonStyle.green) async def auto_evidenceformat(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument + await interaction.response.defer(ephemeral=True) current_setting = await config.user(self.ctx.author).auto_evidenceformat() - if current_setting: + if current_setting is not None: await config.user(self.ctx.author).auto_evidenceformat.set(not current_setting) else: await config.user(self.ctx.author).auto_evidenceformat.set(True) + if current_setting is True: + response = "Auto Evidence Format disabled." + else: + response = "Auto Evidence Format enabled." await self.ctx.message.edit(embed=await embed(self.ctx)) + await interaction.followup.send(content=response, ephemeral=True) @ui.button(label="Ephemeral", style=ButtonStyle.green) async def ephemeral(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument + await interaction.response.defer(ephemeral=True) current_setting = await config.user(self.ctx.author).history_ephemeral() if current_setting: await config.user(self.ctx.author).history_ephemeral.set(not current_setting) else: await config.user(self.ctx.author).history_ephemeral.set(True) + if current_setting is True: + response = "Ephemeral disabled." + else: + response = "Ephemeral enabled." await self.ctx.message.edit(embed=await embed(self.ctx)) + await interaction.followup.send(content=response, ephemeral=True) @ui.button(label="Inline", style=ButtonStyle.green) async def inline(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument + await interaction.response.defer(ephemeral=True) current_setting = await config.user(self.ctx.author).history_inline() if current_setting: await config.user(self.ctx.author).history_inline.set(not current_setting) else: await config.user(self.ctx.author).history_inline.set(True) + if current_setting is True: + response = "Inline disabled." + else: + response = "Inline enabled." await self.ctx.message.edit(embed=await embed(self.ctx)) + await interaction.followup.send(content=response, ephemeral=True)