forked from cswimr/SeaCogs
fix(aurora): fixing some stuff relating to embed generation
This commit is contained in:
parent
4795fac5ac
commit
0bf6143bf3
3 changed files with 19 additions and 14 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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."""
|
||||
|
|
Loading…
Reference in a new issue