mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
fix
This commit is contained in:
parent
260a0be184
commit
8ed0e6c1be
@ -16,7 +16,7 @@ export const llonebotError: LLOneBotError = {
|
|||||||
ffmpegError: '',
|
ffmpegError: '',
|
||||||
httpServerError: '',
|
httpServerError: '',
|
||||||
wsServerError: '',
|
wsServerError: '',
|
||||||
otherError: 'LLOnebot 未能正常启动,请检查日志查看错误',
|
otherError: 'LLOneBot 未能正常启动,请检查日志查看错误',
|
||||||
}
|
}
|
||||||
// 群号 -> 群成员map(uid=>GroupMember)
|
// 群号 -> 群成员map(uid=>GroupMember)
|
||||||
export const groupMembers: Map<string, Map<string, GroupMember>> = new Map<string, Map<string, GroupMember>>()
|
export const groupMembers: Map<string, Map<string, GroupMember>> = new Map<string, Map<string, GroupMember>>()
|
||||||
|
@ -382,7 +382,7 @@ function onLoad() {
|
|||||||
log('llonebot pid', process.pid)
|
log('llonebot pid', process.pid)
|
||||||
const config = getConfigUtil().getConfig()
|
const config = getConfigUtil().getConfig()
|
||||||
if (!config.enableLLOB) {
|
if (!config.enableLLOB) {
|
||||||
llonebotError.otherError = 'LLOnebot 未启动'
|
llonebotError.otherError = 'LLOneBot 未启动'
|
||||||
log('LLOneBot 开关设置为关闭,不启动LLOneBot')
|
log('LLOneBot 开关设置为关闭,不启动LLOneBot')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ import { CacheClassFuncAsyncExtend } from '@/common/utils/helper'
|
|||||||
import { LimitedHashTable } from '@/common/utils/table'
|
import { LimitedHashTable } from '@/common/utils/table'
|
||||||
|
|
||||||
export class NTQQFriendApi {
|
export class NTQQFriendApi {
|
||||||
|
/** >=26702 应使用 getBuddyV2 */
|
||||||
static async getFriends(forced = false) {
|
static async getFriends(forced = false) {
|
||||||
const data = await callNTQQApi<{
|
const data = await callNTQQApi<{
|
||||||
data: {
|
data: {
|
||||||
|
@ -52,20 +52,11 @@ export class NTQQUserApi {
|
|||||||
'NodeIKernelProfileListener/onUserDetailInfoChanged',
|
'NodeIKernelProfileListener/onUserDetailInfoChanged',
|
||||||
1,
|
1,
|
||||||
5000,
|
5000,
|
||||||
(profile) => {
|
(profile) => profile.uid === uid,
|
||||||
if (profile.uid === uid) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
},
|
|
||||||
'BuddyProfileStore',
|
'BuddyProfileStore',
|
||||||
[
|
[uid],
|
||||||
uid
|
|
||||||
],
|
|
||||||
UserDetailSource.KSERVER,
|
UserDetailSource.KSERVER,
|
||||||
[
|
[ProfileBizType.KALL]
|
||||||
ProfileBizType.KALL
|
|
||||||
]
|
|
||||||
)
|
)
|
||||||
const RetUser: User = {
|
const RetUser: User = {
|
||||||
...profile.simpleInfo.coreInfo,
|
...profile.simpleInfo.coreInfo,
|
||||||
@ -81,7 +72,7 @@ export class NTQQUserApi {
|
|||||||
|
|
||||||
static async getUserDetailInfo(uid: string, getLevel = false, withBizInfo = true) {
|
static async getUserDetailInfo(uid: string, getLevel = false, withBizInfo = true) {
|
||||||
if (getBuildVersion() >= 26702) {
|
if (getBuildVersion() >= 26702) {
|
||||||
return this.fetchUserDetailInfo(uid)
|
return NTQQUserApi.fetchUserDetailInfo(uid)
|
||||||
}
|
}
|
||||||
type EventService = NodeIKernelProfileService['getUserDetailInfoWithBizInfo']
|
type EventService = NodeIKernelProfileService['getUserDetailInfoWithBizInfo']
|
||||||
type EventListener = NodeIKernelProfileListener['onProfileDetailInfoChanged']
|
type EventListener = NodeIKernelProfileListener['onProfileDetailInfoChanged']
|
||||||
@ -92,12 +83,7 @@ export class NTQQUserApi {
|
|||||||
'NodeIKernelProfileListener/onProfileDetailInfoChanged',
|
'NodeIKernelProfileListener/onProfileDetailInfoChanged',
|
||||||
2,
|
2,
|
||||||
5000,
|
5000,
|
||||||
(profile: User) => {
|
(profile) => profile.uid === uid,
|
||||||
if (profile.uid === uid) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
},
|
|
||||||
uid,
|
uid,
|
||||||
[0]
|
[0]
|
||||||
)
|
)
|
||||||
@ -119,7 +105,7 @@ export class NTQQUserApi {
|
|||||||
|
|
||||||
static async getQzoneCookies() {
|
static async getQzoneCookies() {
|
||||||
const uin = getSelfUin()
|
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 } = {}
|
let cookies: { [key: string]: string } = {}
|
||||||
try {
|
try {
|
||||||
cookies = await RequestUtil.HttpsGetCookies(requestUrl)
|
cookies = await RequestUtil.HttpsGetCookies(requestUrl)
|
||||||
@ -129,8 +115,9 @@ export class NTQQUserApi {
|
|||||||
}
|
}
|
||||||
return cookies
|
return cookies
|
||||||
}
|
}
|
||||||
|
|
||||||
static async getSkey(): Promise<string> {
|
static async getSkey(): Promise<string> {
|
||||||
const clientKeyData = await this.getClientKey()
|
const clientKeyData = await NTQQUserApi.getClientKey()
|
||||||
if (clientKeyData.result !== 0) {
|
if (clientKeyData.result !== 0) {
|
||||||
throw new Error('获取clientKey失败')
|
throw new Error('获取clientKey失败')
|
||||||
}
|
}
|
||||||
|
@ -246,12 +246,12 @@ let activatedGroups: string[] = []
|
|||||||
|
|
||||||
async function updateGroups(_groups: Group[], needUpdate: boolean = true) {
|
async function updateGroups(_groups: Group[], needUpdate: boolean = true) {
|
||||||
for (let group of _groups) {
|
for (let group of _groups) {
|
||||||
log('update group', group)
|
log('update group', group.groupCode)
|
||||||
if (group.privilegeFlag === 0) {
|
if (group.privilegeFlag === 0) {
|
||||||
deleteGroup(group.groupCode)
|
deleteGroup(group.groupCode)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
log('update group', group)
|
//log('update group', group)
|
||||||
NTQQMsgApi.activateChat({ peerUid: group.groupCode, chatType: ChatType.group }).then().catch(log)
|
NTQQMsgApi.activateChat({ peerUid: group.groupCode, chatType: ChatType.group }).then().catch(log)
|
||||||
let existGroup = groups.find((g) => g.groupCode == group.groupCode)
|
let existGroup = groups.find((g) => g.groupCode == group.groupCode)
|
||||||
if (existGroup) {
|
if (existGroup) {
|
||||||
|
@ -24,7 +24,7 @@ export default class Debug extends BaseAction<Payload, any> {
|
|||||||
log('debug call ntqq api', payload)
|
log('debug call ntqq api', payload)
|
||||||
const ntqqApi = [NTQQMsgApi, NTQQFriendApi, NTQQGroupApi, NTQQUserApi, NTQQFileApi, NTQQFileCacheApi, NTQQWindowApi]
|
const ntqqApi = [NTQQMsgApi, NTQQFriendApi, NTQQGroupApi, NTQQUserApi, NTQQFileApi, NTQQFileCacheApi, NTQQWindowApi]
|
||||||
for (const ntqqApiClass of ntqqApi) {
|
for (const ntqqApiClass of ntqqApi) {
|
||||||
log('ntqqApiClass', ntqqApiClass)
|
//log('ntqqApiClass', ntqqApiClass)
|
||||||
const method = ntqqApiClass[payload.method]
|
const method = ntqqApiClass[payload.method]
|
||||||
if (method) {
|
if (method) {
|
||||||
const result = method(...payload.args)
|
const result = method(...payload.args)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user