2024-01-16 05:31:11 -05:00
|
|
|
from discord import ui, ButtonStyle, Interaction, SelectOption
|
2024-01-15 09:58:53 -05:00
|
|
|
from redbot.core import commands
|
|
|
|
|
|
|
|
from aurora.configuration.embed import embed
|
|
|
|
from aurora.utilities.config import config
|
|
|
|
|
|
|
|
class Overrides(ui.View):
|
|
|
|
def __init__(self, ctx: commands.Context):
|
|
|
|
super().__init__()
|
|
|
|
self.ctx = ctx
|
|
|
|
|
2024-01-16 05:31:11 -05:00
|
|
|
@ui.select(cls=ui.Select, placeholder="Auto Evidence Format", row=0, options=[
|
2024-01-16 05:39:00 -05:00
|
|
|
SelectOption(label="Enabled", value=1, emoji="✅"),
|
|
|
|
SelectOption(label="Disabled", value=0, emoji="❌"),
|
2024-01-16 05:36:02 -05:00
|
|
|
SelectOption(label="Default", value='None', emoji="🔁")
|
2024-01-16 05:31:11 -05:00
|
|
|
])
|
|
|
|
async def auto_evidenceformat(self, interaction: Interaction, select: ui.Select): # pylint: disable=unused-argument
|
2024-01-15 10:20:47 -05:00
|
|
|
await interaction.response.defer()
|
2024-01-15 10:22:36 -05:00
|
|
|
if self.ctx.author != interaction.user:
|
2024-01-15 10:24:18 -05:00
|
|
|
await interaction.followup.send("You cannot change this setting for other users.", ephemeral=True)
|
2024-01-15 10:22:36 -05:00
|
|
|
return
|
2024-01-16 05:36:02 -05:00
|
|
|
if select.values[0] == 'None':
|
|
|
|
await config.user(self.ctx.author).auto_evidenceformat.clear()
|
|
|
|
else:
|
2024-01-16 05:39:00 -05:00
|
|
|
await config.user(self.ctx.author).auto_evidenceformat.set(bool(select.values[0]))
|
2024-01-15 10:20:47 -05:00
|
|
|
await interaction.message.edit(embed=await embed(self.ctx))
|
2024-01-15 09:58:53 -05:00
|
|
|
|
2024-01-16 05:33:25 -05:00
|
|
|
@ui.select(cls=ui.Select, placeholder="Epheremal", row=1, options=[
|
2024-01-16 05:39:00 -05:00
|
|
|
SelectOption(label="Enabled", value=1, emoji="✅"),
|
|
|
|
SelectOption(label="Disabled", value=0, emoji="❌"),
|
2024-01-16 05:36:02 -05:00
|
|
|
SelectOption(label="Default", value='None', emoji="🔁")
|
2024-01-16 05:33:25 -05:00
|
|
|
])
|
|
|
|
async def ephemeral(self, interaction: Interaction, select: ui.Select): # pylint: disable=unused-argument
|
2024-01-15 10:22:36 -05:00
|
|
|
await interaction.response.defer()
|
|
|
|
if self.ctx.author != interaction.user:
|
2024-01-15 10:25:09 -05:00
|
|
|
await interaction.followup.send("You cannot change this setting for other users.", ephemeral=True)
|
2024-01-15 10:22:36 -05:00
|
|
|
return
|
2024-01-16 05:36:02 -05:00
|
|
|
if select.values[0] == 'None':
|
|
|
|
await config.user(self.ctx.author).history_ephemeral.clear()
|
|
|
|
else:
|
2024-01-16 05:39:00 -05:00
|
|
|
await config.user(self.ctx.author).history_ephemeral.set(bool(select.values[0]))
|
2024-01-15 10:22:36 -05:00
|
|
|
await interaction.message.edit(embed=await embed(self.ctx))
|
2024-01-15 09:58:53 -05:00
|
|
|
|
2024-01-16 05:33:25 -05:00
|
|
|
@ui.select(cls=ui.Select, placeholder="Inline", row=2, options=[
|
2024-01-16 05:39:00 -05:00
|
|
|
SelectOption(label="Enabled", value=1, emoji="✅"),
|
|
|
|
SelectOption(label="Disabled", value=0, emoji="❌"),
|
2024-01-16 05:36:02 -05:00
|
|
|
SelectOption(label="Default", value='None', emoji="🔁")
|
2024-01-16 05:33:25 -05:00
|
|
|
])
|
2024-01-16 05:36:02 -05:00
|
|
|
async def inline(self, interaction: Interaction, select: ui.Select): # pylint: disable=unused-argument
|
2024-01-15 10:22:36 -05:00
|
|
|
await interaction.response.defer()
|
|
|
|
if self.ctx.author != interaction.user:
|
2024-01-15 10:25:09 -05:00
|
|
|
await interaction.followup.send("You cannot change this setting for other users.", ephemeral=True)
|
2024-01-15 10:22:36 -05:00
|
|
|
return
|
2024-01-16 05:36:02 -05:00
|
|
|
if select.values[0] == 'None':
|
|
|
|
await config.user(self.ctx.author).history_inline.clear()
|
|
|
|
else:
|
2024-01-16 05:39:00 -05:00
|
|
|
await config.user(self.ctx.author).history_inline.set(bool(select.values[0]))
|
2024-01-15 10:22:36 -05:00
|
|
|
await interaction.message.edit(embed=await embed(self.ctx))
|