fix: setMsg
This commit is contained in:
1 parent
a379ffd0f2
commit
55d5072f46
4 files changed
+11
-8
No files matched your search
@@ -7,8 +7,8 @@ import { MessageUnique } from '@/common/utils/MessageUnique';
|
||||
const SchemaData = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
message_id: { type: ['string','number'] },
|
||||
emoji_id: { type: ['string','number'] }
|
||||
message_id: { type: ['string', 'number'] },
|
||||
emoji_id: { type: ['string', 'number'] }
|
||||
},
|
||||
required: ['message_id', 'emoji_id']
|
||||
} as const satisfies JSONSchema;
|
||||
@@ -23,10 +23,13 @@ export class SetMsgEmojiLike extends BaseAction<Payload, any> {
|
||||
if (!msg) {
|
||||
throw new Error('msg not found');
|
||||
}
|
||||
if (!payload.emoji_id){
|
||||
if (!payload.emoji_id) {
|
||||
throw new Error('emojiId not found');
|
||||
}
|
||||
const msgSeq = (await NTQQMsgApi.getMsgsByMsgId(msg.Peer, [msg.MsgId])).msgList[0].msgSeq;
|
||||
return await NTQQMsgApi.setEmojiLike(msg.Peer, msgSeq, payload.emoji_id.toString(), true);
|
||||
const msgData = (await NTQQMsgApi.getMsgsByMsgId(msg.Peer, [msg.MsgId])).msgList;
|
||||
if (!msgData || msgData.length == 0 || !msgData[0].msgSeq) {
|
||||
throw new Error('find msg by msgid error');
|
||||
}
|
||||
return await NTQQMsgApi.setEmojiLike(msg.Peer, msgData[0].msgSeq, payload.emoji_id.toString(), true);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user