diff --git a/__version__ b/__version__
index 6a078e8e..9985c50b 100644
--- a/__version__
+++ b/__version__
@@ -1 +1 @@
-__version__: v0.2.3-27e13e0
+__version__: v0.2.3-5f361ff
diff --git a/zhenxun/builtin_plugins/admin/plugin_switch/_data_source.py b/zhenxun/builtin_plugins/admin/plugin_switch/_data_source.py
index f79bc838..1c1bd030 100644
--- a/zhenxun/builtin_plugins/admin/plugin_switch/_data_source.py
+++ b/zhenxun/builtin_plugins/admin/plugin_switch/_data_source.py
@@ -133,7 +133,7 @@ async def build_task(group_id: str | None) -> BuildImage:
task.id,
task.module,
task.name,
- "开启" if task.module not in group.block_task else "关闭",
+ "开启" if f"<{task.module}," not in group.block_task else "关闭",
"开启" if task.status else "关闭",
task.run_time or "-",
]
@@ -214,9 +214,6 @@ class PluginManage:
f"<{module},", ""
)
else:
- module_list = await PluginInfo.filter(
- plugin_type=PluginType.NORMAL
- ).values_list("module", flat=True)
module_list = [f"<{module}" for module in module_list]
group.block_plugin = ",".join(module_list) + "," # type: ignore
await group.save(update_fields=["block_plugin"])
diff --git a/zhenxun/builtin_plugins/scripts.py b/zhenxun/builtin_plugins/scripts.py
index 56c4d918..b265eb7c 100644
--- a/zhenxun/builtin_plugins/scripts.py
+++ b/zhenxun/builtin_plugins/scripts.py
@@ -70,16 +70,20 @@ async def _():
data_list = []
for group in await GroupConsole.all():
if group.block_plugin:
- if modules := group.block_plugin.split(",")[:-1]:
+ if modules := group.block_plugin.split(","):
if block_plugin := [
f"<{module}" for module in modules if not module.startswith("<")
]:
- group.block_plugin = ",".join(block_plugin) + ","
+ group.block_plugin = (",".join(block_plugin) + ",").replace(
+ "<,", ""
+ )
if group.block_task:
- if modules := group.block_task.split(",")[:-1]:
+ if modules := group.block_task.split(","):
if block_task := [
f"<{module}" for module in modules if not module.startswith("<")
]:
- group.block_task = ",".join(block_task) + ","
+ group.block_task = (",".join(block_task) + ",").replace(
+ "<,", ""
+ )
data_list.append(group)
await GroupConsole.bulk_update(data_list, ["block_plugin", "block_task"], 10)
diff --git a/zhenxun/services/log.py b/zhenxun/services/log.py
index a2b5e07a..11983de1 100644
--- a/zhenxun/services/log.py
+++ b/zhenxun/services/log.py
@@ -1,12 +1,12 @@
+from typing import Any, overload
from datetime import datetime, timedelta
-from typing import Any, Dict, overload
from nonebot import require
require("nonebot_plugin_session")
from loguru import logger as logger_
-from nonebot.log import default_filter, default_format
from nonebot_plugin_session import Session
+from nonebot.log import default_filter, default_format
from zhenxun.configs.path_config import LOG_PATH
@@ -33,8 +33,10 @@ class logger:
TEMPLATE_A = "Adapter[{}] {}"
TEMPLATE_B = "Adapter[{}] [{}]: {}"
TEMPLATE_C = "Adapter[{}] 用户[{}] 触发 [{}]: {}"
- TEMPLATE_D = "Adapter[{}] 群聊[{}] 用户[{}] 触发 [{}]: {}"
- TEMPLATE_E = "Adapter[{}] 群聊[{}] 用户[{}] 触发 [{}] [Target]({}): {}"
+ TEMPLATE_D = "Adapter[{}] 群聊[{}] 用户[{}] 触发"
+ " [{}]: {}"
+ TEMPLATE_E = "Adapter[{}] 群聊[{}] 用户[{}] 触发"
+ " [{}] [Target]({}): {}"
TEMPLATE_ADAPTER = "Adapter[{}] "
TEMPLATE_USER = "用户[{}] "
@@ -88,8 +90,7 @@ class logger:
platform: str | None = None,
):
user_id: str | None = session # type: ignore
- group_id = None
- if type(session) == Session:
+ if isinstance(session, Session):
user_id = session.id1
adapter = session.bot_type
if session.id3:
@@ -102,7 +103,7 @@ class logger:
)
try:
logger_.opt(colors=True).info(template)
- except Exception as e:
+ except Exception:
logger_.info(template)
@classmethod
@@ -110,7 +111,7 @@ class logger:
cls,
info: str,
command: str,
- param: Dict[str, Any] | None = None,
+ param: dict[str, Any] | None = None,
result: str = "",
):
param_str = ""
@@ -163,8 +164,7 @@ class logger:
e: Exception | None = None,
):
user_id: str | None = session # type: ignore
- group_id = None
- if type(session) == Session:
+ if isinstance(session, Session):
user_id = session.id1
adapter = session.bot_type
if session.id3:
@@ -224,8 +224,7 @@ class logger:
e: Exception | None = None,
):
user_id: str | None = session # type: ignore
- group_id = None
- if type(session) == Session:
+ if isinstance(session, Session):
user_id = session.id1
adapter = session.bot_type
if session.id3:
@@ -285,8 +284,7 @@ class logger:
e: Exception | None = None,
):
user_id: str | None = session # type: ignore
- group_id = None
- if type(session) == Session:
+ if isinstance(session, Session):
user_id = session.id1
adapter = session.bot_type
if session.id3:
diff --git a/zhenxun/utils/platform.py b/zhenxun/utils/platform.py
index 6ecddb54..a80ab6b7 100644
--- a/zhenxun/utils/platform.py
+++ b/zhenxun/utils/platform.py
@@ -604,6 +604,11 @@ async def broadcast_group(
or group.channel_id in ignore_group
)
) or key in _used_group:
+ logger.debug(
+ "广播方法群组重复, 已跳过...",
+ log_cmd,
+ group_id=group.group_id,
+ )
continue
is_run = False
if check_func:
@@ -612,6 +617,11 @@ async def broadcast_group(
else:
is_run = check_func(group.group_id)
if not is_run:
+ logger.debug(
+ "广播方法检测运行方法为 False, 已跳过...",
+ log_cmd,
+ group_id=group.group_id,
+ )
continue
target = PlatformUtils.get_target(
_bot, None, group.group_id, group.channel_id