fix: 对齐 OneBot schema 与合并转发消息处理行为 (#1694)

* fix: make defaulted request fields optional

* fix: align onebot schemas with runtime behavior

* fix: tighten schema and unsupported action metadata

* fix: reject empty forward reference ids

* fix: update GoCQHTTPSendForwardMsg to handle messages correctly and adjust payload schema

* fix: refactor message handling in GoCQHTTPSendForwardMsg and add test for message normalization

* fix: update compatibility actions to return appropriate responses and align schemas with runtime behavior

* fix: ensure payload properties are non-null with default values in action handlers

* fix: update StreamStatus comments for clarity and enforce nickname as required in message schema

* fix: integrate sleep function in GetOnlineClient and update tests to verify API call

* fix: add production test checklist for OneBot schema alignment and message handling

* fix: remove outdated production test checklist for OneBot schema alignment
This commit is contained in:
吴天一 authored and GitHub committed 2026-03-12 01:54:33 +08:00
1 parent 8b2207e109
commit deae7fd467
54 files changed
+1078 -195

No files matched your search

@@ -9,11 +9,11 @@ export const SendGroupNoticePayloadSchema = Type.Object({
group_id: Type.String({ description: '群号' }),
content: Type.String({ description: '公告内容' }),
image: Type.Optional(Type.String({ description: '公告图片路径或 URL' })),
pinned: Type.Union([Type.Number(), Type.String()], { default: 0, description: '是否置顶 (0/1)' }),
type: Type.Union([Type.Number(), Type.String()], { default: 1, description: '类型 (默认为 1)' }),
confirm_required: Type.Union([Type.Number(), Type.String()], { default: 1, description: '是否需要确认 (0/1)' }),
is_show_edit_card: Type.Union([Type.Number(), Type.String()], { default: 0, description: '是否显示修改群名片引导 (0/1)' }),
tip_window_type: Type.Union([Type.Number(), Type.String()], { default: 0, description: '弹窗类型 (默认为 0)' }),
pinned: Type.Optional(Type.Union([Type.Number(), Type.String()], { default: 0, description: '是否置顶 (0/1)' })),
type: Type.Optional(Type.Union([Type.Number(), Type.String()], { default: 1, description: '类型 (默认为 1)' })),
confirm_required: Type.Optional(Type.Union([Type.Number(), Type.String()], { default: 1, description: '是否需要确认 (0/1)' })),
is_show_edit_card: Type.Optional(Type.Union([Type.Number(), Type.String()], { default: 0, description: '是否显示修改群名片引导 (0/1)' })),
tip_window_type: Type.Optional(Type.Union([Type.Number(), Type.String()], { default: 0, description: '弹窗类型 (默认为 0)' })),
});
export type SendGroupNoticePayload = Static<typeof SendGroupNoticePayloadSchema>;
@@ -29,6 +29,11 @@ export class SendGroupNotice extends OneBotAction<SendGroupNoticePayload, void>
override returnExample = GoCQHTTPActionsExamples.SendGroupNotice.response;
async _handle (payload: SendGroupNoticePayload) {
const pinned = payload.pinned!;
const type = payload.type!;
const confirmRequired = payload.confirm_required!;
const showEditCard = payload.is_show_edit_card!;
const tipWindowType = payload.tip_window_type!;
let UploadImage: { id: string, width: number, height: number; } | undefined;
if (payload.image) {
// 公告图逻辑
@@ -55,11 +60,11 @@ export class SendGroupNotice extends OneBotAction<SendGroupNoticePayload, void>
const publishGroupBulletinResult = await this.core.apis.WebApi.setGroupNotice(
payload.group_id.toString(),
payload.content,
+payload.pinned,
+payload.type,
+payload.is_show_edit_card,
+payload.tip_window_type,
+payload.confirm_required,
+pinned,
+type,
+showEditCard,
+tipWindowType,
+confirmRequired,
UploadImage?.id,
UploadImage?.width,
UploadImage?.height