diff --git a/src/ntqqapi/api/webapi.ts b/src/ntqqapi/api/webapi.ts index 2e40994..cd73440 100644 --- a/src/ntqqapi/api/webapi.ts +++ b/src/ntqqapi/api/webapi.ts @@ -113,15 +113,8 @@ export interface GroupEssenceMsgRet { } } export class WebApi { - static async getGroupEssenceMsg(GroupCode: string, page_start: string) { - 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' + selfInfo.uin + '; uin=o' + selfInfo.uin; - if (!_Skey || !_Pskey) { - //获取Cookies失败 - return undefined; - } - const Bkn = WebApi.genBkn(_Skey); + static async getGroupEssenceMsg(GroupCode: string, page_start: string): Promise { + const {cookies: CookieValue, bkn: Bkn} = (await NTQQUserApi.getCookies('qun.qq.com')) const url = 'https://qun.qq.com/cgi-bin/group_digest/digest_list?bkn=' + Bkn + '&group_code=' + GroupCode + '&page_start=' + page_start + '&page_limit=20'; let ret; try { @@ -256,12 +249,6 @@ export class WebApi { } //实现未缓存 考虑2h缓存 static async getGroupHonorInfo(groupCode: string, getType: WebHonorType) { - const _Pskey = (await NTQQUserApi.getPSkey(['qun.qq.com']))['qun.qq.com']; - const _Skey = await NTQQUserApi.getSkey(); - if (!_Skey || !_Pskey) { - //获取Cookies失败 - return undefined; - } async function getDataInternal(Internal_groupCode: string, Internal_type: number) { let url = 'https://qun.qq.com/interactive/honorlist?gc=' + Internal_groupCode + '&type=' + Internal_type.toString(); let res = ''; @@ -284,7 +271,7 @@ export class WebApi { } let HonorInfo: any = { group_id: groupCode }; - const CookieValue = 'p_skey=' + _Pskey + '; skey=' + _Skey + '; p_uin=o' + selfInfo.uin + '; uin=o' + selfInfo.uin; + const CookieValue = (await NTQQUserApi.getCookies('qun.qq.com')).cookies; if (getType === WebHonorType.TALKACTIVE || getType === WebHonorType.ALL) { try { diff --git a/src/onebot11/action/group/GetGroupEssence.ts b/src/onebot11/action/group/GetGroupEssence.ts index 739eee5..f48b4eb 100644 --- a/src/onebot11/action/group/GetGroupEssence.ts +++ b/src/onebot11/action/group/GetGroupEssence.ts @@ -4,17 +4,21 @@ import { ActionName } from "../types"; interface PayloadType { group_id: number; - pages: number; + pages?: number; } export class GetGroupEssence extends BaseAction { actionName = ActionName.GoCQHTTP_GetEssenceMsg; protected async _handle(payload: PayloadType) { - const ret = await WebApi.getGroupEssenceMsg(payload.group_id.toString(), payload.pages.toString()); + throw '此 api 暂不支持' + const ret = await WebApi.getGroupEssenceMsg(payload.group_id.toString(), payload.pages?.toString() || '0'); if (!ret) { throw new Error('获取失败'); } + // ret.map((item) => { + // + // }) return ret; } }