rewrite: Ward refactor.

This commit is contained in:
2023-06-06 14:27:57 +03:00
parent e1a23695ee
commit 4bfc240530
21 changed files with 154 additions and 59 deletions

View File

@@ -20,7 +20,7 @@ from meta.app import shard_talk
from utils.ui import ChoicedEnum, Transformed, FastModal, LeoUI, error_handler_for, ModalRetryUI
from utils.lib import EmbedField, tabulate, MessageArgs, parse_ids, error_embed
from wards import sys_admin
from wards import sys_admin_ward
logger = logging.getLogger(__name__)
@@ -168,7 +168,7 @@ class Blacklists(LionCog):
name="blacklist",
description="Display and modify the user and guild blacklists."
)
@cmds.check(sys_admin)
@sys_admin_ward
async def blacklist_cmd(
self,
ctx: LionContext,

View File

@@ -7,7 +7,7 @@ import discord.ext.commands as cmds
from meta import LionBot, LionCog, LionContext
from meta.app import appname
from wards import sys_admin
from wards import sys_admin_ward
from settings.groups import SettingGroup
@@ -23,7 +23,7 @@ class LeoSettings(LionCog):
@cmds.hybrid_group(
name="leo"
)
@cmds.check(sys_admin)
@sys_admin_ward
async def leo_group(self, ctx: LionContext):
"""
Base command group for global leo-only functions.
@@ -35,7 +35,7 @@ class LeoSettings(LionCog):
name='dashboard',
description="Global setting dashboard"
)
@cmds.check(sys_admin)
@sys_admin_ward
async def dash_cmd(self, ctx: LionContext):
embed = discord.Embed(
title="System Admin Dashboard",
@@ -56,7 +56,7 @@ class LeoSettings(LionCog):
name='configure',
description="Leo Configuration Group"
)
@cmds.check(sys_admin)
@sys_admin_ward
async def leo_configure_group(self, ctx: LionContext):
"""
Base command group for global configuration of Leo.

View File

@@ -249,7 +249,7 @@ class Exec(LionCog):
self.talk_async = shard_talk.register_route('exec')(_async)
async def cog_check(self, ctx: LionContext) -> bool: # type: ignore
return await sys_admin(ctx)
return await sys_admin(ctx.bot, ctx.author.id)
@commands.hybrid_command(
name=_('async'),

View File

@@ -21,7 +21,7 @@ from settings.data import ModelData
from settings.setting_types import EnumSetting, StringSetting
from settings.groups import SettingGroup
from wards import sys_admin
from wards import sys_admin_ward
from . import babel
@@ -376,7 +376,7 @@ class PresenceCtrl(LionCog):
name="presence",
description="Globally set the bot status and activity."
)
@cmds.check(sys_admin)
@sys_admin_ward
@appcmds.describe(
status="Online status (online | idle | dnd | offline)",
type="Activity type (watching | listening | playing | streaming)",