mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
fix
This commit is contained in:
parent
339ba409ee
commit
2f341fcf43
@ -1,5 +1,5 @@
|
|||||||
import { invoke, NTMethod } from '../ntcall'
|
import { invoke, NTMethod } from '../ntcall'
|
||||||
import { GeneralCallResult } from '../services'
|
import { GeneralCallResult, TmpChatInfoApi } from '../services'
|
||||||
import { RawMessage, SendMessageElement, Peer, ChatType2 } from '../types'
|
import { RawMessage, SendMessageElement, Peer, ChatType2 } from '../types'
|
||||||
import { getSelfNick, getSelfUid } from '../../common/data'
|
import { getSelfNick, getSelfUid } from '../../common/data'
|
||||||
import { getSession } from '@/ntqqapi/wrapper'
|
import { getSession } from '@/ntqqapi/wrapper'
|
||||||
@ -16,10 +16,22 @@ function generateMsgId() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class NTQQMsgApi {
|
export class NTQQMsgApi {
|
||||||
/** 27187 TODO */
|
|
||||||
static async getTempChatInfo(chatType: ChatType2, peerUid: string) {
|
static async getTempChatInfo(chatType: ChatType2, peerUid: string) {
|
||||||
const session = getSession()
|
const session = getSession()
|
||||||
return session?.getMsgService().getTempChatInfo(chatType, peerUid)
|
if (session) {
|
||||||
|
return session.getMsgService().getTempChatInfo(chatType, peerUid)
|
||||||
|
} else {
|
||||||
|
return await invoke<TmpChatInfoApi>({
|
||||||
|
methodName: 'nodeIKernelMsgService/getTempChatInfo',
|
||||||
|
args: [
|
||||||
|
{
|
||||||
|
chatType,
|
||||||
|
peerUid,
|
||||||
|
},
|
||||||
|
null,
|
||||||
|
],
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static async setEmojiLike(peer: Peer, msgSeq: string, emojiId: string, set: boolean = true) {
|
static async setEmojiLike(peer: Peer, msgSeq: string, emojiId: string, set: boolean = true) {
|
||||||
|
@ -5,7 +5,7 @@ import { friends, groupMembers, getSelfUin } from '@/common/data'
|
|||||||
import { CacheClassFuncAsync, getBuildVersion } from '@/common/utils'
|
import { CacheClassFuncAsync, 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, forceFetchClientKeyRetType } from '../services'
|
||||||
import { NodeIKernelProfileListener } from '../listeners'
|
import { NodeIKernelProfileListener } from '../listeners'
|
||||||
import { NTEventDispatch } from '@/common/utils/EventTask'
|
import { NTEventDispatch } from '@/common/utils/EventTask'
|
||||||
import { NTQQFriendApi } from './friend'
|
import { NTQQFriendApi } from './friend'
|
||||||
@ -146,25 +146,31 @@ export class NTQQUserApi {
|
|||||||
return (hash & 0x7fffffff).toString()
|
return (hash & 0x7fffffff).toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 27187 TODO */
|
|
||||||
static async getPSkey(domains: string[]): Promise<Map<string, string>> {
|
|
||||||
const session = getSession()
|
|
||||||
const res = await session?.getTipOffService().getPskey(domains, true)
|
|
||||||
if (res?.result !== 0) {
|
|
||||||
throw new Error(`获取Pskey失败: ${res?.errMsg}`)
|
|
||||||
}
|
|
||||||
return res.domainPskeyMap
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 27187 TODO */
|
|
||||||
static async like(uid: string, count = 1) {
|
static async like(uid: string, count = 1) {
|
||||||
const session = getSession()
|
const session = getSession()
|
||||||
return session?.getProfileLikeService().setBuddyProfileLike({
|
if (session) {
|
||||||
friendUid: uid,
|
return session.getProfileLikeService().setBuddyProfileLike({
|
||||||
sourceId: 71,
|
friendUid: uid,
|
||||||
doLikeCount: count,
|
sourceId: 71,
|
||||||
doLikeTollCount: 0
|
doLikeCount: count,
|
||||||
})
|
doLikeTollCount: 0
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
return await invoke<GeneralCallResult & { succCounts: number }>({
|
||||||
|
methodName: 'nodeIKernelProfileLikeService/setBuddyProfileLike',
|
||||||
|
args: [
|
||||||
|
{
|
||||||
|
doLikeUserInfo: {
|
||||||
|
friendUid: uid,
|
||||||
|
sourceId: 71,
|
||||||
|
doLikeCount: count,
|
||||||
|
doLikeTollCount: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
null,
|
||||||
|
],
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static async getUidByUinV1(Uin: string) {
|
static async getUidByUinV1(Uin: string) {
|
||||||
@ -348,9 +354,17 @@ export class NTQQUserApi {
|
|||||||
return await NTQQUserApi.getUinByUidV1(Uid)
|
return await NTQQUserApi.getUinByUidV1(Uid)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 27187 TODO */
|
|
||||||
static async forceFetchClientKey() {
|
static async forceFetchClientKey() {
|
||||||
const session = getSession()
|
const session = getSession()
|
||||||
return await session?.getTicketService().forceFetchClientKey('')
|
if (session) {
|
||||||
|
return await session.getTicketService().forceFetchClientKey('')
|
||||||
|
} else {
|
||||||
|
return await invoke<forceFetchClientKeyRetType>({
|
||||||
|
methodName: 'nodeIKernelTicketService/forceFetchClientKey',
|
||||||
|
args: [{
|
||||||
|
domain: ''
|
||||||
|
}, null],
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -178,29 +178,6 @@ export class WebApi {
|
|||||||
return memberData
|
return memberData
|
||||||
}
|
}
|
||||||
|
|
||||||
static async setGroupNotice(GroupCode: string, Content: string = '') {
|
|
||||||
//https://web.qun.qq.com/cgi-bin/announce/add_qun_notice?bkn=${bkn}
|
|
||||||
//qid=${群号}&bkn=${bkn}&text=${内容}&pinned=0&type=1&settings={"is_show_edit_card":1,"tip_window_type":1,"confirm_required":1}
|
|
||||||
const _Pskey = (await NTQQUserApi.getPSkey(['qun.qq.com']))['qun.qq.com']
|
|
||||||
const _Skey = await NTQQUserApi.getSkey()
|
|
||||||
const CookieValue = 'p_skey=' + _Pskey + '; skey=' + _Skey + '; p_uin=o' + getSelfUin()
|
|
||||||
let ret: any = undefined
|
|
||||||
//console.log(CookieValue)
|
|
||||||
if (!_Skey || !_Pskey) {
|
|
||||||
//获取Cookies失败
|
|
||||||
return undefined
|
|
||||||
}
|
|
||||||
const Bkn = WebApi.genBkn(_Skey)
|
|
||||||
const data = 'qid=' + GroupCode + '&bkn=' + Bkn + '&text=' + Content + '&pinned=0&type=1&settings={"is_show_edit_card":1,"tip_window_type":1,"confirm_required":1}'
|
|
||||||
const url = 'https://web.qun.qq.com/cgi-bin/announce/add_qun_notice?bkn=' + Bkn
|
|
||||||
try {
|
|
||||||
ret = await RequestUtil.HttpGetJson<any>(url, 'GET', '', { 'Cookie': CookieValue })
|
|
||||||
return ret
|
|
||||||
} catch (e) {
|
|
||||||
return undefined
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static genBkn(sKey: string) {
|
static genBkn(sKey: string) {
|
||||||
sKey = sKey || '';
|
sKey = sKey || '';
|
||||||
let hash = 5381;
|
let hash = 5381;
|
||||||
|
@ -63,7 +63,7 @@ export abstract class GetFileBase extends BaseAction<GetFilePayload, GetFileResp
|
|||||||
} else if (fileCache[0].elementType === ElementType.VIDEO) {
|
} else if (fileCache[0].elementType === ElementType.VIDEO) {
|
||||||
res.url = await NTQQFileApi.getVideoUrl(peer, fileCache[0].msgId, fileCache[0].elementId)
|
res.url = await NTQQFileApi.getVideoUrl(peer, fileCache[0].msgId, fileCache[0].elementId)
|
||||||
}
|
}
|
||||||
if (enableLocalFile2Url && downloadPath && res.file === res.url) {
|
if (enableLocalFile2Url && downloadPath && (res.file === res.url || res.url === undefined)) {
|
||||||
try {
|
try {
|
||||||
res.base64 = await fsPromise.readFile(downloadPath, 'base64')
|
res.base64 = await fsPromise.readFile(downloadPath, 'base64')
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user