mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
feat: add SetMsgEmojiLike
This commit is contained in:
parent
96b1f71437
commit
86da417c17
@ -8,6 +8,7 @@ const SchemaData = {
|
|||||||
properties: {
|
properties: {
|
||||||
message_id: { type: ['string', 'number'] },
|
message_id: { type: ['string', 'number'] },
|
||||||
emoji_id: { type: ['string', 'number'] },
|
emoji_id: { type: ['string', 'number'] },
|
||||||
|
set: { type: ['boolean', 'string'] }
|
||||||
},
|
},
|
||||||
required: ['message_id', 'emoji_id'],
|
required: ['message_id', 'emoji_id'],
|
||||||
} as const satisfies JSONSchema;
|
} as const satisfies JSONSchema;
|
||||||
@ -26,10 +27,19 @@ export class SetMsgEmojiLike extends BaseAction<Payload, any> {
|
|||||||
if (!payload.emoji_id) {
|
if (!payload.emoji_id) {
|
||||||
throw new Error('emojiId not found');
|
throw new Error('emojiId not found');
|
||||||
}
|
}
|
||||||
|
if (!payload.set) {
|
||||||
|
payload.set = true;
|
||||||
|
}
|
||||||
|
|
||||||
const msgData = (await this.core.apis.MsgApi.getMsgsByMsgId(msg.Peer, [msg.MsgId])).msgList;
|
const msgData = (await this.core.apis.MsgApi.getMsgsByMsgId(msg.Peer, [msg.MsgId])).msgList;
|
||||||
if (!msgData || msgData.length == 0 || !msgData[0].msgSeq) {
|
if (!msgData || msgData.length == 0 || !msgData[0].msgSeq) {
|
||||||
throw new Error('find msg by msgid error');
|
throw new Error('find msg by msgid error');
|
||||||
}
|
}
|
||||||
return await this.core.apis.MsgApi.setEmojiLike(msg.Peer, msgData[0].msgSeq, payload.emoji_id.toString(), true);
|
return await this.core.apis.MsgApi.setEmojiLike(
|
||||||
|
msg.Peer,
|
||||||
|
msgData[0].msgSeq,
|
||||||
|
payload.emoji_id.toString(),
|
||||||
|
typeof payload.set == 'string' ? payload.set === 'true' : !!payload
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user