rewrite: Sysadmin module.

This commit is contained in:
2022-11-18 08:49:21 +02:00
parent 860660d152
commit 09e7a36c9f
11 changed files with 1659 additions and 276 deletions

View File

@@ -0,0 +1,42 @@
"""
The dashboard shows a summary of the various registered global bot settings.
"""
import discord
import discord.ext.commands as cmds
from meta import LionBot, LionCog, LionContext
from meta.app import appname
from wards import sys_admin
from settings.groups import SettingGroup
class LeoSettings(LionCog, group_name='leo'):
__cog_is_app_commands_group__ = True
depends = {'CoreCog'}
def __init__(self, bot: LionBot):
self.bot = bot
self.bot_setting_groups: list[SettingGroup] = []
@cmds.hybrid_command(
name='dashboard',
description="Global setting dashboard"
)
@cmds.check(sys_admin)
async def dash_cmd(self, ctx: LionContext):
embed = discord.Embed(
title="System Admin Dashboard",
colour=discord.Colour.orange()
)
for group in self.bot_setting_groups:
table = await group.make_setting_table(appname)
description = group.description.format(ctx=ctx, bot=ctx.bot).strip()
embed.add_field(
name=group.title.format(ctx=ctx, bot=ctx.bot),
value=f"{description}\n{table}"
)
await ctx.reply(embed=embed)