feat: add settings field to group notice API response (#1505)

* feat: add settings field to group notice API response

- Add settings field to GroupNotice interface
- Include announcement configuration options (is_show_edit_card, remind_ts, tip_window_type, confirm_required)
- Fixes #1503

* refactor: make settings field optional for backward compatibility

- Mark settings as optional in GroupNotice interface
- Mark settings as optional in WebApiGroupNoticeFeed type
- Prevents runtime errors when processing older or malformed notices
- Addresses code review feedback on PR #1505

* Update GetGroupNotice.ts

---------

Co-authored-by: 手瓜一十雪 <nanaeonn@outlook.com>
This commit is contained in:
Makoto 2026-01-13 16:32:03 +08:00 committed by GitHub
parent 17d5110069
commit f3de4d48d3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 9 deletions

View File

@ -73,7 +73,7 @@ export interface WebApiGroupNoticeFeed {
fn: number; fn: number;
cn: number; cn: number;
vn: number; vn: number;
settings: { settings?: {
is_show_edit_card: number is_show_edit_card: number
remind_ts: number remind_ts: number
tip_window_type: number tip_window_type: number

View File

@ -7,19 +7,26 @@ interface GroupNotice {
publish_time: number; publish_time: number;
notice_id: string; notice_id: string;
message: { message: {
text: string text: string;
// 保持一段时间兼容性 防止以往版本出现问题 后续版本可考虑移除 // 保持一段时间兼容性 防止以往版本出现问题 后续版本可考虑移除
image: Array<{ image: Array<{
height: string height: string;
width: string width: string;
id: string id: string;
}>, }>,
images: Array<{ images: Array<{
height: string height: string;
width: string width: string;
id: string id: string;
}> }>;
}; };
settings?: {
is_show_edit_card: number,
remind_ts: number,
tip_window_type: number,
confirm_required: number;
};
read_num?: number;
} }
const SchemaData = Type.Object({ const SchemaData = Type.Object({
@ -59,6 +66,8 @@ export class GetGroupNotice extends OneBotAction<Payload, GroupNotice[]> {
image, image,
images: image, images: image,
}, },
settings: retApiNotice.settings,
read_num: retApiNotice.read_num
}; };
retNotices.push(retNotice); retNotices.push(retNotice);
} }