forked from blizzthewolf/SeaCogs
feat(aurora): moving to select menus for user overrides
This commit is contained in:
parent
ffcaeec653
commit
7ae16ea258
2 changed files with 13 additions and 13 deletions
|
@ -1,7 +1,7 @@
|
|||
from redbot.core import commands
|
||||
from redbot.core.utils.chat_formatting import error, warning
|
||||
|
||||
from aurora.configuration.menus.core import Overrides
|
||||
from aurora.configuration.menus.overrides import Overrides
|
||||
from aurora.configuration.embed import addrole_embed, embed, immune_embed
|
||||
from aurora.abc import Mixin
|
||||
from aurora.importers.aurora import ImportAuroraView
|
||||
|
@ -19,9 +19,9 @@ class Configuration(Mixin):
|
|||
async def aurora_settings(self, ctx: commands.Context):
|
||||
"""Configure Aurora's settings."""
|
||||
|
||||
@aurora_settings.command(name="core")
|
||||
@aurora_settings.command(name="user")
|
||||
async def aurora_settings_core(self, ctx: commands.Context):
|
||||
"""Manage Aurora's core settings."""
|
||||
"""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:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from discord import ui, ButtonStyle, Interaction
|
||||
from discord import ui, ButtonStyle, Interaction, SelectOption
|
||||
from redbot.core import commands
|
||||
|
||||
from aurora.configuration.embed import embed
|
||||
|
@ -9,20 +9,20 @@ class Overrides(ui.View):
|
|||
super().__init__()
|
||||
self.ctx = ctx
|
||||
|
||||
@ui.button(label="Auto Evidence Format", style=ButtonStyle.green)
|
||||
async def auto_evidenceformat(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
@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="🔁")
|
||||
])
|
||||
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
|
||||
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 config.user(self.ctx.author).auto_evidenceformat.set(select.values[0])
|
||||
await interaction.message.edit(embed=await embed(self.ctx))
|
||||
|
||||
@ui.button(label="Ephemeral", style=ButtonStyle.green)
|
||||
@ui.button(label="Ephemeral (U)", style=ButtonStyle.green, row=0)
|
||||
async def ephemeral(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
await interaction.response.defer()
|
||||
if self.ctx.author != interaction.user:
|
||||
|
@ -35,7 +35,7 @@ class Overrides(ui.View):
|
|||
await config.user(self.ctx.author).history_ephemeral.set(True)
|
||||
await interaction.message.edit(embed=await embed(self.ctx))
|
||||
|
||||
@ui.button(label="Inline", style=ButtonStyle.green)
|
||||
@ui.button(label="Inline (U)", style=ButtonStyle.green, row=0)
|
||||
async def inline(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
await interaction.response.defer()
|
||||
if self.ctx.author != interaction.user:
|
Loading…
Reference in a new issue