feat: 拓展中心加入机器人

This commit is contained in:
Wxw-Gu committed 2026-11-18 11:22:39 +08:00
1 parent 4eaddc2d75
commit a81b3733fa
31 files changed
+3510 -566

No files matched your search

@@ -0,0 +1,31 @@
'use strict'
/** 群聊机器人后台入口壳:核心逻辑由 lib/bot-engine 承载,缺失时保持静默空操作且不报错。 */
let engine = null
try {
engine = require('../lib/bot-engine')
} catch {
engine = null
}
function registerFallbackHandlers(tm) {
if (!tm || !tm.page || typeof tm.page.onRequest !== 'function') return
const unavailable = async () => {
throw new Error('当前功能暂不可用')
}
tm.page.onRequest('previewReply', unavailable)
tm.page.onRequest('refreshGroupMemory', unavailable)
tm.page.onRequest('testSend', unavailable)
}
module.exports = function activate(api) {
if (engine && typeof engine.activateBotRuntime === 'function') {
engine.activateBotRuntime(api)
} else {
registerFallbackHandlers(api)
}
if (api && api.log && typeof api.log.info === 'function') {
api.log.info('群聊机器人已启动')
}
}