mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-12-28 20:31:26 +08:00
* feat: pnpm new * Refactor build and release workflows, update dependencies Switch build scripts and workflows from npm to pnpm, update build and artifact paths, and simplify release workflow by removing version detection and changelog steps. Add new dependencies (silk-wasm, express, ws, node-pty-prebuilt-multiarch), update exports in package.json files, and add vite config for napcat-framework. Also, rename manifest.json for framework package and fix static asset copying in shell build config.
30 lines
1.3 KiB
TypeScript
30 lines
1.3 KiB
TypeScript
import { Type, Static } from '@sinclair/typebox';
|
|
import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
|
import { ActionName } from '@/napcat-onebot/action/router';
|
|
import { MessageUnique } from 'napcat-common/src/message-unique';
|
|
import { type NTQQMsgApi } from 'napcat-core/apis';
|
|
|
|
const SchemaData = Type.Object({
|
|
message_id: Type.Union([Type.Number(), Type.String()]),
|
|
emojiId: Type.Union([Type.Number(), Type.String()]),
|
|
emojiType: Type.Union([Type.Number(), Type.String()]),
|
|
count: Type.Union([Type.Number(), Type.String()], { default: 20 }),
|
|
});
|
|
|
|
type Payload = Static<typeof SchemaData>;
|
|
|
|
export class FetchEmojiLike extends OneBotAction<Payload, Awaited<ReturnType<NTQQMsgApi['getMsgEmojiLikesList']>>> {
|
|
override actionName = ActionName.FetchEmojiLike;
|
|
override payloadSchema = SchemaData;
|
|
|
|
async _handle (payload: Payload) {
|
|
const msgIdPeer = MessageUnique.getMsgIdAndPeerByShortId(+payload.message_id);
|
|
if (!msgIdPeer) throw new Error('消息不存在');
|
|
const msg = (await this.core.apis.MsgApi.getMsgsByMsgId(msgIdPeer.Peer, [msgIdPeer.MsgId])).msgList[0];
|
|
if (!msg) throw new Error('消息不存在');
|
|
return await this.core.apis.MsgApi.getMsgEmojiLikesList(
|
|
msgIdPeer.Peer, msg.msgSeq, payload.emojiId.toString(), payload.emojiType.toString(), +payload.count
|
|
);
|
|
}
|
|
}
|