fix(aurora): fixed bad request

This commit is contained in:
Seaswimmer 2024-01-16 10:36:02 +00:00
parent 98a2c463b9
commit a43f3de8bc
Signed by untrusted user: cswimr
GPG key ID: D74DDDDF420E13DF
2 changed files with 17 additions and 11 deletions

View file

@ -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"])

View file

@ -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))