mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-09 23:36:02 +00:00
refactor: 恢复插件事件调用
This commit is contained in:
@@ -19,7 +19,7 @@ from ..utils import version as version_mgr, proxy as proxy_mgr
|
||||
|
||||
|
||||
class Application:
|
||||
im_mgr: im_mgr.QQBotManager = None
|
||||
im_mgr: im_mgr.PlatformManager = None
|
||||
|
||||
cmd_mgr: cmdmgr.CommandManager = None
|
||||
|
||||
|
||||
@@ -88,10 +88,13 @@ async def make_app() -> app.Application:
|
||||
|
||||
# 发送公告
|
||||
ann_mgr = announce.AnnouncementManager(ap)
|
||||
announcements = await ann_mgr.fetch_new()
|
||||
try:
|
||||
announcements = await ann_mgr.fetch_new()
|
||||
|
||||
for ann in announcements:
|
||||
ap.logger.info(f'[公告] {ann.time}: {ann.content}')
|
||||
for ann in announcements:
|
||||
ap.logger.info(f'[公告] {ann.time}: {ann.content}')
|
||||
except Exception as e:
|
||||
ap.logger.warning(f'获取公告时出错: {e}')
|
||||
|
||||
ap.query_pool = pool.QueryPool()
|
||||
|
||||
@@ -99,8 +102,13 @@ async def make_app() -> app.Application:
|
||||
await ver_mgr.initialize()
|
||||
ap.ver_mgr = ver_mgr
|
||||
|
||||
if await ap.ver_mgr.is_new_version_available():
|
||||
ap.logger.info("有新版本可用,请使用 !update 命令更新")
|
||||
try:
|
||||
|
||||
if await ap.ver_mgr.is_new_version_available():
|
||||
ap.logger.info("有新版本可用,请使用 !update 命令更新")
|
||||
|
||||
except Exception as e:
|
||||
ap.logger.warning(f"检查版本更新时出错: {e}")
|
||||
|
||||
plugin_mgr_inst = plugin_mgr.PluginManager(ap)
|
||||
await plugin_mgr_inst.initialize()
|
||||
@@ -141,7 +149,7 @@ async def make_app() -> app.Application:
|
||||
await llm_tool_mgr_inst.initialize()
|
||||
ap.tool_mgr = llm_tool_mgr_inst
|
||||
|
||||
im_mgr_inst = im_mgr.QQBotManager(ap=ap)
|
||||
im_mgr_inst = im_mgr.PlatformManager(ap=ap)
|
||||
await im_mgr_inst.initialize()
|
||||
ap.im_mgr = im_mgr_inst
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import traceback
|
||||
|
||||
from . import app, entities
|
||||
from ..pipeline import entities as pipeline_entities
|
||||
from ..plugin import events
|
||||
|
||||
DEFAULT_QUERY_CONCURRENCY = 10
|
||||
|
||||
|
||||
Reference in New Issue
Block a user