mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-12-23 08:20:06 +08:00
refactor: SetMsgEmojiLike
This commit is contained in:
parent
c35d2e08cd
commit
a43cde38f1
@ -7,8 +7,8 @@ import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
|||||||
const SchemaData = {
|
const SchemaData = {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
properties: {
|
properties: {
|
||||||
message_id: { type: 'number' },
|
message_id: { type: ['string','number'] },
|
||||||
emoji_id: { type: 'string' }
|
emoji_id: { type: ['string','number'] }
|
||||||
},
|
},
|
||||||
required: ['message_id', 'emoji_id']
|
required: ['message_id', 'emoji_id']
|
||||||
} as const satisfies JSONSchema;
|
} as const satisfies JSONSchema;
|
||||||
@ -19,7 +19,7 @@ export class SetMsgEmojiLike extends BaseAction<Payload, any> {
|
|||||||
actionName = ActionName.SetMsgEmojiLike;
|
actionName = ActionName.SetMsgEmojiLike;
|
||||||
PayloadSchema = SchemaData;
|
PayloadSchema = SchemaData;
|
||||||
protected async _handle(payload: Payload) {
|
protected async _handle(payload: Payload) {
|
||||||
const msg = await dbUtil.getMsgByShortId(payload.message_id);
|
const msg = await dbUtil.getMsgByShortId(parseInt(payload.message_id.toString()));
|
||||||
if (!msg) {
|
if (!msg) {
|
||||||
throw new Error('msg not found');
|
throw new Error('msg not found');
|
||||||
}
|
}
|
||||||
@ -29,6 +29,6 @@ export class SetMsgEmojiLike extends BaseAction<Payload, any> {
|
|||||||
return await NTQQMsgApi.setEmojiLike({
|
return await NTQQMsgApi.setEmojiLike({
|
||||||
chatType: msg.chatType,
|
chatType: msg.chatType,
|
||||||
peerUid: msg.peerUid
|
peerUid: msg.peerUid
|
||||||
}, msg.msgSeq, payload.emoji_id, true);
|
}, msg.msgSeq, payload.emoji_id.toString(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user