From 0bf6143bf30bac2755f81ff8995dbd67c241428c Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Tue, 16 Jan 2024 11:24:39 +0000 Subject: [PATCH] fix(aurora): fixing some stuff relating to embed generation --- aurora/abc.py | 2 +- aurora/configuration/commands.py | 8 ++++---- aurora/configuration/embed.py | 23 ++++++++++++++--------- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/aurora/abc.py b/aurora/abc.py index 4e1846b..f34d9a9 100644 --- a/aurora/abc.py +++ b/aurora/abc.py @@ -37,7 +37,7 @@ class Mixin(ABC): raise NotImplementedError() @abstractmethod - async def aurora_settings_core(self, ctx: commands.Context) -> None: + async def aurora_settings_overrides(self, ctx: commands.Context) -> None: raise NotImplementedError() @abstractmethod diff --git a/aurora/configuration/commands.py b/aurora/configuration/commands.py index 11b226e..cf68dd1 100644 --- a/aurora/configuration/commands.py +++ b/aurora/configuration/commands.py @@ -2,7 +2,7 @@ from redbot.core import commands from redbot.core.utils.chat_formatting import error, warning 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.importers.aurora import ImportAuroraView from aurora.importers.galacticbot import ImportGalacticBotView @@ -19,11 +19,11 @@ class Configuration(Mixin): async def aurora_settings(self, ctx: commands.Context): """Configure Aurora's settings.""" - @aurora_settings.command(name="user") - async def aurora_settings_core(self, ctx: commands.Context): + @aurora_settings.command(name="overrides", aliases=["override", "user"]) + async def aurora_settings_overrides(self, ctx: commands.Context): """Manage Aurora's user overriddable settings.""" 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"]) @commands.admin_or_permissions(manage_guild=True) diff --git a/aurora/configuration/embed.py b/aurora/configuration/embed.py index e6eeca3..9144540 100644 --- a/aurora/configuration/embed.py +++ b/aurora/configuration/embed.py @@ -17,18 +17,18 @@ async def _core(ctx: commands.Context) -> Embed: e.set_thumbnail(url=ctx.bot.user.display_avatar.url) 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.""" override_settings = { - "ephemeral": await config.user(user).history_ephemeral(), - "inline": await config.user(user).history_inline(), - "inline_pagesize": await config.user(user).history_inline_pagesize(), - "pagesize": await config.user(user).history_pagesize(), - "auto_evidenceformat": await config.user(user).auto_evidenceformat() + "ephemeral": await config.user(ctx.author).history_ephemeral(), + "inline": await config.user(ctx.author).history_inline(), + "inline_pagesize": await config.user(ctx.author).history_inline_pagesize(), + "pagesize": await config.user(ctx.author).history_pagesize(), + "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 bold("Auto Evidence Format: ") + get_bool_emoji(override_settings['auto_evidenceformat']), 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("Pagesize: ") + get_pagesize_str(override_settings['pagesize']), ] - overrides = '\n'.join(overrides) - return overrides + override_str = '\n'.join(override_str) + + 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: """Generates a configuration menu field value for a guild's settings."""