diff --git a/src/onebot/index.ts b/src/onebot/index.ts index b529a3de..1cacec7c 100644 --- a/src/onebot/index.ts +++ b/src/onebot/index.ts @@ -50,7 +50,6 @@ import { import { OB11Message } from './types'; import { IOB11NetworkAdapter } from '@/onebot/network/adapter'; import { OB11HttpSSEServerAdapter } from './network/http-server-sse'; -import { OB11PluginAdapter } from './network/plugin'; //OneBot实现类 export class NapCatOneBot11Adapter { @@ -114,9 +113,9 @@ export class NapCatOneBot11Adapter { //创建NetWork服务 // 注册Plugin 如果需要基于NapCat进行快速开发 - this.networkManager.registerAdapter( - new OB11PluginAdapter('myPlugin', this.core, this,this.actions) - ); + // this.networkManager.registerAdapter( + // new OB11PluginAdapter('myPlugin', this.core, this,this.actions) + // ); for (const key of ob11Config.network.httpServers) { if (key.enable) { this.networkManager.registerAdapter( @@ -170,7 +169,7 @@ export class NapCatOneBot11Adapter { this.initBuddyListener(); this.initGroupListener(); - WebUiDataRuntime.setQQVersion(this.core.context.basicInfoWrapper.getFullQQVersion()); + WebUiDataRuntime.setQQVersion(this.core.context.basicInfoWrapper.getFullQQVesion()); WebUiDataRuntime.setQQLoginInfo(selfInfo); WebUiDataRuntime.setQQLoginStatus(true); WebUiDataRuntime.setOnOB11ConfigChanged(async (newConfig) => { diff --git a/src/plugin/index.ts b/src/plugin/index.ts index 8456073e..484a58b5 100644 --- a/src/plugin/index.ts +++ b/src/plugin/index.ts @@ -1,17 +1,11 @@ import { NapCatOneBot11Adapter, OB11Message } from '@/onebot'; -import { ChatType, NapCatCore } from '@/core'; +import { NapCatCore } from '@/core'; import { ActionMap } from '@/onebot/action'; import { OB11PluginAdapter } from '@/onebot/network/plugin'; export const plugin_onmessage = async (adapter: string, _core: NapCatCore, _obCtx: NapCatOneBot11Adapter, message: OB11Message, action: ActionMap, instance: OB11PluginAdapter) => { - const uid = await _core.apis.UserApi.getUidByUinV2(message.sender.user_id.toString()); - - const msgs = (await _core.apis.MsgApi.queryFirstMsgBySender({ - peerUid: message.group_id ? String(message.group_id) : String(uid), - chatType: ChatType.KCHATTYPEGROUP, - }, [uid])).msgList; - console.log('parse message ', message.sender.user_id, msgs.length); - for (const msg of msgs) { - await _obCtx.apis.MsgApi.parseMessageV2(msg) + if (message.raw_message === 'ping') { + const ret = await action.get('send_group_msg')?.handle({ group_id: String(message.group_id), message: 'pong' }, adapter, instance.config); + console.log(ret); } -} \ No newline at end of file +}; diff --git a/src/shell/napcat.ts b/src/shell/napcat.ts index 333b99f2..7b300cb0 100644 --- a/src/shell/napcat.ts +++ b/src/shell/napcat.ts @@ -1,4 +1,2 @@ -//export * from '@/common/performance-monitor'; import { NCoreInitShell } from './base'; - NCoreInitShell(); \ No newline at end of file