mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
feat: GetProfileLike
This commit is contained in:
parent
3de054600c
commit
9738c3f63c
@ -296,4 +296,19 @@ export class NTQQUserApi extends Service {
|
|||||||
}
|
}
|
||||||
}, null])
|
}, null])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getProfileLike(uid: string) {
|
||||||
|
return await invoke('nodeIKernelProfileLikeService/getBuddyProfileLike', [{
|
||||||
|
req: {
|
||||||
|
friendUids: [uid],
|
||||||
|
basic: 1,
|
||||||
|
vote: 1,
|
||||||
|
favorite: 0,
|
||||||
|
userProfile: 1,
|
||||||
|
type: 2,
|
||||||
|
start: 0,
|
||||||
|
limit: 20,
|
||||||
|
}
|
||||||
|
}, null])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -185,12 +185,6 @@ class Core extends Service {
|
|||||||
})
|
})
|
||||||
|
|
||||||
registerReceiveHook<{ msgRecord: RawMessage }>(ReceiveCmdS.SELF_SEND_MSG, payload => {
|
registerReceiveHook<{ msgRecord: RawMessage }>(ReceiveCmdS.SELF_SEND_MSG, payload => {
|
||||||
const { msgId, chatType, peerUid } = payload.msgRecord
|
|
||||||
const peer = {
|
|
||||||
chatType,
|
|
||||||
peerUid
|
|
||||||
}
|
|
||||||
MessageUnique.createMsg(peer, msgId)
|
|
||||||
if (!this.config.reportSelfMessage) {
|
if (!this.config.reportSelfMessage) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -82,8 +82,7 @@ export function hookNTQQApiReceive(window: BrowserWindow, onlyLog: boolean) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const ret = target.apply(thisArg, args)
|
return target.apply(thisArg, args)
|
||||||
return ret
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -143,7 +142,7 @@ export function hookNTQQApiCall(window: BrowserWindow, onlyLog: boolean) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function registerReceiveHook<PayloadType>(
|
export function registerReceiveHook<PayloadType>(
|
||||||
method: ReceiveCmdS | ReceiveCmdS[],
|
method: string | string[],
|
||||||
hookFunc: (payload: PayloadType) => void,
|
hookFunc: (payload: PayloadType) => void,
|
||||||
): string {
|
): string {
|
||||||
const id = randomUUID()
|
const id = randomUUID()
|
||||||
@ -151,7 +150,7 @@ export function registerReceiveHook<PayloadType>(
|
|||||||
method = [method]
|
method = [method]
|
||||||
}
|
}
|
||||||
receiveHooks.push({
|
receiveHooks.push({
|
||||||
method,
|
method: method as ReceiveCmdS[],
|
||||||
hookFunc,
|
hookFunc,
|
||||||
id,
|
id,
|
||||||
})
|
})
|
||||||
|
@ -136,7 +136,6 @@ export function invoke<
|
|||||||
// 这里的callback比较特殊,QQ后端先返回是否调用成功,再返回一条结果数据
|
// 这里的callback比较特殊,QQ后端先返回是否调用成功,再返回一条结果数据
|
||||||
const secondCallback = () => {
|
const secondCallback = () => {
|
||||||
const hookId = registerReceiveHook<R>(options.cbCmd!, (payload) => {
|
const hookId = registerReceiveHook<R>(options.cbCmd!, (payload) => {
|
||||||
// log(methodName, "second callback", cbCmd, payload, cmdCB);
|
|
||||||
if (options.cmdCB) {
|
if (options.cmdCB) {
|
||||||
if (options.cmdCB(payload, result)) {
|
if (options.cmdCB(payload, result)) {
|
||||||
removeReceiveHook(hookId)
|
removeReceiveHook(hookId)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { BuddyProfileLikeReq } from '../types'
|
import { BuddyProfileLikeReq } from '../types'
|
||||||
import { GeneralCallResult } from './common'
|
import { GeneralCallResult } from './common'
|
||||||
|
import { Dict } from 'cosmokit'
|
||||||
|
|
||||||
export interface NodeIKernelProfileLikeService {
|
export interface NodeIKernelProfileLikeService {
|
||||||
addKernelProfileLikeListener(listener: NodeIKernelProfileLikeService): void
|
addKernelProfileLikeListener(listener: NodeIKernelProfileLikeService): void
|
||||||
@ -10,8 +11,18 @@ export interface NodeIKernelProfileLikeService {
|
|||||||
|
|
||||||
getBuddyProfileLike(req: BuddyProfileLikeReq): Promise<GeneralCallResult & {
|
getBuddyProfileLike(req: BuddyProfileLikeReq): Promise<GeneralCallResult & {
|
||||||
info: {
|
info: {
|
||||||
userLikeInfos: Array<unknown>,
|
userLikeInfos: {
|
||||||
friendMaxVotes: number,
|
uid: string
|
||||||
|
time: string
|
||||||
|
favoriteInfo: {
|
||||||
|
total_count: number
|
||||||
|
last_time: number
|
||||||
|
today_count: number
|
||||||
|
userInfos: Dict[]
|
||||||
|
}
|
||||||
|
voteInfo: Dict
|
||||||
|
}[]
|
||||||
|
friendMaxVotes: number
|
||||||
start: number
|
start: number
|
||||||
}
|
}
|
||||||
}>
|
}>
|
||||||
|
@ -62,6 +62,7 @@ import { GetGroupAtAllRemain } from './go-cqhttp/GetGroupAtAllRemain'
|
|||||||
import { GetGroupRootFiles } from './go-cqhttp/GetGroupRootFiles'
|
import { GetGroupRootFiles } from './go-cqhttp/GetGroupRootFiles'
|
||||||
import { SetOnlineStatus } from './llonebot/SetOnlineStatus'
|
import { SetOnlineStatus } from './llonebot/SetOnlineStatus'
|
||||||
import { SendGroupNotice } from './go-cqhttp/SendGroupNotice'
|
import { SendGroupNotice } from './go-cqhttp/SendGroupNotice'
|
||||||
|
import { GetProfileLike } from './llonebot/GetProfileLike'
|
||||||
|
|
||||||
export function initActionMap(adapter: Adapter) {
|
export function initActionMap(adapter: Adapter) {
|
||||||
const actionHandlers = [
|
const actionHandlers = [
|
||||||
@ -74,6 +75,7 @@ export function initActionMap(adapter: Adapter) {
|
|||||||
new GetFriendWithCategory(adapter),
|
new GetFriendWithCategory(adapter),
|
||||||
new GetEvent(adapter),
|
new GetEvent(adapter),
|
||||||
new SetOnlineStatus(adapter),
|
new SetOnlineStatus(adapter),
|
||||||
|
new GetProfileLike(adapter),
|
||||||
// onebot11
|
// onebot11
|
||||||
new SendLike(adapter),
|
new SendLike(adapter),
|
||||||
new GetMsg(adapter),
|
new GetMsg(adapter),
|
||||||
|
17
src/onebot11/action/llonebot/GetProfileLike.ts
Normal file
17
src/onebot11/action/llonebot/GetProfileLike.ts
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import BaseAction from '../BaseAction'
|
||||||
|
import { ActionName } from '../types'
|
||||||
|
import { selfInfo } from '@/common/globalVars'
|
||||||
|
import { Dict } from 'cosmokit'
|
||||||
|
|
||||||
|
export class GetProfileLike extends BaseAction<void, Dict[]> {
|
||||||
|
actionName = ActionName.GetProfileLike
|
||||||
|
|
||||||
|
async _handle() {
|
||||||
|
const ret = await this.ctx.ntUserApi.getProfileLike(selfInfo.uid)
|
||||||
|
const listdata = ret.info.userLikeInfos[0].favoriteInfo.userInfos
|
||||||
|
for (const item of listdata) {
|
||||||
|
item.uin = Number(await this.ctx.ntUserApi.getUinByUid(item.uid)) || 0
|
||||||
|
}
|
||||||
|
return listdata
|
||||||
|
}
|
||||||
|
}
|
@ -20,6 +20,7 @@ export enum ActionName {
|
|||||||
GetFriendsWithCategory = 'get_friends_with_category',
|
GetFriendsWithCategory = 'get_friends_with_category',
|
||||||
GetEvent = 'get_event',
|
GetEvent = 'get_event',
|
||||||
SetOnlineStatus = 'set_online_status',
|
SetOnlineStatus = 'set_online_status',
|
||||||
|
GetProfileLike = 'get_profile_like',
|
||||||
// onebot 11
|
// onebot 11
|
||||||
SendLike = 'send_like',
|
SendLike = 'send_like',
|
||||||
GetLoginInfo = 'get_login_info',
|
GetLoginInfo = 'get_login_info',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user