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 { getVideoInfo } from './video'
|
||||||
export { checkFfmpeg } from './video'
|
export { checkFfmpeg } from './video'
|
||||||
export { encodeSilk } from './audio'
|
export { encodeSilk } from './audio'
|
||||||
export { isQQ998 } from './QQBasicInfo'
|
|
@ -5,7 +5,7 @@ import { selfInfo } from '../../common/data'
|
|||||||
import { ReceiveCmdS, registerReceiveHook } from '../hook'
|
import { ReceiveCmdS, registerReceiveHook } from '../hook'
|
||||||
import { log } from '../../common/utils/log'
|
import { log } from '../../common/utils/log'
|
||||||
import { sleep } from '../../common/utils/helper'
|
import { sleep } from '../../common/utils/helper'
|
||||||
import { isQQ998, getBuildVersion } from '../../common/utils'
|
import { getBuildVersion } from '../../common/utils'
|
||||||
import { getSession } from '@/ntqqapi/wrapper'
|
import { getSession } from '@/ntqqapi/wrapper'
|
||||||
import { NTEventDispatch } from '@/common/utils/EventTask'
|
import { NTEventDispatch } from '@/common/utils/EventTask'
|
||||||
|
|
||||||
@ -72,25 +72,6 @@ export class NTQQMsgApi {
|
|||||||
return session?.getMsgService().getTempChatInfo(chatType, peerUid)!
|
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) {
|
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//sysface_res/apng/ 下可以看到所有QQ表情预览
|
||||||
// nt_qq\global\nt_data\Emoji\emoji-resource\face_config.json 里面有所有表情的id, 自带表情id是QSid, 标准emoji表情id是QCid
|
// 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[] }>({
|
return session?.getMsgService().getMsgsIncludeSelf(peer, msgId, count, isReverseOrder)!
|
||||||
methodName: isQQ998 ? NTQQApiMethod.ACTIVE_CHAT_HISTORY : NTQQApiMethod.HISTORY_MSG,
|
|
||||||
args: [
|
|
||||||
{
|
|
||||||
peer,
|
|
||||||
msgId,
|
|
||||||
cnt: count,
|
|
||||||
queryOrder: true,
|
|
||||||
},
|
|
||||||
null,
|
|
||||||
],
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static async fetchRecentContact() {
|
static async fetchRecentContact() {
|
||||||
@ -196,16 +175,11 @@ export class NTQQMsgApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static async recallMsg(peer: Peer, msgIds: string[]) {
|
static async recallMsg(peer: Peer, msgIds: string[]) {
|
||||||
return await callNTQQApi({
|
const session = getSession()
|
||||||
methodName: NTQQApiMethod.RECALL_MSG,
|
return await session?.getMsgService().recallMsg({
|
||||||
args: [
|
chatType: peer.chatType,
|
||||||
{
|
peerUid: peer.peerUid
|
||||||
peer,
|
}, msgIds)
|
||||||
msgIds,
|
|
||||||
},
|
|
||||||
null,
|
|
||||||
],
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static async sendMsg(peer: Peer, msgElements: SendMessageElement[], waitComplete = true, timeout = 10000) {
|
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 { SelfInfo, User, UserDetailInfoByUin, UserDetailInfoByUinV2 } from '../types'
|
||||||
import { ReceiveCmdS } from '../hook'
|
import { ReceiveCmdS } from '../hook'
|
||||||
import { selfInfo, friends, groupMembers } from '@/common/data'
|
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 { getSession } from '@/ntqqapi/wrapper'
|
||||||
import { RequestUtil } from '@/common/utils/request'
|
import { RequestUtil } from '@/common/utils/request'
|
||||||
import { NodeIKernelProfileService, UserDetailSource, ProfileBizType } from '../services'
|
import { NodeIKernelProfileService, UserDetailSource, ProfileBizType } from '../services'
|
||||||
@ -85,39 +85,25 @@ export class NTQQUserApi {
|
|||||||
if (getBuildVersion() >= 26702) {
|
if (getBuildVersion() >= 26702) {
|
||||||
return this.fetchUserDetailInfo(uid)
|
return this.fetchUserDetailInfo(uid)
|
||||||
}
|
}
|
||||||
// this.getUserInfo(uid)
|
type EventService = NodeIKernelProfileService['getUserDetailInfoWithBizInfo']
|
||||||
let methodName = !isQQ998 ? NTQQApiMethod.USER_DETAIL_INFO : NTQQApiMethod.USER_DETAIL_INFO_WITH_BIZ_INFO
|
type EventListener = NodeIKernelProfileListener['onProfileDetailInfoChanged']
|
||||||
if (!withBizInfo) {
|
const [_retData, profile] = await NTEventDispatch.CallNormalEvent
|
||||||
methodName = NTQQApiMethod.USER_DETAIL_INFO
|
<EventService, EventListener>
|
||||||
|
(
|
||||||
|
'NodeIKernelProfileService/getUserDetailInfoWithBizInfo',
|
||||||
|
'NodeIKernelProfileListener/onProfileDetailInfoChanged',
|
||||||
|
2,
|
||||||
|
5000,
|
||||||
|
(profile: User) => {
|
||||||
|
if (profile.uid === uid) {
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
const fetchInfo = async () => {
|
return false
|
||||||
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
|
|
||||||
},
|
},
|
||||||
args: [
|
|
||||||
{
|
|
||||||
uid,
|
uid,
|
||||||
},
|
[0]
|
||||||
null,
|
)
|
||||||
],
|
return profile
|
||||||
})
|
|
||||||
const info = result.info
|
|
||||||
return info
|
|
||||||
}
|
|
||||||
// 首次请求两次才能拿到的等级信息
|
|
||||||
if (!userInfoCache[uid] && getLevel) {
|
|
||||||
await fetchInfo()
|
|
||||||
await sleep(1000)
|
|
||||||
}
|
|
||||||
const userInfo = await fetchInfo()
|
|
||||||
userInfoCache[uid] = userInfo
|
|
||||||
return userInfo
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// return 'p_uin=o0xxx; p_skey=orXDssiGF8axxxxxxxxxxxxxx_; skey='
|
// return 'p_uin=o0xxx; p_skey=orXDssiGF8axxxxxxxxxxxxxx_; skey='
|
||||||
|
Loading…
x
Reference in New Issue
Block a user