mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-06 13:05:09 +00:00
feat: 表情回应api和上报
This commit is contained in:
27
src/onebot11/action/msg/SetMsgEmojiLike.ts
Normal file
27
src/onebot11/action/msg/SetMsgEmojiLike.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { ActionName } from '../types';
|
||||
import BaseAction from '../BaseAction';
|
||||
import { dbUtil } from '@/common/utils/db';
|
||||
import { NTQQMsgApi } from '@/core/apis';
|
||||
|
||||
interface Payload {
|
||||
message_id: number,
|
||||
emoji_id: string
|
||||
}
|
||||
|
||||
export class SetMsgEmojiLike extends BaseAction<Payload, any> {
|
||||
actionName = ActionName.SetMsgEmojiLike;
|
||||
|
||||
protected async _handle(payload: Payload) {
|
||||
const msg = await dbUtil.getMsgByShortId(payload.message_id);
|
||||
if (!msg) {
|
||||
throw new Error('msg not found');
|
||||
}
|
||||
if (!payload.emoji_id){
|
||||
throw new Error('emojiId not found');
|
||||
}
|
||||
return await NTQQMsgApi.setEmojiLike({
|
||||
chatType: msg.chatType,
|
||||
peerUid: msg.peerUid
|
||||
}, msg.msgSeq, payload.emoji_id, true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user