refactor: SetMsgEmojiLike
This commit is contained in:
1 parent
31dfb327aa
commit
3a1e451134
1 file changed
+4
-4
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user