mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-06 13:05:09 +00:00
feat: support msg_seq parameter in reply message construction (#1529)
* feat: support msg_seq parameter in reply message construction - Add optional 'seq' parameter to OB11MessageReply for using msg_seq - Prioritize seq over id for querying reply messages - Maintain backward compatibility with existing id parameter - Update type definitions across backend and frontend - Update validation schemas for message nodes close #1523 * Update debug button label in NetworkDisplayCard Changed the button label from '关闭调试'/'开启调试' to '默认'/'调试' based on the debug state for improved clarity. --------- Co-authored-by: 手瓜一十雪 <nanaeonn@outlook.com>
This commit is contained in:
@@ -587,15 +587,33 @@ export class OneBotMsgApi {
|
||||
return at(atQQ, uid, NTMsgAtType.ATTYPEONE, info.nick || '');
|
||||
},
|
||||
|
||||
[OB11MessageDataType.reply]: async ({ data: { id } }) => {
|
||||
const replyMsgM = MessageUnique.getMsgIdAndPeerByShortId(parseInt(id));
|
||||
if (!replyMsgM) {
|
||||
this.core.context.logger.logWarn('回复消息不存在', id);
|
||||
[OB11MessageDataType.reply]: async ({ data: { id, seq } }, context) => {
|
||||
let replyMsg: RawMessage | undefined;
|
||||
let replyMsgPeer: Peer | undefined;
|
||||
|
||||
// 优先使用 seq
|
||||
if (seq) {
|
||||
const msgList = (await this.core.apis.MsgApi.getMsgsBySeqAndCount(
|
||||
context.peer, seq.toString(), 1, true, true
|
||||
)).msgList;
|
||||
replyMsg = msgList[0];
|
||||
replyMsgPeer = context.peer;
|
||||
} else if (id) {
|
||||
// 降级使用 id
|
||||
const replyMsgM = MessageUnique.getMsgIdAndPeerByShortId(parseInt(id));
|
||||
if (!replyMsgM) {
|
||||
this.core.context.logger.logWarn('回复消息不存在', id);
|
||||
return undefined;
|
||||
}
|
||||
replyMsg = (await this.core.apis.MsgApi.getMsgsByMsgId(
|
||||
replyMsgM.Peer, [replyMsgM.MsgId])).msgList[0];
|
||||
replyMsgPeer = replyMsgM.Peer;
|
||||
} else {
|
||||
this.core.context.logger.logWarn('回复消息缺少id或seq参数');
|
||||
return undefined;
|
||||
}
|
||||
const replyMsg = (await this.core.apis.MsgApi.getMsgsByMsgId(
|
||||
replyMsgM.Peer, [replyMsgM.MsgId])).msgList[0];
|
||||
return replyMsg
|
||||
|
||||
return replyMsg && replyMsgPeer
|
||||
? {
|
||||
elementType: ElementType.REPLY,
|
||||
elementId: '',
|
||||
@@ -605,7 +623,7 @@ export class OneBotMsgApi {
|
||||
senderUin: replyMsg.senderUin,
|
||||
senderUinStr: replyMsg.senderUin,
|
||||
replyMsgClientSeq: replyMsg.clientSeq,
|
||||
_replyMsgPeer: replyMsgM.Peer,
|
||||
_replyMsgPeer: replyMsgPeer,
|
||||
},
|
||||
}
|
||||
: undefined;
|
||||
|
||||
Reference in New Issue
Block a user