mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
chore: 代码质量提高
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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" 是没有撤回
|
||||
|
@@ -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)
|
||||
|
Reference in New Issue
Block a user