This commit is contained in:
idranme 2024-08-13 21:59:13 +08:00
parent 260a0be184
commit 8ed0e6c1be
No known key found for this signature in database
GPG Key ID: 926F7B5B668E495F
6 changed files with 14 additions and 26 deletions

View File

@ -16,7 +16,7 @@ export const llonebotError: LLOneBotError = {
ffmpegError: '',
httpServerError: '',
wsServerError: '',
otherError: 'LLOnebot 未能正常启动,请检查日志查看错误',
otherError: 'LLOneBot 未能正常启动,请检查日志查看错误',
}
// 群号 -> 群成员map(uid=>GroupMember)
export const groupMembers: Map<string, Map<string, GroupMember>> = new Map<string, Map<string, GroupMember>>()

View File

@ -382,7 +382,7 @@ function onLoad() {
log('llonebot pid', process.pid)
const config = getConfigUtil().getConfig()
if (!config.enableLLOB) {
llonebotError.otherError = 'LLOnebot 未启动'
llonebotError.otherError = 'LLOneBot 未启动'
log('LLOneBot 开关设置为关闭不启动LLOneBot')
return
}

View File

@ -8,6 +8,7 @@ import { CacheClassFuncAsyncExtend } from '@/common/utils/helper'
import { LimitedHashTable } from '@/common/utils/table'
export class NTQQFriendApi {
/** >=26702 应使用 getBuddyV2 */
static async getFriends(forced = false) {
const data = await callNTQQApi<{
data: {

View File

@ -52,20 +52,11 @@ export class NTQQUserApi {
'NodeIKernelProfileListener/onUserDetailInfoChanged',
1,
5000,
(profile) => {
if (profile.uid === uid) {
return true
}
return false
},
(profile) => profile.uid === uid,
'BuddyProfileStore',
[
uid
],
[uid],
UserDetailSource.KSERVER,
[
ProfileBizType.KALL
]
[ProfileBizType.KALL]
)
const RetUser: User = {
...profile.simpleInfo.coreInfo,
@ -81,7 +72,7 @@ export class NTQQUserApi {
static async getUserDetailInfo(uid: string, getLevel = false, withBizInfo = true) {
if (getBuildVersion() >= 26702) {
return this.fetchUserDetailInfo(uid)
return NTQQUserApi.fetchUserDetailInfo(uid)
}
type EventService = NodeIKernelProfileService['getUserDetailInfoWithBizInfo']
type EventListener = NodeIKernelProfileListener['onProfileDetailInfoChanged']
@ -92,12 +83,7 @@ export class NTQQUserApi {
'NodeIKernelProfileListener/onProfileDetailInfoChanged',
2,
5000,
(profile: User) => {
if (profile.uid === uid) {
return true
}
return false
},
(profile) => profile.uid === uid,
uid,
[0]
)
@ -119,7 +105,7 @@ export class NTQQUserApi {
static async getQzoneCookies() {
const uin = getSelfUin()
const requestUrl = 'https://ssl.ptlogin2.qq.com/jump?ptlang=1033&clientuin=' + uin + '&clientkey=' + (await this.getClientKey()).clientKey + '&u1=https%3A%2F%2Fuser.qzone.qq.com%2F' + uin + '%2Finfocenter&keyindex=19%27'
const requestUrl = 'https://ssl.ptlogin2.qq.com/jump?ptlang=1033&clientuin=' + uin + '&clientkey=' + (await NTQQUserApi.getClientKey()).clientKey + '&u1=https%3A%2F%2Fuser.qzone.qq.com%2F' + uin + '%2Finfocenter&keyindex=19%27'
let cookies: { [key: string]: string } = {}
try {
cookies = await RequestUtil.HttpsGetCookies(requestUrl)
@ -129,8 +115,9 @@ export class NTQQUserApi {
}
return cookies
}
static async getSkey(): Promise<string> {
const clientKeyData = await this.getClientKey()
const clientKeyData = await NTQQUserApi.getClientKey()
if (clientKeyData.result !== 0) {
throw new Error('获取clientKey失败')
}

View File

@ -246,12 +246,12 @@ let activatedGroups: string[] = []
async function updateGroups(_groups: Group[], needUpdate: boolean = true) {
for (let group of _groups) {
log('update group', group)
log('update group', group.groupCode)
if (group.privilegeFlag === 0) {
deleteGroup(group.groupCode)
continue
}
log('update group', group)
//log('update group', group)
NTQQMsgApi.activateChat({ peerUid: group.groupCode, chatType: ChatType.group }).then().catch(log)
let existGroup = groups.find((g) => g.groupCode == group.groupCode)
if (existGroup) {

View File

@ -24,7 +24,7 @@ export default class Debug extends BaseAction<Payload, any> {
log('debug call ntqq api', payload)
const ntqqApi = [NTQQMsgApi, NTQQFriendApi, NTQQGroupApi, NTQQUserApi, NTQQFileApi, NTQQFileCacheApi, NTQQWindowApi]
for (const ntqqApiClass of ntqqApi) {
log('ntqqApiClass', ntqqApiClass)
//log('ntqqApiClass', ntqqApiClass)
const method = ntqqApiClass[payload.method]
if (method) {
const result = method(...payload.args)