- scheduler.py:apscheduler 薄封装(统一 Asia/Shanghai、misfire_grace_time、起止/异常日志) - task_slots.py:长任务任务槽(进度上报 / 同槽去重 / SSE 推送 / 取消), video_analysis temp 清理等长任务接入 - outbound_media:新增 HEXI_MEDIA_MODE 显式发送方式(http/base64/file,/hub 可改), 修复 alconna 对 base64 载荷补 https:// 前缀导致的 fetch failed(repair_mangled_url) - learning_chat 定时任务迁入 hexi.core.scheduler - 测试:新增 test_scheduler / test_task_slots,扩充 test_outbound_media Co-Authored-By: Claude Code <noreply@anthropic.com>
27 lines
837 B
Python
27 lines
837 B
Python
from nonebot import get_driver, logger
|
|
|
|
# 显式导入子模块注册 matcher/工具(hexi/core 为机器人核心模块,非 NoneBot 插件)
|
|
from . import ( # noqa: E402,F401
|
|
cooldown,
|
|
custom_utils,
|
|
message_utils,
|
|
outbound_media,
|
|
plugin_control,
|
|
plugin_manager,
|
|
rate_limit,
|
|
task_slots,
|
|
)
|
|
|
|
|
|
@get_driver().on_startup
|
|
async def _startup_plugin_gate() -> None:
|
|
"""等所有插件 matcher 注册完成后,把统一 filter 规则注入到 application 插件。"""
|
|
n = plugin_control.instrument_plugin_gate()
|
|
logger.info(f"插件控制面: 已注入 {n} 条 gateway 规则")
|
|
|
|
|
|
@get_driver().on_startup
|
|
async def _startup_outbound_media() -> None:
|
|
"""挂载本机媒体服务:协议端据此回拉 bot 生成的本地文件(内部已处理降级)。"""
|
|
outbound_media.mount_media_endpoint()
|