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
|
return
|
||||||
await interaction.response.defer()
|
await interaction.response.defer()
|
||||||
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 False:
|
||||||
await config.user(self.ctx.author).auto_evidenceformat.set(not current_setting)
|
await config.user(self.ctx.author).auto_evidenceformat.clear()
|
||||||
else:
|
if current_setting is None:
|
||||||
await config.user(self.ctx.author).auto_evidenceformat.set(True)
|
await config.user(self.ctx.author).auto_evidenceformat.set(True)
|
||||||
await interaction.message.edit(embed=await embed(self.ctx))
|
else:
|
||||||
|
await config.user(self.ctx.author).auto_evidenceformat.set(False)
|
||||||
@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()
|
|
||||||
await config.user(self.ctx.author).auto_evidenceformat.clear()
|
|
||||||
await interaction.message.edit(embed=await embed(self.ctx))
|
await interaction.message.edit(embed=await embed(self.ctx))
|
||||||
|
|
||||||
@ui.button(label="Ephemeral", style=ButtonStyle.green, row=0)
|
@ui.button(label="Ephemeral", style=ButtonStyle.green, row=0)
|
||||||
|
@ -39,19 +32,12 @@ class Overrides(ui.View):
|
||||||
return
|
return
|
||||||
await interaction.response.defer()
|
await interaction.response.defer()
|
||||||
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 is False:
|
||||||
await config.user(self.ctx.author).history_ephemeral.set(not current_setting)
|
await config.user(self.ctx.author).history_ephemeral.clear()
|
||||||
else:
|
if current_setting is None:
|
||||||
await config.user(self.ctx.author).history_ephemeral.set(True)
|
await config.user(self.ctx.author).history_ephemeral.set(True)
|
||||||
await interaction.message.edit(embed=await embed(self.ctx))
|
else:
|
||||||
|
await config.user(self.ctx.author).history_ephemeral.set(False)
|
||||||
@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()
|
|
||||||
await config.user(self.ctx.author).history_ephemeral.clear()
|
|
||||||
await interaction.message.edit(embed=await embed(self.ctx))
|
await interaction.message.edit(embed=await embed(self.ctx))
|
||||||
|
|
||||||
@ui.button(label="Inline", style=ButtonStyle.green, row=0)
|
@ui.button(label="Inline", style=ButtonStyle.green, row=0)
|
||||||
|
@ -61,22 +47,15 @@ class Overrides(ui.View):
|
||||||
return
|
return
|
||||||
await interaction.response.defer()
|
await interaction.response.defer()
|
||||||
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 is False:
|
||||||
await config.user(self.ctx.author).history_inline.set(not current_setting)
|
await config.user(self.ctx.author).history_inline.clear()
|
||||||
else:
|
if current_setting is None:
|
||||||
await config.user(self.ctx.author).history_inline.set(True)
|
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))
|
await interaction.message.edit(embed=await embed(self.ctx))
|
||||||
|
|
||||||
@ui.button(label="Reset", style=ButtonStyle.red, row=1)
|
@ui.select(placeholder="Inline Pagesize", options=create_pagesize_options(), 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()
|
|
||||||
await config.user(self.ctx.author).history_inline.clear()
|
|
||||||
await interaction.message.edit(embed=await embed(self.ctx))
|
|
||||||
|
|
||||||
@ui.select(placeholder="Inline Pagesize", options=create_pagesize_options(), row=2)
|
|
||||||
async def inline_pagesize(self, interaction: Interaction, select: ui.Select,): # pylint: disable=unused-argument
|
async def inline_pagesize(self, interaction: Interaction, select: ui.Select,): # pylint: disable=unused-argument
|
||||||
if self.ctx.author != interaction.user:
|
if self.ctx.author != interaction.user:
|
||||||
await interaction.response.send_message("You cannot change this setting for other users.", ephemeral=True)
|
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 config.user(self.ctx.author).history_inline_pagesize.set(int(select.values[0]))
|
||||||
await interaction.message.edit(embed=await embed(self.ctx))
|
await interaction.message.edit(embed=await embed(self.ctx))
|
||||||
|
|
||||||
@ui.button(label="Reset Inline Pagesize", style=ButtonStyle.red, row=4)
|
@ui.select(placeholder="Pagesize", options=create_pagesize_options(), row=2)
|
||||||
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)
|
|
||||||
async def pagesize(self, interaction: Interaction, select: ui.Select,): # pylint: disable=unused-argument
|
async def pagesize(self, interaction: Interaction, select: ui.Select,): # pylint: disable=unused-argument
|
||||||
if self.ctx.author != interaction.user:
|
if self.ctx.author != interaction.user:
|
||||||
await interaction.response.send_message("You cannot change this setting for other users.", ephemeral=True)
|
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 interaction.response.defer()
|
||||||
await config.user(self.ctx.author).history_pagesize.set(int(select.values[0]))
|
await config.user(self.ctx.author).history_pagesize.set(int(select.values[0]))
|
||||||
await interaction.message.edit(embed=await embed(self.ctx))
|
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]:
|
def create_pagesize_options() -> list[SelectOption]:
|
||||||
"""Returns a list of SelectOptions for pagesize configuration."""
|
"""Returns a list of SelectOptions for pagesize configuration."""
|
||||||
return [
|
options = []
|
||||||
|
options.append(
|
||||||
SelectOption(
|
SelectOption(
|
||||||
label=str(i),
|
label="Default",
|
||||||
value=str(i),
|
value="default",
|
||||||
description=f"Set the pagesize to {i}.",
|
description="Reset the pagesize to the default value.",
|
||||||
)
|
)
|
||||||
for i in range(1, 21)
|
)
|
||||||
]
|
for i in range(1, 21):
|
||||||
|
options.append(
|
||||||
|
SelectOption(
|
||||||
|
label=str(i),
|
||||||
|
value=str(i),
|
||||||
|
description=f"Set the pagesize to {i}.",
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return options
|
||||||
|
|
Loading…
Reference in a new issue