From e363d29b3b3df35bbdada5af323d795b23b2d411 Mon Sep 17 00:00:00 2001 From: HibiKier <45528451+HibiKier@users.noreply.github.com> Date: Fri, 13 Dec 2024 15:31:18 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BC=98=E5=8C=96Bot=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E6=8F=92=E4=BB=B6=EF=BC=8C=E6=9B=B4=E6=96=B0=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E8=AF=B4=E6=98=8E=E5=8F=8A=E4=BB=A3=E7=A0=81=E7=BB=93?= =?UTF-8?q?=E6=9E=84=20(#1767)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../superuser/bot_manage/__init__.py | 19 ++++++++++++++----- zhenxun/models/user_console.py | 3 ++- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/zhenxun/builtin_plugins/superuser/bot_manage/__init__.py b/zhenxun/builtin_plugins/superuser/bot_manage/__init__.py index 93ca1ffe..5800905a 100644 --- a/zhenxun/builtin_plugins/superuser/bot_manage/__init__.py +++ b/zhenxun/builtin_plugins/superuser/bot_manage/__init__.py @@ -1,4 +1,3 @@ -from pathlib import Path from typing import cast import nonebot @@ -15,21 +14,31 @@ driver = nonebot.get_driver() -_sub_plugins = set() -_sub_plugins |= nonebot.load_plugins(str(Path(__file__).parent.resolve())) - __plugin_meta__ = PluginMetadata( name="Bot管理", description="指定bot对象的功能/被动开关和状态", usage=""" + 指令: + bot被动状态 : bot的被动技能状态 + bot开启/关闭被动[被动名称] : 被动技能开关 + bot开启/关闭所有被动 : 所有被动技能开关 + bot插件列表: bot插件列表状态 : bot插件列表 + bot开启/关闭所有插件 : 所有插件开关 + bot开启/关闭插件[插件名称] : 插件开关 + bot休眠 : bot休眠,屏蔽所有消息 + bot醒来 : bot醒来 """.strip(), extra=PluginExtraData( author="", version="0.1", - plugin_type=PluginType.PARENT, + plugin_type=PluginType.SUPERUSER, ).dict(), ) +from .bot_switch import * # noqa: F403 +from .plugin import * # noqa: F403 +from .task import * # noqa: F403 + @driver.on_bot_connect async def init_bot_console(bot: Bot): diff --git a/zhenxun/models/user_console.py b/zhenxun/models/user_console.py index 1059ddff..f43d7bb3 100644 --- a/zhenxun/models/user_console.py +++ b/zhenxun/models/user_console.py @@ -106,7 +106,8 @@ async def reduce_gold( InsufficientGold: 金币不足 """ user, _ = await cls.get_or_create( - user_id=user_id, defaults={"platform": platform, "uid": cls.get_new_uid()} + user_id=user_id, + defaults={"platform": platform, "uid": await cls.get_new_uid()}, ) if user.gold < gold: raise InsufficientGold()