feat: 适配41697

This commit is contained in:
手瓜一十雪 2025-10-31 14:42:46 +08:00
parent db16db911b
commit 36fdaac406
3 changed files with 42 additions and 12 deletions

View File

@ -139,10 +139,20 @@ export interface NodeQQNTWrapperUtil {
isNull(): unknown; isNull(): unknown;
} }
export interface NodeIQQNTStartupSessionWrapper {
create(): NodeIQQNTStartupSessionWrapper;
stop(): void;
start(): void;
createWithModuleList(uk: unknown): unknown;
getSessionIdList(): unknown;
}
export interface NodeIQQNTWrapperSession { export interface NodeIQQNTWrapperSession {
getNTWrapperSession(str: string): NodeIQQNTWrapperSession;
get(): NodeIQQNTWrapperSession;
new(): NodeIQQNTWrapperSession; new(): NodeIQQNTWrapperSession;
create(): NodeIQQNTWrapperSession; create(): NodeIQQNTWrapperSession;
init( init(
@ -271,6 +281,7 @@ export interface WrapperNodeApi {
NodeIO3MiscService: NodeIO3MiscService; NodeIO3MiscService: NodeIO3MiscService;
NodeQQNTWrapperUtil: NodeQQNTWrapperUtil; NodeQQNTWrapperUtil: NodeQQNTWrapperUtil;
NodeIQQNTWrapperSession: NodeIQQNTWrapperSession; NodeIQQNTWrapperSession: NodeIQQNTWrapperSession;
NodeIQQNTStartupSessionWrapper: NodeIQQNTStartupSessionWrapper
NodeIQQNTWrapperEngine: NodeIQQNTWrapperEngine; NodeIQQNTWrapperEngine: NodeIQQNTWrapperEngine;
NodeIKernelLoginService: NodeIKernelLoginService; NodeIKernelLoginService: NodeIKernelLoginService;

View File

@ -126,7 +126,11 @@ export class OneBotGroupApi {
} }
return undefined; return undefined;
} }
async registerParseGroupReactEvent() {
this.obContext.core.context.packetHandler.onCmd('trpc.msg.olpush.OlPushService.MsgPush', async (packet) => {
console.log(packet.seq, packet.hex_data);
});
}
async parsePaiYiPai(msg: RawMessage, jsonStr: string) { async parsePaiYiPai(msg: RawMessage, jsonStr: string) {
const json = JSON.parse(jsonStr); const json = JSON.parse(jsonStr);
//判断业务类型 //判断业务类型

View File

@ -10,6 +10,7 @@ import {
loadQQWrapper, loadQQWrapper,
NapCatCore, NapCatCore,
NapCatCoreWorkingEnv, NapCatCoreWorkingEnv,
NodeIQQNTStartupSessionWrapper,
NodeIQQNTWrapperEngine, NodeIQQNTWrapperEngine,
NodeIQQNTWrapperSession, NodeIQQNTWrapperSession,
PlatformType, PlatformType,
@ -242,7 +243,8 @@ async function handleLoginInner(context: { isLogined: boolean }, logger: LogWrap
async function initializeSession( async function initializeSession(
session: NodeIQQNTWrapperSession, session: NodeIQQNTWrapperSession,
sessionConfig: WrapperSessionInitConfig sessionConfig: WrapperSessionInitConfig,
startupSession: NodeIQQNTStartupSessionWrapper | null
) { ) {
return new Promise<void>((resolve, reject) => { return new Promise<void>((resolve, reject) => {
const sessionListener = new NodeIKernelSessionListener(); const sessionListener = new NodeIKernelSessionListener();
@ -259,13 +261,17 @@ async function initializeSession(
new NodeIDispatcherAdapter(), new NodeIDispatcherAdapter(),
sessionListener, sessionListener,
); );
try { if (startupSession) {
session.startNT(0); startupSession.start();
} catch { } else {
try { try {
session.startNT(); session.startNT(0);
} catch (e: unknown) { } catch {
reject(new Error('init failed ' + (e as Error).message)); try {
session.startNT();
} catch (e: unknown) {
reject(new Error('init failed ' + (e as Error).message));
}
} }
} }
}); });
@ -335,8 +341,17 @@ export async function NCoreInitShell() {
const engine = wrapper.NodeIQQNTWrapperEngine.get(); const engine = wrapper.NodeIQQNTWrapperEngine.get();
const loginService = wrapper.NodeIKernelLoginService.get(); const loginService = wrapper.NodeIKernelLoginService.get();
const session = new wrapper.NodeIQQNTWrapperSession(); let session: NodeIQQNTWrapperSession;
let startupSession: NodeIQQNTStartupSessionWrapper | null = null;
try {
//session = new wrapper.NodeIQQNTWrapperSession();
startupSession = wrapper.NodeIQQNTStartupSessionWrapper.create();
// data.start();
session = wrapper.NodeIQQNTWrapperSession.getNTWrapperSession('nt_1');
} catch (e: unknown) {
session = wrapper.NodeIQQNTWrapperSession.create();
console.log('Error creating session:', e);
}
const [dataPath, dataPathGlobal] = getDataPaths(wrapper); const [dataPath, dataPathGlobal] = getDataPaths(wrapper);
const systemPlatform = getPlatformType(); const systemPlatform = getPlatformType();
@ -370,7 +385,7 @@ export async function NCoreInitShell() {
dataPath, dataPath,
); );
await initializeSession(session, sessionConfig); await initializeSession(session, sessionConfig, startupSession);
const accountDataPath = path.resolve(dataPath, './NapCat/data'); const accountDataPath = path.resolve(dataPath, './NapCat/data');
//判断dataPath是否为根目录 或者 D:/ 之类的盘目录 //判断dataPath是否为根目录 或者 D:/ 之类的盘目录