mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-09-29 00:32:06 +08:00
bugfix:更换数据库初始化超时路径以修复连接超时问题 (#2137)
* bugfix:更换数据库初始化超时路径以修复连接超时问题 * 移除部分观测链路 * 细节修改 * 权限检查细节修改2 * bugfix:修复金币懒加载造成插件金币消耗不了的问题 * bugfix:整理鉴权逻辑 * 完善缓存系统 * 优化官端使用 * bugfix:增加官机和频道的前导统一剥离,新增获取群列表自愈 * bugfix:修复导入问题
This commit is contained in:
@@ -30,7 +30,7 @@ async def _(bot: Bot):
|
||||
参数:
|
||||
bot: Bot
|
||||
"""
|
||||
if PlatformUtils.get_platform(bot) != "qq":
|
||||
if PlatformUtils.get_platform_scope(bot) != "qq_client":
|
||||
return
|
||||
|
||||
logger.debug(f"更新Bot: {bot.self_id} 的群认证...", "群认证同步")
|
||||
@@ -44,6 +44,13 @@ async def _(bot: Bot):
|
||||
)
|
||||
return
|
||||
|
||||
if not current_group_list:
|
||||
logger.warning(
|
||||
f"Bot: {bot.self_id} 未获取到任何群组,"
|
||||
"本次不会创建群认证;后续群消息将尝试按事件自愈。",
|
||||
"群认证同步",
|
||||
)
|
||||
|
||||
db_group_list: list[str] = await GroupConsole.all().values_list(
|
||||
"group_id", flat=True
|
||||
) # pyright: ignore[reportAssignmentType]
|
||||
|
||||
@@ -8,7 +8,7 @@ from nonebot_plugin_apscheduler import scheduler
|
||||
from zhenxun.configs.utils import PluginExtraData, Task
|
||||
from zhenxun.models.group_console import GroupConsole
|
||||
from zhenxun.models.task_info import TaskInfo
|
||||
from zhenxun.services.cache.runtime_cache import TaskInfoMemoryCache
|
||||
from zhenxun.services.cache.runtime_cache import GroupMemoryCache, TaskInfoMemoryCache
|
||||
from zhenxun.services.log import logger
|
||||
from zhenxun.utils.common_utils import CommonUtils
|
||||
from zhenxun.utils.manager.priority_manager import PriorityLifecycle
|
||||
@@ -63,6 +63,8 @@ async def update_to_group(create_list: list[tuple[bool, TaskInfo]]):
|
||||
)
|
||||
group.block_task = CommonUtils.convert_module_format(block_tasks)
|
||||
await GroupConsole.bulk_update(group_list, ["block_task"], 10)
|
||||
for group in group_list:
|
||||
await GroupMemoryCache.upsert_from_model(group)
|
||||
|
||||
|
||||
async def to_db(
|
||||
@@ -146,8 +148,10 @@ async def _():
|
||||
for plugin in get_loaded_plugins():
|
||||
await _handle_setting(plugin, task_info_list, task_list)
|
||||
if not task_info_list:
|
||||
await TaskInfo.all().update(load_status=False)
|
||||
await TaskInfoMemoryCache.refresh()
|
||||
logger.warning(
|
||||
"未扫描到任何被动技能,跳过 TaskInfo.load_status 全量关闭,"
|
||||
"避免插件加载异常时误关闭全部被动技能。",
|
||||
)
|
||||
return
|
||||
module_dict = {t[1]: t[0] for t in await TaskInfo.all().values_list("id", "module")}
|
||||
load_task = []
|
||||
|
||||
Reference in New Issue
Block a user