mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
fix: Sync get_group_notice return structure to gocq
This commit is contained in:
2
src/core
2
src/core
Submodule src/core updated: 22382f6d33...db31eb4f35
@@ -18,7 +18,7 @@ interface GroupNotice {
|
||||
}
|
||||
}
|
||||
type ApiGroupNotice = GroupNotice & WebApiGroupNoticeFeed;
|
||||
export class GetGroupNotice extends BaseAction<PayloadType, ApiGroupNotice[]> {
|
||||
export class GetGroupNotice extends BaseAction<PayloadType, GroupNotice[]> {
|
||||
actionName = ActionName.GoCQHTTP_GetGroupNotice;
|
||||
|
||||
protected async _handle(payload: PayloadType) {
|
||||
@@ -27,20 +27,23 @@ export class GetGroupNotice extends BaseAction<PayloadType, ApiGroupNotice[]> {
|
||||
if (!ret) {
|
||||
throw new Error('获取公告失败');
|
||||
}
|
||||
let retNotices: ApiGroupNotice[] = new Array<ApiGroupNotice>();
|
||||
for (let key in ret.feeds) {
|
||||
let retNotice: ApiGroupNotice = {
|
||||
...ret.feeds[key],
|
||||
sender_id: ret.feeds[key].u,
|
||||
publish_time: ret.feeds[key].pubt,
|
||||
const retNotices: GroupNotice[] = new Array<ApiGroupNotice>();
|
||||
for (const key in ret.feeds) {
|
||||
const retApiNotice: WebApiGroupNoticeFeed = ret.feeds[key];
|
||||
const retNotice: GroupNotice = {
|
||||
// ...ret.feeds[key],
|
||||
sender_id: retApiNotice.u,
|
||||
publish_time: retApiNotice.pubt,
|
||||
message: {
|
||||
text: ret.feeds[key].msg.text,
|
||||
image: []
|
||||
text: retApiNotice.msg.text,
|
||||
image: retApiNotice.msg.pics?.map((pic) => {
|
||||
return { id: pic.id, height: pic.h, width: pic.w };
|
||||
}) || []
|
||||
}
|
||||
}
|
||||
};
|
||||
retNotices.push(retNotice);
|
||||
}
|
||||
|
||||
return retNotices;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user