feat: fetch_custom_face API

This commit is contained in:
idranme 2024-09-18 16:11:08 +08:00
parent 1160cd4b26
commit f39a9aeafb
No known key found for this signature in database
GPG Key ID: 926F7B5B668E495F
4 changed files with 38 additions and 2 deletions

View File

@ -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])
}
}

View File

@ -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<string, BaseAction<any, unknown>>()
for (const action of actionHandlers) {

View File

@ -0,0 +1,18 @@
import { BaseAction, Schema } from '../BaseAction'
import { ActionName } from '../types'
interface Payload {
count: number | string
}
export class FetchCustomFace extends BaseAction<Payload, string[]> {
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)
}
}

View File

@ -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',