From ac852cc3823a03354ebae05bfdecbddbfc375de6 Mon Sep 17 00:00:00 2001 From: linyuchen Date: Thu, 25 Apr 2024 23:25:44 +0800 Subject: [PATCH] feat: msg emoji like --- src/ntqqapi/ntcall.ts | 3 +++ src/ntqqapi/types/msg.ts | 1 + src/onebot11/action/msg/SetMsgEmojiLike.ts | 27 ++++++++++++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 src/onebot11/action/msg/SetMsgEmojiLike.ts diff --git a/src/ntqqapi/ntcall.ts b/src/ntqqapi/ntcall.ts index 336c384..ebfa8b3 100644 --- a/src/ntqqapi/ntcall.ts +++ b/src/ntqqapi/ntcall.ts @@ -43,8 +43,11 @@ export enum NTQQApiMethod { IMAGE_SIZE = "getImageSizeFromPath", FILE_SIZE = "getFileSize", MEDIA_FILE_PATH = "nodeIKernelMsgService/getRichMediaFilePathForGuild", + RECALL_MSG = "nodeIKernelMsgService/recallMsg", SEND_MSG = "nodeIKernelMsgService/sendMsg", + EMOJI_LIKE = "nodeIKernelMsgService/setMsgEmojiLikes", + DOWNLOAD_MEDIA = "nodeIKernelMsgService/downloadRichMedia", FORWARD_MSG = "nodeIKernelMsgService/forwardMsgWithComment", MULTI_FORWARD_MSG = "nodeIKernelMsgService/multiForwardMsgWithComment", // 合并转发 diff --git a/src/ntqqapi/types/msg.ts b/src/ntqqapi/types/msg.ts index 2bab26d..d36a93b 100644 --- a/src/ntqqapi/types/msg.ts +++ b/src/ntqqapi/types/msg.ts @@ -205,6 +205,7 @@ export interface GrayTipElement { aioOpGrayTipElement: TipAioOpGrayTipElement, groupElement: TipGroupElement, xmlElement: { + templId: string; content: string; }, jsonGrayTipElement: { diff --git a/src/onebot11/action/msg/SetMsgEmojiLike.ts b/src/onebot11/action/msg/SetMsgEmojiLike.ts new file mode 100644 index 0000000..31ac092 --- /dev/null +++ b/src/onebot11/action/msg/SetMsgEmojiLike.ts @@ -0,0 +1,27 @@ +import {ActionName} from "../types"; +import BaseAction from "../BaseAction"; +import {dbUtil} from "../../../common/db"; +import {NTQQMsgApi} from "../../../ntqqapi/api/msg"; + +interface Payload { + message_id: number, + emoji_id: string +} + +export class SetMsgEmojiLike extends BaseAction { + actionName = ActionName.SetMsgEmojiLike + + protected async _handle(payload: Payload) { + let 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) + } +}