diff --git a/src/ntqqapi/api/msg.ts b/src/ntqqapi/api/msg.ts index 906a43e..bf23d3c 100644 --- a/src/ntqqapi/api/msg.ts +++ b/src/ntqqapi/api/msg.ts @@ -1,5 +1,5 @@ import { invoke, NTMethod } from '../ntcall' -import { GeneralCallResult } from '../services' +import { GeneralCallResult, TmpChatInfoApi } from '../services' import { RawMessage, SendMessageElement, Peer, ChatType2 } from '../types' import { getSelfNick, getSelfUid } from '../../common/data' import { getSession } from '@/ntqqapi/wrapper' @@ -16,10 +16,22 @@ function generateMsgId() { } export class NTQQMsgApi { - /** 27187 TODO */ static async getTempChatInfo(chatType: ChatType2, peerUid: string) { const session = getSession() - return session?.getMsgService().getTempChatInfo(chatType, peerUid) + if (session) { + return session.getMsgService().getTempChatInfo(chatType, peerUid) + } else { + return await invoke({ + methodName: 'nodeIKernelMsgService/getTempChatInfo', + args: [ + { + chatType, + peerUid, + }, + null, + ], + }) + } } static async setEmojiLike(peer: Peer, msgSeq: string, emojiId: string, set: boolean = true) { diff --git a/src/ntqqapi/api/user.ts b/src/ntqqapi/api/user.ts index 16ab690..abda975 100644 --- a/src/ntqqapi/api/user.ts +++ b/src/ntqqapi/api/user.ts @@ -5,7 +5,7 @@ import { friends, groupMembers, getSelfUin } from '@/common/data' import { CacheClassFuncAsync, getBuildVersion } from '@/common/utils' import { getSession } from '@/ntqqapi/wrapper' import { RequestUtil } from '@/common/utils/request' -import { NodeIKernelProfileService, UserDetailSource, ProfileBizType } from '../services' +import { NodeIKernelProfileService, UserDetailSource, ProfileBizType, forceFetchClientKeyRetType } from '../services' import { NodeIKernelProfileListener } from '../listeners' import { NTEventDispatch } from '@/common/utils/EventTask' import { NTQQFriendApi } from './friend' @@ -146,25 +146,31 @@ export class NTQQUserApi { return (hash & 0x7fffffff).toString() } - /** 27187 TODO */ - static async getPSkey(domains: string[]): Promise> { - 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) { const session = getSession() - return session?.getProfileLikeService().setBuddyProfileLike({ - friendUid: uid, - sourceId: 71, - doLikeCount: count, - doLikeTollCount: 0 - }) + if (session) { + return session.getProfileLikeService().setBuddyProfileLike({ + friendUid: uid, + sourceId: 71, + doLikeCount: count, + doLikeTollCount: 0 + }) + } else { + return await invoke({ + methodName: 'nodeIKernelProfileLikeService/setBuddyProfileLike', + args: [ + { + doLikeUserInfo: { + friendUid: uid, + sourceId: 71, + doLikeCount: count, + doLikeTollCount: 0 + } + }, + null, + ], + }) + } } static async getUidByUinV1(Uin: string) { @@ -348,9 +354,17 @@ export class NTQQUserApi { return await NTQQUserApi.getUinByUidV1(Uid) } - /** 27187 TODO */ static async forceFetchClientKey() { const session = getSession() - return await session?.getTicketService().forceFetchClientKey('') + if (session) { + return await session.getTicketService().forceFetchClientKey('') + } else { + return await invoke({ + methodName: 'nodeIKernelTicketService/forceFetchClientKey', + args: [{ + domain: '' + }, null], + }) + } } } diff --git a/src/ntqqapi/api/webapi.ts b/src/ntqqapi/api/webapi.ts index 839b7a1..820244c 100644 --- a/src/ntqqapi/api/webapi.ts +++ b/src/ntqqapi/api/webapi.ts @@ -178,29 +178,6 @@ export class WebApi { 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(url, 'GET', '', { 'Cookie': CookieValue }) - return ret - } catch (e) { - return undefined - } - } - static genBkn(sKey: string) { sKey = sKey || ''; let hash = 5381; diff --git a/src/onebot11/action/file/GetFile.ts b/src/onebot11/action/file/GetFile.ts index fbbda7d..35d24bc 100644 --- a/src/onebot11/action/file/GetFile.ts +++ b/src/onebot11/action/file/GetFile.ts @@ -63,7 +63,7 @@ export abstract class GetFileBase extends BaseAction