fix: error

This commit is contained in:
手瓜一十雪 2025-08-17 22:58:30 +08:00
parent 8133ff08a7
commit 857ed0f343
3 changed files with 9 additions and 18 deletions

View File

@ -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) => {

View File

@ -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);
}
}
};

View File

@ -1,4 +1,2 @@
//export * from '@/common/performance-monitor';
import { NCoreInitShell } from './base';
NCoreInitShell();