mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
sync
This commit is contained in:
parent
107f02f21f
commit
4678253815
@ -16,4 +16,3 @@ if (!fs.existsSync(TEMP_DIR)) {
|
||||
export { getVideoInfo } from './video'
|
||||
export { checkFfmpeg } from './video'
|
||||
export { encodeSilk } from './audio'
|
||||
export { isQQ998 } from './QQBasicInfo'
|
@ -5,7 +5,7 @@ import { selfInfo } from '../../common/data'
|
||||
import { ReceiveCmdS, registerReceiveHook } from '../hook'
|
||||
import { log } from '../../common/utils/log'
|
||||
import { sleep } from '../../common/utils/helper'
|
||||
import { isQQ998, getBuildVersion } from '../../common/utils'
|
||||
import { getBuildVersion } from '../../common/utils'
|
||||
import { getSession } from '@/ntqqapi/wrapper'
|
||||
import { NTEventDispatch } from '@/common/utils/EventTask'
|
||||
|
||||
@ -72,25 +72,6 @@ export class NTQQMsgApi {
|
||||
return session?.getMsgService().getTempChatInfo(chatType, peerUid)!
|
||||
}
|
||||
|
||||
static enterOrExitAIO(peer: Peer, enter: boolean) {
|
||||
return callNTQQApi<GeneralCallResult>({
|
||||
methodName: NTQQApiMethod.ENTER_OR_EXIT_AIO,
|
||||
args: [
|
||||
{
|
||||
"info_list": [
|
||||
{
|
||||
peer,
|
||||
"option": enter ? 1 : 2
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"send": true
|
||||
},
|
||||
],
|
||||
})
|
||||
}
|
||||
|
||||
static async setEmojiLike(peer: Peer, msgSeq: string, emojiId: string, set: boolean = true) {
|
||||
// nt_qq//global//nt_data//Emoji//emoji-resource//sysface_res/apng/ 下可以看到所有QQ表情预览
|
||||
// nt_qq\global\nt_data\Emoji\emoji-resource\face_config.json 里面有所有表情的id, 自带表情id是QSid, 标准emoji表情id是QCid
|
||||
@ -158,20 +139,18 @@ export class NTQQMsgApi {
|
||||
})
|
||||
}
|
||||
|
||||
static async getMsgHistory(peer: Peer, msgId: string, count: number) {
|
||||
static async getMsgsByMsgId(peer: Peer | undefined, msgIds: string[] | undefined) {
|
||||
if (!peer) throw new Error('peer is not allowed')
|
||||
if (!msgIds) throw new Error('msgIds is not allowed')
|
||||
const session = getSession()
|
||||
//Mlikiowa: 参数不合规会导致NC异常崩溃 原因是TX未对进入参数判断 对应Android标记@NotNull AndroidJADX分析可得
|
||||
return await session?.getMsgService().getMsgsByMsgId(peer, msgIds)!
|
||||
}
|
||||
|
||||
static async getMsgHistory(peer: Peer, msgId: string, count: number, isReverseOrder: boolean = false) {
|
||||
const session = getSession()
|
||||
// 消息时间从旧到新
|
||||
return await callNTQQApi<GeneralCallResult & { msgList: RawMessage[] }>({
|
||||
methodName: isQQ998 ? NTQQApiMethod.ACTIVE_CHAT_HISTORY : NTQQApiMethod.HISTORY_MSG,
|
||||
args: [
|
||||
{
|
||||
peer,
|
||||
msgId,
|
||||
cnt: count,
|
||||
queryOrder: true,
|
||||
},
|
||||
null,
|
||||
],
|
||||
})
|
||||
return session?.getMsgService().getMsgsIncludeSelf(peer, msgId, count, isReverseOrder)!
|
||||
}
|
||||
|
||||
static async fetchRecentContact() {
|
||||
@ -196,16 +175,11 @@ export class NTQQMsgApi {
|
||||
}
|
||||
|
||||
static async recallMsg(peer: Peer, msgIds: string[]) {
|
||||
return await callNTQQApi({
|
||||
methodName: NTQQApiMethod.RECALL_MSG,
|
||||
args: [
|
||||
{
|
||||
peer,
|
||||
msgIds,
|
||||
},
|
||||
null,
|
||||
],
|
||||
})
|
||||
const session = getSession()
|
||||
return await session?.getMsgService().recallMsg({
|
||||
chatType: peer.chatType,
|
||||
peerUid: peer.peerUid
|
||||
}, msgIds)
|
||||
}
|
||||
|
||||
static async sendMsg(peer: Peer, msgElements: SendMessageElement[], waitComplete = true, timeout = 10000) {
|
||||
|
@ -2,7 +2,7 @@ import { callNTQQApi, GeneralCallResult, NTQQApiClass, NTQQApiMethod } from '../
|
||||
import { SelfInfo, User, UserDetailInfoByUin, UserDetailInfoByUinV2 } from '../types'
|
||||
import { ReceiveCmdS } from '../hook'
|
||||
import { selfInfo, friends, groupMembers } from '@/common/data'
|
||||
import { CacheClassFuncAsync, isQQ998, log, sleep, getBuildVersion } from '@/common/utils'
|
||||
import { CacheClassFuncAsync, log, getBuildVersion } from '@/common/utils'
|
||||
import { getSession } from '@/ntqqapi/wrapper'
|
||||
import { RequestUtil } from '@/common/utils/request'
|
||||
import { NodeIKernelProfileService, UserDetailSource, ProfileBizType } from '../services'
|
||||
@ -85,39 +85,25 @@ export class NTQQUserApi {
|
||||
if (getBuildVersion() >= 26702) {
|
||||
return this.fetchUserDetailInfo(uid)
|
||||
}
|
||||
// this.getUserInfo(uid)
|
||||
let methodName = !isQQ998 ? NTQQApiMethod.USER_DETAIL_INFO : NTQQApiMethod.USER_DETAIL_INFO_WITH_BIZ_INFO
|
||||
if (!withBizInfo) {
|
||||
methodName = NTQQApiMethod.USER_DETAIL_INFO
|
||||
type EventService = NodeIKernelProfileService['getUserDetailInfoWithBizInfo']
|
||||
type EventListener = NodeIKernelProfileListener['onProfileDetailInfoChanged']
|
||||
const [_retData, profile] = await NTEventDispatch.CallNormalEvent
|
||||
<EventService, EventListener>
|
||||
(
|
||||
'NodeIKernelProfileService/getUserDetailInfoWithBizInfo',
|
||||
'NodeIKernelProfileListener/onProfileDetailInfoChanged',
|
||||
2,
|
||||
5000,
|
||||
(profile: User) => {
|
||||
if (profile.uid === uid) {
|
||||
return true
|
||||
}
|
||||
const fetchInfo = async () => {
|
||||
const result = await callNTQQApi<{ info: User }>({
|
||||
methodName,
|
||||
cbCmd: ReceiveCmdS.USER_DETAIL_INFO,
|
||||
afterFirstCmd: false,
|
||||
cmdCB: (payload) => {
|
||||
const success = payload.info.uid == uid
|
||||
// log("get user detail info", success, uid, payload)
|
||||
return success
|
||||
return false
|
||||
},
|
||||
args: [
|
||||
{
|
||||
uid,
|
||||
},
|
||||
null,
|
||||
],
|
||||
})
|
||||
const info = result.info
|
||||
return info
|
||||
}
|
||||
// 首次请求两次才能拿到的等级信息
|
||||
if (!userInfoCache[uid] && getLevel) {
|
||||
await fetchInfo()
|
||||
await sleep(1000)
|
||||
}
|
||||
const userInfo = await fetchInfo()
|
||||
userInfoCache[uid] = userInfo
|
||||
return userInfo
|
||||
[0]
|
||||
)
|
||||
return profile
|
||||
}
|
||||
|
||||
// return 'p_uin=o0xxx; p_skey=orXDssiGF8axxxxxxxxxxxxxx_; skey='
|
||||
|
Loading…
x
Reference in New Issue
Block a user