mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
fix: getGroupEssenceMsgAll
This commit is contained in:
parent
53475a6a0e
commit
200c7226ef
@ -34,11 +34,21 @@ export class NTQQWebApi {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
async getGroupEssenceMsgAll(GroupCode: string) {
|
||||||
async getGroupEssenceMsg(GroupCode: string) {
|
let ret: GroupEssenceMsgRet[] = [];
|
||||||
|
for (let i = 0; i < 4; i++) {
|
||||||
|
let data = await this.getGroupEssenceMsg(GroupCode, i, 50);
|
||||||
|
if (!data || data?.data.is_end) break;
|
||||||
|
ret.push(data);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
async getGroupEssenceMsg(GroupCode: string, page_start: number = 0, page_limit: number = 50) {
|
||||||
const cookieObject = await this.core.apis.UserApi.getCookies('qun.qq.com');
|
const cookieObject = await this.core.apis.UserApi.getCookies('qun.qq.com');
|
||||||
const url = `https://qun.qq.com/cgi-bin/group_digest/digest_list?${new URLSearchParams({
|
const url = `https://qun.qq.com/cgi-bin/group_digest/digest_list?${new URLSearchParams({
|
||||||
bkn: this.getBknFromCookie(cookieObject),
|
bkn: this.getBknFromCookie(cookieObject),
|
||||||
|
page_start: page_start.toString(),
|
||||||
|
page_limit: page_limit.toString(),
|
||||||
group_code: GroupCode,
|
group_code: GroupCode,
|
||||||
}).toString()
|
}).toString()
|
||||||
}`;
|
}`;
|
||||||
|
@ -33,11 +33,11 @@ export class GetGroupEssence extends BaseAction<Payload, any> {
|
|||||||
async _handle(payload: Payload) {
|
async _handle(payload: Payload) {
|
||||||
const NTQQWebApi = this.core.apis.WebApi;
|
const NTQQWebApi = this.core.apis.WebApi;
|
||||||
const NTQQGroupApi = this.core.apis.GroupApi;
|
const NTQQGroupApi = this.core.apis.GroupApi;
|
||||||
const ret = await NTQQWebApi.getGroupEssenceMsg(payload.group_id.toString());
|
const msglist = (await NTQQWebApi.getGroupEssenceMsgAll(payload.group_id.toString())).flatMap((e) => e.data.msg_list);
|
||||||
if (!ret) {
|
if (!msglist) {
|
||||||
throw new Error('获取失败');
|
throw new Error('获取失败');
|
||||||
}
|
}
|
||||||
return await Promise.all(ret.data.msg_list.map(async (msg) => {
|
return await Promise.all(msglist.map(async (msg) => {
|
||||||
const msgOriginData = await this.msgSeqToMsgId({
|
const msgOriginData = await this.msgSeqToMsgId({
|
||||||
chatType: ChatType.KCHATTYPEGROUP,
|
chatType: ChatType.KCHATTYPEGROUP,
|
||||||
peerUid: payload.group_id.toString(),
|
peerUid: payload.group_id.toString(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user