mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-12-24 17:10:08 +08:00
fix: error
This commit is contained in:
parent
8133ff08a7
commit
857ed0f343
@ -50,7 +50,6 @@ import {
|
|||||||
import { OB11Message } from './types';
|
import { OB11Message } from './types';
|
||||||
import { IOB11NetworkAdapter } from '@/onebot/network/adapter';
|
import { IOB11NetworkAdapter } from '@/onebot/network/adapter';
|
||||||
import { OB11HttpSSEServerAdapter } from './network/http-server-sse';
|
import { OB11HttpSSEServerAdapter } from './network/http-server-sse';
|
||||||
import { OB11PluginAdapter } from './network/plugin';
|
|
||||||
|
|
||||||
//OneBot实现类
|
//OneBot实现类
|
||||||
export class NapCatOneBot11Adapter {
|
export class NapCatOneBot11Adapter {
|
||||||
@ -114,9 +113,9 @@ export class NapCatOneBot11Adapter {
|
|||||||
//创建NetWork服务
|
//创建NetWork服务
|
||||||
|
|
||||||
// 注册Plugin 如果需要基于NapCat进行快速开发
|
// 注册Plugin 如果需要基于NapCat进行快速开发
|
||||||
this.networkManager.registerAdapter(
|
// this.networkManager.registerAdapter(
|
||||||
new OB11PluginAdapter('myPlugin', this.core, this,this.actions)
|
// new OB11PluginAdapter('myPlugin', this.core, this,this.actions)
|
||||||
);
|
// );
|
||||||
for (const key of ob11Config.network.httpServers) {
|
for (const key of ob11Config.network.httpServers) {
|
||||||
if (key.enable) {
|
if (key.enable) {
|
||||||
this.networkManager.registerAdapter(
|
this.networkManager.registerAdapter(
|
||||||
@ -170,7 +169,7 @@ export class NapCatOneBot11Adapter {
|
|||||||
this.initBuddyListener();
|
this.initBuddyListener();
|
||||||
this.initGroupListener();
|
this.initGroupListener();
|
||||||
|
|
||||||
WebUiDataRuntime.setQQVersion(this.core.context.basicInfoWrapper.getFullQQVersion());
|
WebUiDataRuntime.setQQVersion(this.core.context.basicInfoWrapper.getFullQQVesion());
|
||||||
WebUiDataRuntime.setQQLoginInfo(selfInfo);
|
WebUiDataRuntime.setQQLoginInfo(selfInfo);
|
||||||
WebUiDataRuntime.setQQLoginStatus(true);
|
WebUiDataRuntime.setQQLoginStatus(true);
|
||||||
WebUiDataRuntime.setOnOB11ConfigChanged(async (newConfig) => {
|
WebUiDataRuntime.setOnOB11ConfigChanged(async (newConfig) => {
|
||||||
|
|||||||
@ -1,17 +1,11 @@
|
|||||||
import { NapCatOneBot11Adapter, OB11Message } from '@/onebot';
|
import { NapCatOneBot11Adapter, OB11Message } from '@/onebot';
|
||||||
import { ChatType, NapCatCore } from '@/core';
|
import { NapCatCore } from '@/core';
|
||||||
import { ActionMap } from '@/onebot/action';
|
import { ActionMap } from '@/onebot/action';
|
||||||
import { OB11PluginAdapter } from '@/onebot/network/plugin';
|
import { OB11PluginAdapter } from '@/onebot/network/plugin';
|
||||||
|
|
||||||
export const plugin_onmessage = async (adapter: string, _core: NapCatCore, _obCtx: NapCatOneBot11Adapter, message: OB11Message, action: ActionMap, instance: OB11PluginAdapter) => {
|
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());
|
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);
|
||||||
const msgs = (await _core.apis.MsgApi.queryFirstMsgBySender({
|
console.log(ret);
|
||||||
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)
|
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|||||||
@ -1,4 +1,2 @@
|
|||||||
//export * from '@/common/performance-monitor';
|
|
||||||
import { NCoreInitShell } from './base';
|
import { NCoreInitShell } from './base';
|
||||||
|
|
||||||
NCoreInitShell();
|
NCoreInitShell();
|
||||||
Loading…
Reference in New Issue
Block a user