diff --git a/src/ntqqapi/api/msg.ts b/src/ntqqapi/api/msg.ts index 9137043..3ca5551 100644 --- a/src/ntqqapi/api/msg.ts +++ b/src/ntqqapi/api/msg.ts @@ -257,7 +257,22 @@ export class NTQQMsgApi extends Service { return await invoke('nodeIKernelMsgService/setMsgRead', [{ peer }, null]) } - async getMsgEmojiLikesList(peer: Peer, msgSeq: string, emojiId: string, emojiType: string, cnt: number) { - return await invoke('nodeIKernelMsgService/getMsgEmojiLikesList', [{ peer, msgSeq, emojiId, emojiType, cnt }, null]) + async getMsgEmojiLikesList(peer: Peer, msgSeq: string, emojiId: string, emojiType: string, count: number) { + return await invoke('nodeIKernelMsgService/getMsgEmojiLikesList', [{ + peer, + msgSeq, + emojiId, + emojiType, + cnt: count + }, null]) + } + + async fetchFavEmojiList(count: number) { + return await invoke('nodeIKernelMsgService/fetchFavEmojiList', [{ + resId: '', + count, + backwardFetch: true, + forceRefresh: true + }, null]) } } diff --git a/src/onebot11/action/index.ts b/src/onebot11/action/index.ts index 9dc8e61..ef11483 100644 --- a/src/onebot11/action/index.ts +++ b/src/onebot11/action/index.ts @@ -64,6 +64,7 @@ import { SetOnlineStatus } from './llonebot/SetOnlineStatus' import { SendGroupNotice } from './go-cqhttp/SendGroupNotice' import { GetProfileLike } from './llonebot/GetProfileLike' import { FetchEmojiLike } from './llonebot/FetchEmojiLike' +import { FetchCustomFace } from './llonebot/FetchCustomFace' export function initActionMap(adapter: Adapter) { const actionHandlers = [ @@ -135,6 +136,7 @@ export function initActionMap(adapter: Adapter) { new GetGroupRootFiles(adapter), new SendGroupNotice(adapter), new FetchEmojiLike(adapter), + new FetchCustomFace(adapter), ] const actionMap = new Map>() for (const action of actionHandlers) { diff --git a/src/onebot11/action/llonebot/FetchCustomFace.ts b/src/onebot11/action/llonebot/FetchCustomFace.ts new file mode 100644 index 0000000..b28cb2f --- /dev/null +++ b/src/onebot11/action/llonebot/FetchCustomFace.ts @@ -0,0 +1,18 @@ +import { BaseAction, Schema } from '../BaseAction' +import { ActionName } from '../types' + +interface Payload { + count: number | string +} + +export class FetchCustomFace extends BaseAction { + actionName = ActionName.FetchCustomFace + payloadSchema = Schema.object({ + count: Schema.union([Number, String]).default(48) + }) + + async _handle(payload: Payload) { + const ret = await this.ctx.ntMsgApi.fetchFavEmojiList(+payload.count) + return ret.emojiInfoList.map(e => e.url) + } +} diff --git a/src/onebot11/action/types.ts b/src/onebot11/action/types.ts index fd17659..ea309b0 100644 --- a/src/onebot11/action/types.ts +++ b/src/onebot11/action/types.ts @@ -22,6 +22,7 @@ export enum ActionName { SetOnlineStatus = 'set_online_status', GetProfileLike = 'get_profile_like', FetchEmojiLike = 'fetch_emoji_like', + FetchCustomFace = 'fetch_custom_face', // onebot 11 SendLike = 'send_like', GetLoginInfo = 'get_login_info',