Repository navigation
Conversation
…nd testing - Implemented messageBuilder.ts to handle message creation, parsing, and validation for both v2 and guild API scenes. - Added functions for building various message types including text, markdown, media, ark, and embed. - Created utility functions for keyboard button management and reply candidate extraction. - Developed unit tests for messageBuilder functionalities in messageBuilder.test.ts, covering detection of message scenes, payload building, draft parsing, and validation.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
新增与修改
消息构造与解析核心 — messageBuilder.ts
detectMessageScene:根据接口路径自动识别 群聊 / 单聊 (v2) 与 频道 / 频道私信 (guild) 两套协议结构,也可手动切换。
parseMessageDraft:打开弹窗时自动反序列化当前请求体 JSON 回填表单,并保留未知自定义顶层字段;若当前请求体非消息 JSON 则给出覆盖提示而不污染新报文。
buildMessagePayload / validateMessageDraft:支持 5 类消息(纯文本 0、Markdown 原生与 custom_template_id 模板 2、富媒体 file_info 7 / 频道 image、Ark 模板卡片 3 含 23/24/37 预设与 obj_kv 列表、Embed 卡片 4)、内嵌按钮 keyboard(按钮模板 ID 与最多 5×5 自定义按钮网格、样式、跳转/回调/指令动作、权限与指定用户/身份组)、被动回复(msg_id / event_id / msg_seq,主动消息自动省略)及引用回复 message_reference,并自动清理互斥字段与输出实时诊断提示。
extractReplyCandidates:从网关最近事件流提取可回复的 msg_id 与 event_id。
消息构造器弹窗组件 — MessageBuilderModal.vue
双栏布局:左侧交互式表单(支持复用 OpenIdInsertModal.vue 在光标处插入 <@!OpenID> 提及或为按钮选取指定可点击用户、一键从最近网关事件填入 msg_id / event_id),右侧固定展示带语法高亮的实时 JSON 预览、一键复制与字段校验提示;支持 Ctrl+Enter 快速回填。
编辑器接入与弹窗栈细节
RequestEditor.vue:在「请求体」操作栏新增「消息构造器」入口,确认后将格式化后的 JSON 写入当前请求标签页。
Modal.vue & SendPage.vue:为多层嵌套弹窗维护栈顶 Escape 关闭顺序(在内层选择 OpenID 按 Escape 不会误关外层构造器),并在弹窗打开时屏蔽底层页面的 Ctrl+Enter 直接发送快捷键。
补充单元测试 messageBuilder.test.ts、MessageBuilderModal.test.ts 及 README.md 功能说明。