forked from cswimr/SeaCogs
fix(aurora): fixed overrides embed
This commit is contained in:
parent
0bf6143bf3
commit
7c6322041d
2 changed files with 12 additions and 12 deletions
|
@ -11,14 +11,13 @@ async def _core(ctx: commands.Context) -> Embed:
|
|||
"""Generates the core embed for configuration menus to use."""
|
||||
e = Embed(
|
||||
title="Aurora Configuration Menu",
|
||||
description="Use the buttons below to configure Aurora.",
|
||||
color=await ctx.embed_color()
|
||||
)
|
||||
e.set_thumbnail(url=ctx.bot.user.display_avatar.url)
|
||||
return e
|
||||
|
||||
async def overrides(ctx: commands.Context) -> Embed:
|
||||
"""Generates a configuration menu field value for a user's overrides."""
|
||||
"""Generates a configuration menu embed for a user's overrides."""
|
||||
|
||||
override_settings = {
|
||||
"ephemeral": await config.user(ctx.author).history_ephemeral(),
|
||||
|
@ -29,7 +28,6 @@ async def overrides(ctx: commands.Context) -> Embed:
|
|||
}
|
||||
|
||||
override_str = [
|
||||
"These settings will override the relevant guild settings.\n", # Add an extra line between the subtitle and the settings
|
||||
bold("Auto Evidence Format: ") + get_bool_emoji(override_settings['auto_evidenceformat']),
|
||||
bold("Ephemeral: ") + get_bool_emoji(override_settings['ephemeral']),
|
||||
bold("Inline: ") + get_bool_emoji(override_settings['inline']),
|
||||
|
@ -38,11 +36,13 @@ async def overrides(ctx: commands.Context) -> Embed:
|
|||
]
|
||||
override_str = '\n'.join(override_str)
|
||||
|
||||
e = _core(ctx)
|
||||
e = await _core(ctx)
|
||||
e.title += ": User Overrides"
|
||||
e.add_field(name="User Overrides", value=override_str, inline=False)
|
||||
e.description = """
|
||||
Use the buttons below to manage your user overrides.
|
||||
These settings will override the relevant guild settings.\n\n
|
||||
""" + override_str
|
||||
return e
|
||||
return override_str
|
||||
|
||||
async def _guild(guild: Guild) -> str:
|
||||
"""Generates a configuration menu field value for a guild's settings."""
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from discord import ui, ButtonStyle, Interaction
|
||||
from redbot.core import commands
|
||||
|
||||
from aurora.configuration.embed import embed
|
||||
from aurora.configuration.embed import overrides
|
||||
from aurora.configuration.utils import create_pagesize_options
|
||||
from aurora.utilities.config import config
|
||||
|
||||
|
@ -23,7 +23,7 @@ class Overrides(ui.View):
|
|||
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))
|
||||
await interaction.message.edit(embed=await overrides(self.ctx))
|
||||
|
||||
@ui.button(label="Ephemeral", style=ButtonStyle.green, row=0)
|
||||
async def ephemeral(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
|
@ -38,7 +38,7 @@ class Overrides(ui.View):
|
|||
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))
|
||||
await interaction.message.edit(embed=await overrides(self.ctx))
|
||||
|
||||
@ui.button(label="Inline", style=ButtonStyle.green, row=0)
|
||||
async def inline(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
|
@ -53,7 +53,7 @@ class Overrides(ui.View):
|
|||
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 overrides(self.ctx))
|
||||
|
||||
@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
|
||||
|
@ -65,7 +65,7 @@ class Overrides(ui.View):
|
|||
await config.user(self.ctx.author).history_inline_pagesize.clear()
|
||||
else:
|
||||
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 overrides(self.ctx))
|
||||
|
||||
@ui.select(placeholder="Pagesize", options=create_pagesize_options(), row=2)
|
||||
async def pagesize(self, interaction: Interaction, select: ui.Select,): # pylint: disable=unused-argument
|
||||
|
@ -77,4 +77,4 @@ class Overrides(ui.View):
|
|||
await config.user(self.ctx.author).history_pagesize.clear()
|
||||
else:
|
||||
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 overrides(self.ctx))
|
||||
|
|
Loading…
Reference in a new issue