fix(aurora): fixing some stuff relating to embed generation

This commit is contained in:
Seaswimmer 2024-01-16 11:24:39 +00:00
parent 4795fac5ac
commit 0bf6143bf3
Signed by untrusted user: cswimr
GPG key ID: D74DDDDF420E13DF
3 changed files with 19 additions and 14 deletions

View file

@ -37,7 +37,7 @@ class Mixin(ABC):
raise NotImplementedError() raise NotImplementedError()
@abstractmethod @abstractmethod
async def aurora_settings_core(self, ctx: commands.Context) -> None: async def aurora_settings_overrides(self, ctx: commands.Context) -> None:
raise NotImplementedError() raise NotImplementedError()
@abstractmethod @abstractmethod

View file

@ -2,7 +2,7 @@ from redbot.core import commands
from redbot.core.utils.chat_formatting import error, warning from redbot.core.utils.chat_formatting import error, warning
from aurora.configuration.menus.overrides import Overrides from aurora.configuration.menus.overrides import Overrides
from aurora.configuration.embed import addrole_embed, embed, immune_embed from aurora.configuration.embed import addrole_embed, overrides, immune_embed
from aurora.abc import Mixin from aurora.abc import Mixin
from aurora.importers.aurora import ImportAuroraView from aurora.importers.aurora import ImportAuroraView
from aurora.importers.galacticbot import ImportGalacticBotView from aurora.importers.galacticbot import ImportGalacticBotView
@ -19,11 +19,11 @@ class Configuration(Mixin):
async def aurora_settings(self, ctx: commands.Context): async def aurora_settings(self, ctx: commands.Context):
"""Configure Aurora's settings.""" """Configure Aurora's settings."""
@aurora_settings.command(name="user") @aurora_settings.command(name="overrides", aliases=["override", "user"])
async def aurora_settings_core(self, ctx: commands.Context): async def aurora_settings_overrides(self, ctx: commands.Context):
"""Manage Aurora's user overriddable settings.""" """Manage Aurora's user overriddable settings."""
view = Overrides(ctx) view = Overrides(ctx)
await ctx.send(embed=await embed(ctx), view=view) await ctx.send(embed=await overrides(ctx), view=view)
@aurora_settings.command(name="addrole", aliases=["removerole"]) @aurora_settings.command(name="addrole", aliases=["removerole"])
@commands.admin_or_permissions(manage_guild=True) @commands.admin_or_permissions(manage_guild=True)

View file

@ -17,18 +17,18 @@ async def _core(ctx: commands.Context) -> Embed:
e.set_thumbnail(url=ctx.bot.user.display_avatar.url) e.set_thumbnail(url=ctx.bot.user.display_avatar.url)
return e return e
async def _overrides(user: Union[Member, User]) -> str: async def overrides(ctx: commands.Context) -> Embed:
"""Generates a configuration menu field value for a user's overrides.""" """Generates a configuration menu field value for a user's overrides."""
override_settings = { override_settings = {
"ephemeral": await config.user(user).history_ephemeral(), "ephemeral": await config.user(ctx.author).history_ephemeral(),
"inline": await config.user(user).history_inline(), "inline": await config.user(ctx.author).history_inline(),
"inline_pagesize": await config.user(user).history_inline_pagesize(), "inline_pagesize": await config.user(ctx.author).history_inline_pagesize(),
"pagesize": await config.user(user).history_pagesize(), "pagesize": await config.user(ctx.author).history_pagesize(),
"auto_evidenceformat": await config.user(user).auto_evidenceformat() "auto_evidenceformat": await config.user(ctx.author).auto_evidenceformat()
} }
overrides = [ override_str = [
"These settings will override the relevant guild settings.\n", # Add an extra line between the subtitle and the settings "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("Auto Evidence Format: ") + get_bool_emoji(override_settings['auto_evidenceformat']),
bold("Ephemeral: ") + get_bool_emoji(override_settings['ephemeral']), bold("Ephemeral: ") + get_bool_emoji(override_settings['ephemeral']),
@ -36,8 +36,13 @@ async def _overrides(user: Union[Member, User]) -> str:
bold("Inline Pagesize: ") + get_pagesize_str(override_settings['inline_pagesize']), bold("Inline Pagesize: ") + get_pagesize_str(override_settings['inline_pagesize']),
bold("Pagesize: ") + get_pagesize_str(override_settings['pagesize']), bold("Pagesize: ") + get_pagesize_str(override_settings['pagesize']),
] ]
overrides = '\n'.join(overrides) override_str = '\n'.join(override_str)
return overrides
e = _core(ctx)
e.title += ": User Overrides"
e.add_field(name="User Overrides", value=override_str, inline=False)
return e
return override_str
async def _guild(guild: Guild) -> str: async def _guild(guild: Guild) -> str:
"""Generates a configuration menu field value for a guild's settings.""" """Generates a configuration menu field value for a guild's settings."""