26 包 monorepo(TS 全源码): - snowcat-core: NT 内核 API 封装 + listener(含 9.9.37 六回调适配)+ Packet 发包 - snowcat-onebot: OneBot v11 全动作 + MCP Streamable HTTP 适配器 + 稳定线 - snowcat-webui-frontend/backend: 雪猫控制台(React+HeroUI) - snowcat-shell: 单文件 bundle 出口(vite inlineDynamicImports) - snowcat-native: napi2native / MoeHoo / ffmpeg / pty 运行时 - 56 项 SnowLuma 独门动作移植(qzone 全家桶/群相册/装扮/闪照/收藏) - 工具件: 解包器/启动器/便携制作器/doctor GitHub 关联已全量指向 DandanLLab/SnowCatQQ
72 lines
2.7 KiB
TypeScript
72 lines
2.7 KiB
TypeScript
import { Type, Static } from '@sinclair/typebox';
|
|
import { OneBotAction } from '@/snowcat-onebot/action/OneBotAction';
|
|
import { ActionName } from '@/snowcat-onebot/action/router';
|
|
import { MessageUnique } from 'snowcat-common/src/message-unique';
|
|
|
|
const PayloadSchema = Type.Object({
|
|
message_id: Type.Union([Type.Number(), Type.String()], { description: '消息ID' }),
|
|
emojiId: Type.Union([Type.Number(), Type.String()], { description: '表情ID' }),
|
|
emojiType: Type.Union([Type.Number(), Type.String()], { description: '表情类型' }),
|
|
count: Type.Union([Type.Number(), Type.String()], { default: 20, description: '获取数量' }),
|
|
cookie: Type.String({ default: '', description: '分页Cookie' }),
|
|
});
|
|
|
|
type PayloadType = Static<typeof PayloadSchema>;
|
|
|
|
const ReturnSchema = Type.Object({
|
|
emojiLikesList: Type.Array(Type.Object({
|
|
tinyId: Type.String({ description: 'TinyID' }),
|
|
nickName: Type.String({ description: '昵称' }),
|
|
headUrl: Type.String({ description: '头像URL' }),
|
|
}), { description: '表情回应列表' }),
|
|
cookie: Type.String({ description: '分页Cookie' }),
|
|
isLastPage: Type.Boolean({ description: '是否最后一页' }),
|
|
isFirstPage: Type.Boolean({ description: '是否第一页' }),
|
|
result: Type.Number({ description: '结果状态码' }),
|
|
errMsg: Type.String({ description: '错 误信息' }),
|
|
}, { description: '表情回应详情' });
|
|
|
|
type ReturnType = Static<typeof ReturnSchema>;
|
|
|
|
export class FetchEmojiLike extends OneBotAction<PayloadType, ReturnType> {
|
|
override actionName = ActionName.FetchEmojiLike;
|
|
override actionSummary = '获取表情点赞详情';
|
|
override actionTags = ['消息扩展'];
|
|
override payloadExample = {
|
|
message_id: 12345,
|
|
emojiId: '123',
|
|
emojiType: 1,
|
|
count: 10,
|
|
cookie: '',
|
|
};
|
|
|
|
override returnExample = {
|
|
emojiLikesList: [
|
|
{
|
|
tinyId: '123456',
|
|
nickName: '测试用户',
|
|
headUrl: 'http://example.com/avatar.png',
|
|
},
|
|
],
|
|
cookie: '',
|
|
isLastPage: true,
|
|
isFirstPage: true,
|
|
result: 0,
|
|
errMsg: '',
|
|
};
|
|
|
|
override payloadSchema = PayloadSchema;
|
|
override returnSchema = ReturnSchema;
|
|
|
|
async _handle (payload: PayloadType): Promise<ReturnType> {
|
|
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('消息不存在');
|
|
const res = await this.core.apis.MsgApi.getMsgEmojiLikesList(
|
|
msgIdPeer.Peer, msg.msgSeq, payload.emojiId.toString(), payload.emojiType.toString(), payload.cookie, +payload.count
|
|
);
|
|
return res;
|
|
}
|
|
}
|