fix(aurora): you can no longer change other people's overrides
This commit is contained in:
parent
a7f6cff625
commit
1e9a6abe74
1 changed files with 13 additions and 14 deletions
|
@ -12,6 +12,9 @@ class Overrides(ui.View):
|
||||||
@ui.button(label="Auto Evidence Format", style=ButtonStyle.green)
|
@ui.button(label="Auto Evidence Format", style=ButtonStyle.green)
|
||||||
async def auto_evidenceformat(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
async def auto_evidenceformat(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||||
await interaction.response.defer()
|
await interaction.response.defer()
|
||||||
|
if self.ctx.author != interaction.user:
|
||||||
|
await interaction.response.send_message("You cannot change this setting for other users.", ephemeral=True)
|
||||||
|
return
|
||||||
current_setting = await config.user(self.ctx.author).auto_evidenceformat()
|
current_setting = await config.user(self.ctx.author).auto_evidenceformat()
|
||||||
if current_setting is not None:
|
if current_setting is not None:
|
||||||
await config.user(self.ctx.author).auto_evidenceformat.set(not current_setting)
|
await config.user(self.ctx.author).auto_evidenceformat.set(not current_setting)
|
||||||
|
@ -21,30 +24,26 @@ class Overrides(ui.View):
|
||||||
|
|
||||||
@ui.button(label="Ephemeral", style=ButtonStyle.green)
|
@ui.button(label="Ephemeral", style=ButtonStyle.green)
|
||||||
async def ephemeral(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
async def ephemeral(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||||
await interaction.response.defer(ephemeral=True)
|
await interaction.response.defer()
|
||||||
|
if self.ctx.author != interaction.user:
|
||||||
|
await interaction.response.send_message("You cannot change this setting for other users.", ephemeral=True)
|
||||||
|
return
|
||||||
current_setting = await config.user(self.ctx.author).history_ephemeral()
|
current_setting = await config.user(self.ctx.author).history_ephemeral()
|
||||||
if current_setting:
|
if current_setting:
|
||||||
await config.user(self.ctx.author).history_ephemeral.set(not current_setting)
|
await config.user(self.ctx.author).history_ephemeral.set(not current_setting)
|
||||||
else:
|
else:
|
||||||
await config.user(self.ctx.author).history_ephemeral.set(True)
|
await config.user(self.ctx.author).history_ephemeral.set(True)
|
||||||
if current_setting is True:
|
await interaction.message.edit(embed=await embed(self.ctx))
|
||||||
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)
|
@ui.button(label="Inline", style=ButtonStyle.green)
|
||||||
async def inline(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
async def inline(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||||
await interaction.response.defer(ephemeral=True)
|
await interaction.response.defer()
|
||||||
|
if self.ctx.author != interaction.user:
|
||||||
|
await interaction.response.send_message("You cannot change this setting for other users.", ephemeral=True)
|
||||||
|
return
|
||||||
current_setting = await config.user(self.ctx.author).history_inline()
|
current_setting = await config.user(self.ctx.author).history_inline()
|
||||||
if current_setting:
|
if current_setting:
|
||||||
await config.user(self.ctx.author).history_inline.set(not current_setting)
|
await config.user(self.ctx.author).history_inline.set(not current_setting)
|
||||||
else:
|
else:
|
||||||
await config.user(self.ctx.author).history_inline.set(True)
|
await config.user(self.ctx.author).history_inline.set(True)
|
||||||
if current_setting is True:
|
await interaction.message.edit(embed=await embed(self.ctx))
|
||||||
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)
|
|
||||||
|
|
Loading…
Reference in a new issue