fix(api): remove group in groupMap after quit

This commit is contained in:
Il Harper 2024-10-05 12:33:06 +08:00
parent bc238645b4
commit e5b907d155
No known key found for this signature in database
GPG Key ID: 4B71FCA698E7E8EC
2 changed files with 9 additions and 3 deletions

View File

@ -205,7 +205,7 @@ const responseDispatcher = async (
case 'onGroupListUpdate': case 'onGroupListUpdate':
case 'nodeIKernelGroupListener/onGroupListUpdate': { case 'nodeIKernelGroupListener/onGroupListUpdate': {
const { groupList } = payload as OnGroupListUpdate const { groupList, updateType } = payload as OnGroupListUpdate
for (const group of groupList) { for (const group of groupList) {
ctx.chronocatEngineChronocatApi.msgBoxActiv.activate({ ctx.chronocatEngineChronocatApi.msgBoxActiv.activate({
@ -214,7 +214,9 @@ const responseDispatcher = async (
guildId: '', guildId: '',
}) })
groupMap[group.groupCode] = group if (updateType === 1) groupMap[group.groupCode] = group
else if (updateType === 3)
if (groupMap[group.groupCode]) delete groupMap[group.groupCode]
} }
chronoEventEmitter.emitGroupListUpdate() chronoEventEmitter.emitGroupListUpdate()

View File

@ -104,7 +104,11 @@ export interface OnEmojiDownloadComplete {
} }
export interface OnGroupListUpdate { export interface OnGroupListUpdate {
updateType: 1 /**
* 1 3 退
*/
updateType: 1 | 3
groupList: Group[] groupList: Group[]
} }