diff --git a/src/core/apis/msg.ts b/src/core/apis/msg.ts index 45762821..0cb8774a 100644 --- a/src/core/apis/msg.ts +++ b/src/core/apis/msg.ts @@ -1,4 +1,4 @@ -import { ChatType, GetFileListParam, Peer, RawMessage, SendMessageElement } from '@/core/entities'; +import { ChatType, GetFileListParam, Peer, RawMessage, SendMessageElement, SendStatusType } from '@/core/entities'; import { InstanceContext, NapCatCore } from '@/core'; import { onGroupFileInfoUpdateParamType } from '@/core/listeners'; import { GeneralCallResult } from '@/core/services/common'; @@ -171,7 +171,7 @@ export class NTQQMsgApi { timeout, (msgRecords: RawMessage[]) => { for (const msgRecord of msgRecords) { - if (msgRecord.guildId === msgId && msgRecord.sendStatus === 2) { + if (msgRecord.guildId === msgId && msgRecord.sendStatus === SendStatusType.KSEND_STATUS_SUCCESS) { return true; } } diff --git a/src/core/entities/msg.ts b/src/core/entities/msg.ts index e5687ca4..01f4a050 100644 --- a/src/core/entities/msg.ts +++ b/src/core/entities/msg.ts @@ -891,6 +891,12 @@ export enum NTSubMsgType { KMSGSUBTYPEMIXTEXT = 0, KMSGSUBTYPETENCENTDOC = 6 } +export enum SendStatusType { + KSEND_STATUS_FAILED = 0, + KSEND_STATUS_SENDING = 1, + KSEND_STATUS_SUCCESS = 2, + KSEND_STATUS_SUCCESS_NOSEQ = 3 +} export interface RawMessage { parentMsgPeer: Peer; @@ -950,7 +956,7 @@ export interface RawMessage { /** * 消息状态,别人发的 2 是已撤回,自己发的 2 是已发送 */ - sendStatus?: number; + sendStatus?: SendStatusType; /** * 撤回时间,"0" 是没有撤回 diff --git a/src/onebot/index.ts b/src/onebot/index.ts index 302ff3e4..f7a90a42 100644 --- a/src/onebot/index.ts +++ b/src/onebot/index.ts @@ -8,6 +8,7 @@ import { MsgListener, NapCatCore, RawMessage, + SendStatusType, } from '@/core'; import { OB11Config, OB11ConfigLoader } from '@/onebot/helper/config'; import { OneBotApiContextType } from '@/onebot/types'; @@ -250,7 +251,7 @@ export class NapCatOneBot11Adapter { .catch(e => this.context.logger.logError('处理消息失败', e)); for (const msg of msgList.filter(e => e.senderUin == this.core.selfInfo.uin)) { - if (msg.sendStatus == 2 && !msgIdSend.get(msg.msgId)) { + if (msg.sendStatus == SendStatusType.KSEND_STATUS_SUCCESS && !msgIdSend.get(msg.msgId)) { msgIdSend.put(msg.msgId, true); // 完成后再post OB11Constructor.message(this.core, this, msg)