forked from cswimr/SeaCogs
fix(aurora): changed a whole bunch of stuff in the user override config menu
This commit is contained in:
parent
045af7788b
commit
56857554e9
2 changed files with 32 additions and 62 deletions
|
@ -17,19 +17,12 @@ class Overrides(ui.View):
|
|||
return
|
||||
await interaction.response.defer()
|
||||
current_setting = await config.user(self.ctx.author).auto_evidenceformat()
|
||||
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)
|
||||
await interaction.message.edit(embed=await embed(self.ctx))
|
||||
|
||||
@ui.button(label="Reset", style=ButtonStyle.red, row=1)
|
||||
async def auto_evidenceformat_reset(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
if self.ctx.author != interaction.user:
|
||||
await interaction.response.send_message("You cannot change this setting for other users.", ephemeral=True)
|
||||
return
|
||||
await interaction.response.defer()
|
||||
if current_setting is False:
|
||||
await config.user(self.ctx.author).auto_evidenceformat.clear()
|
||||
if current_setting is None:
|
||||
await config.user(self.ctx.author).auto_evidenceformat.set(True)
|
||||
else:
|
||||
await config.user(self.ctx.author).auto_evidenceformat.set(False)
|
||||
await interaction.message.edit(embed=await embed(self.ctx))
|
||||
|
||||
@ui.button(label="Ephemeral", style=ButtonStyle.green, row=0)
|
||||
|
@ -39,19 +32,12 @@ class Overrides(ui.View):
|
|||
return
|
||||
await interaction.response.defer()
|
||||
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)
|
||||
await interaction.message.edit(embed=await embed(self.ctx))
|
||||
|
||||
@ui.button(label="Reset", style=ButtonStyle.red, row=1)
|
||||
async def ephemeral_reset(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
if self.ctx.author != interaction.user:
|
||||
await interaction.response.send_message("You cannot change this setting for other users.", ephemeral=True)
|
||||
return
|
||||
await interaction.response.defer()
|
||||
if current_setting is False:
|
||||
await config.user(self.ctx.author).history_ephemeral.clear()
|
||||
if current_setting is None:
|
||||
await config.user(self.ctx.author).history_ephemeral.set(True)
|
||||
else:
|
||||
await config.user(self.ctx.author).history_ephemeral.set(False)
|
||||
await interaction.message.edit(embed=await embed(self.ctx))
|
||||
|
||||
@ui.button(label="Inline", style=ButtonStyle.green, row=0)
|
||||
|
@ -61,22 +47,15 @@ class Overrides(ui.View):
|
|||
return
|
||||
await interaction.response.defer()
|
||||
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)
|
||||
await interaction.message.edit(embed=await embed(self.ctx))
|
||||
|
||||
@ui.button(label="Reset", style=ButtonStyle.red, row=1)
|
||||
async def inline_reset(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
if self.ctx.author != interaction.user:
|
||||
await interaction.response.send_message("You cannot change this setting for other users.", ephemeral=True)
|
||||
return
|
||||
await interaction.response.defer()
|
||||
if current_setting is False:
|
||||
await config.user(self.ctx.author).history_inline.clear()
|
||||
if current_setting is None:
|
||||
await config.user(self.ctx.author).history_inline.set(True)
|
||||
else:
|
||||
await config.user(self.ctx.author).history_inline.set(False)
|
||||
await interaction.message.edit(embed=await embed(self.ctx))
|
||||
|
||||
@ui.select(placeholder="Inline Pagesize", options=create_pagesize_options(), row=2)
|
||||
@ui.select(placeholder="Inline Pagesize", options=create_pagesize_options(), row=1)
|
||||
async def inline_pagesize(self, interaction: Interaction, select: ui.Select,): # pylint: disable=unused-argument
|
||||
if self.ctx.author != interaction.user:
|
||||
await interaction.response.send_message("You cannot change this setting for other users.", ephemeral=True)
|
||||
|
@ -85,16 +64,7 @@ class Overrides(ui.View):
|
|||
await config.user(self.ctx.author).history_inline_pagesize.set(int(select.values[0]))
|
||||
await interaction.message.edit(embed=await embed(self.ctx))
|
||||
|
||||
@ui.button(label="Reset Inline Pagesize", style=ButtonStyle.red, row=4)
|
||||
async def inline_pagesize_reset(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
if self.ctx.author != interaction.user:
|
||||
await interaction.response.send_message("You cannot change this setting for other users.", ephemeral=True)
|
||||
return
|
||||
await interaction.response.defer()
|
||||
await config.user(self.ctx.author).history_inline_pagesize.clear()
|
||||
await interaction.message.edit(embed=await embed(self.ctx))
|
||||
|
||||
@ui.select(placeholder="Pagesize", options=create_pagesize_options(), row=3)
|
||||
@ui.select(placeholder="Pagesize", options=create_pagesize_options(), row=2)
|
||||
async def pagesize(self, interaction: Interaction, select: ui.Select,): # pylint: disable=unused-argument
|
||||
if self.ctx.author != interaction.user:
|
||||
await interaction.response.send_message("You cannot change this setting for other users.", ephemeral=True)
|
||||
|
@ -102,12 +72,3 @@ class Overrides(ui.View):
|
|||
await interaction.response.defer()
|
||||
await config.user(self.ctx.author).history_pagesize.set(int(select.values[0]))
|
||||
await interaction.message.edit(embed=await embed(self.ctx))
|
||||
|
||||
@ui.button(label="Reset Pagesize", style=ButtonStyle.red, row=4)
|
||||
async def pagesize_reset(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
if self.ctx.author != interaction.user:
|
||||
await interaction.response.send_message("You cannot change this setting for other users.", ephemeral=True)
|
||||
return
|
||||
await interaction.response.defer()
|
||||
await config.user(self.ctx.author).history_pagesize.clear()
|
||||
await interaction.message.edit(embed=await embed(self.ctx))
|
||||
|
|
|
@ -18,11 +18,20 @@ def get_pagesize_str(value: Union[int, None]) -> str:
|
|||
|
||||
def create_pagesize_options() -> list[SelectOption]:
|
||||
"""Returns a list of SelectOptions for pagesize configuration."""
|
||||
return [
|
||||
options = []
|
||||
options.append(
|
||||
SelectOption(
|
||||
label="Default",
|
||||
value="default",
|
||||
description="Reset the pagesize to the default value.",
|
||||
)
|
||||
)
|
||||
for i in range(1, 21):
|
||||
options.append(
|
||||
SelectOption(
|
||||
label=str(i),
|
||||
value=str(i),
|
||||
description=f"Set the pagesize to {i}.",
|
||||
)
|
||||
for i in range(1, 21)
|
||||
]
|
||||
)
|
||||
return options
|
||||
|
|
Loading…
Reference in a new issue