🐛 修改bug

This commit is contained in:
HibiKier
2024-08-07 18:59:43 +08:00
parent e07851aecf
commit 968fb7b157
7 changed files with 326 additions and 295 deletions
@@ -337,7 +337,6 @@ async def _(
@_group_status_matcher.handle()
async def _(
bot: Bot,
session: EventSession,
arparma: Arparma,
status: str,
@@ -348,7 +347,7 @@ async def _(
logger.info("进行休眠", arparma.header_result, session=session)
await Text("那我先睡觉了...").finish()
else:
if PluginManage.is_wake(gid):
if await PluginManage.is_wake(gid):
await Text("我还醒着呢!").finish()
await PluginManage.wake(gid)
logger.info("醒来", arparma.header_result, session=session)
+8 -11
View File
@@ -1,7 +1,4 @@
from typing import Dict
from unittest import result
from nonebot.adapters import Bot, Event
from nonebot.adapters import Bot
from nonebot.exception import IgnoredException
from nonebot.matcher import Matcher
from nonebot_plugin_alconna import UniMsg
@@ -10,7 +7,6 @@ from nonebot_plugin_session import EventSession
from pydantic import BaseModel
from zhenxun.configs.config import Config
from zhenxun.models.ban_console import BanConsole
from zhenxun.models.group_console import GroupConsole
from zhenxun.models.level_user import LevelUser
from zhenxun.models.plugin_info import PluginInfo
@@ -41,9 +37,9 @@ class LimitManage:
add_module = []
cd_limit: Dict[str, Limit] = {}
block_limit: Dict[str, Limit] = {}
count_limit: Dict[str, Limit] = {}
cd_limit: dict[str, Limit] = {}
block_limit: dict[str, Limit] = {}
count_limit: dict[str, Limit] = {}
@classmethod
def add_limit(cls, limit: PluginLimit):
@@ -209,7 +205,8 @@ class AuthChecker:
if user_id and matcher.plugin and (module_path := matcher.plugin.module_name):
user = await UserConsole.get_user(user_id, session.platform)
if plugin := await PluginInfo.get_or_none(module_path=module_path):
if plugin.plugin_type == PluginType.HIDDEN:
if plugin.plugin_type == PluginType.HIDDEN and plugin.name != "帮助":
logger.debug("插件为HIDDEN且不是帮助功能,已跳过...")
return
try:
cost_gold = await self.auth_cost(user, plugin, session)
@@ -433,7 +430,7 @@ class AuthChecker:
if group.level < 0:
"""群权限小于0"""
logger.debug(
f"{plugin.name}({plugin.module}) 群黑名单, 群权限-1...",
f"群黑名单, 群权限-1...",
"HOOK",
session=session,
)
@@ -442,7 +439,7 @@ class AuthChecker:
"""群休眠"""
if text.strip() != "醒来":
logger.debug(
f"{plugin.name}({plugin.module}) 功能总开关关闭状态...",
f"功能总开关关闭状态...",
"HOOK",
session=session,
)
+3 -3
View File
@@ -105,7 +105,7 @@ async def _():
if module_list := await PluginInfo.all().values("id", "module_path"):
module2id = {m["module_path"]: m["id"] for m in module_list}
for plugin in get_loaded_plugins():
load_plugin.append(plugin.name)
load_plugin.append(plugin.module_name)
if plugin.metadata:
await _handle_setting(plugin, plugin_list, limit_list, task_list)
create_list = []
@@ -162,8 +162,8 @@ async def _():
10,
)
await data_migration()
await PluginInfo.filter(module__in=load_plugin).update(load_status=True)
await PluginInfo.filter(module__not_in=load_plugin).update(load_status=False)
await PluginInfo.filter(module_path__in=load_plugin).update(load_status=True)
await PluginInfo.filter(module_path__not_in=load_plugin).update(load_status=False)
async def data_migration():