feat(aurora): add per-type configuration options and a menu to configure them
Some checks failed
Actions / Build Documentation (MkDocs) (pull_request) Successful in 29s
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 42s

none of the options do anything yet, this is just creating the configuration keys and the menu to modify them
This commit is contained in:
Seaswimmer 2024-08-12 17:39:13 -04:00
parent 8aaa918b6e
commit 9c345ed96b
Signed by: cswimr
GPG key ID: 3813315477F26F82
5 changed files with 124 additions and 4 deletions

View file

@ -27,3 +27,13 @@ def register_config(config_obj: Config):
history_inline_pagesize=None,
auto_evidenceformat=None,
)
moderation_type = {
"show_in_history": bool,
"show_moderator": bool,
"use_discord_permissions": bool,
"dm_users": bool,
}
config_obj.init_custom("type", 2)
config_obj.register_custom("type", **moderation_type)

View file

@ -544,3 +544,39 @@ async def immune_embed(ctx: commands.Context) -> Embed:
e.description += "\n\n" + immune_str
return e
async def type_embed(ctx: commands.Context, moderation_type = Type) -> Embed:
"""Generates a configuration menu field value for a guild's settings."""
type_settings = {
"show_in_history": await config.custom("type", ctx.guild.id, moderation_type.key).show_in_history(),
"show_moderator": await config.custom("type", ctx.guild.id, moderation_type.key).show_moderator(),
"use_discord_permissions": await config.custom("type", ctx.guild.id, moderation_type.key).use_discord_permissions(),
"dm_users": await config.custom("type", ctx.guild.id, moderation_type.key).dm_users(),
}
guild_str = [
"- "
+ bold("Show in History: ")
+ get_bool_emoji(type_settings["show_in_history"]),
"- "
+ bold("Show Moderator: ")
+ get_bool_emoji(type_settings["show_moderator"]),
"- "
+ bold("Use Discord Permissions: ")
+ get_bool_emoji(type_settings["use_discord_permissions"]),
"- "
+ bold("DM Users: ")
+ get_bool_emoji(type_settings["dm_users"]),
]
guild_str = "\n".join(guild_str)
e = await _config(ctx)
e.title += ": Server Configuration"
e.description = (
"""
Use the buttons below to manage Aurora's server configuration.\n
"""
+ guild_str
)
return e