From 6748cf70c4018f76c197bd1d4b244b9465465175 Mon Sep 17 00:00:00 2001 From: Il Harper Date: Tue, 9 Jul 2024 00:47:41 +0800 Subject: [PATCH] fix(api): fix chrononeko/bugtracker#72 --- packages/engine-chronocat-api/src/handler.ts | 28 +++++++++++++------- packages/red/src/redEntity.ts | 1 + 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/packages/engine-chronocat-api/src/handler.ts b/packages/engine-chronocat-api/src/handler.ts index 5ba4a99..0b699ee 100644 --- a/packages/engine-chronocat-api/src/handler.ts +++ b/packages/engine-chronocat-api/src/handler.ts @@ -192,7 +192,15 @@ const responseDispatcher = async ( case 'nodeIKernelGroupListener/onGroupListUpdate': { const { groupList } = payload as OnGroupListUpdate - for (const group of groupList) groupMap[group.groupCode] = group + for (const group of groupList) { + ctx.chronocatEngineChronocatApi.msgBoxActiv.activate({ + chatType: ChatType.Group, + peerUid: group.groupCode, + guildId: '', + }) + + groupMap[group.groupCode] = group + } chronoEventEmitter.emitGroupListUpdate() @@ -277,15 +285,17 @@ const responseDispatcher = async ( const { listType, changedList } = changedRecentContactList switch (listType) { - // case ContactListType.Normal: { - // for (const contact of changedList) - // if (contact.chatType === ChatType.MsgBox) - // ctx.chronocatEngineChronocatApi.msgBoxActiv.activate( - // contact.peerUid, - // ) + case ContactListType.Normal: { + for (const contact of changedList) + if (contact.chatType === ChatType.MsgBox) + ctx.chronocatEngineChronocatApi.msgBoxActiv.activate({ + chatType: contact.chatType, + peerUid: contact.peerUid, + guildId: '', + }) - // break - // } + break + } case ContactListType.MsgBox: { for (const contact of changedList) diff --git a/packages/red/src/redEntity.ts b/packages/red/src/redEntity.ts index b1ee219..943e5b9 100644 --- a/packages/red/src/redEntity.ts +++ b/packages/red/src/redEntity.ts @@ -1005,4 +1005,5 @@ export interface ContactList { export enum ContactListType { Normal = 1, MsgBox = 2, + Value14 = 14, }