mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
fix
This commit is contained in:
parent
c174fce227
commit
870a915377
@ -1,12 +1,23 @@
|
||||
import { WebApi, WebApiGroupNoticeRet } from '@/core/apis/webapi';
|
||||
import { WebApi, WebApiGroupNoticeFeed, WebApiGroupNoticeRet } from '@/core/apis/webapi';
|
||||
import BaseAction from '../BaseAction';
|
||||
import { ActionName } from '../types';
|
||||
|
||||
interface PayloadType {
|
||||
group_id: number
|
||||
group_id: number
|
||||
}
|
||||
|
||||
export class GetGroupNotice extends BaseAction<PayloadType, WebApiGroupNoticeRet> {
|
||||
interface GroupNotice {
|
||||
sender_id: number
|
||||
publish_time: number
|
||||
message: {
|
||||
text: string
|
||||
image: Array<{
|
||||
height: string
|
||||
width: string
|
||||
id: string
|
||||
}>
|
||||
}
|
||||
}
|
||||
export class GetGroupNotice extends BaseAction<PayloadType, GroupNotice[]> {
|
||||
actionName = ActionName.GoCQHTTP_GetGroupNotice;
|
||||
|
||||
protected async _handle(payload: PayloadType) {
|
||||
@ -15,6 +26,19 @@ export class GetGroupNotice extends BaseAction<PayloadType, WebApiGroupNoticeRet
|
||||
if (!ret) {
|
||||
throw new Error('获取公告失败');
|
||||
}
|
||||
return ret;
|
||||
let retNotices: GroupNotice[] = new Array<GroupNotice>();
|
||||
for (let key in ret.feeds) {
|
||||
let retNotice: GroupNotice = {
|
||||
sender_id: ret.feeds[key].u,
|
||||
publish_time: ret.feeds[key].pubt,
|
||||
message: {
|
||||
text: ret.feeds[key].msg.text,
|
||||
image: []
|
||||
}
|
||||
}
|
||||
retNotices.push(retNotice);
|
||||
}
|
||||
|
||||
return retNotices;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user