Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 修正messageAPI类型定义 #81

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 11 additions & 44 deletions src/types/openapi/v1/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export interface EmbedField {
}
export interface Embed {
title: string;
description?: string;
prompt?: string;
thumbnail?: EmbedThumbnail;
fields?: EmbedField[];
Expand Down Expand Up @@ -74,6 +73,7 @@ export interface IMessage {
ark: Ark; // ark 消息
seq?: number; // 用于消息间的排序
seq_in_channel?: string; // 子频道消息 seq
message_reference?: MessageReference; // 引用消息
}

// 接口返回的数据多一层message
Expand Down Expand Up @@ -102,51 +102,18 @@ export interface MessageToCreate {
message_reference?: MessageReference;
image?: string;
msg_id?: string; // 要回复的消息id,不为空则认为是被动消息,公域机器人会异步审核,不为空是被动消息,公域机器人会校验语料
keyboard?: MessageKeyboard;
markdown?: Markdown;
}

// MessageKeyboard 消息按钮组件
export interface MessageKeyboard {
id?: string;
content?: CustomKeyboard;
// Markdown 消息体结构
export interface Markdown {
template_id: number; // markdown 模板 id
params: MessageMarkdownParams; //markdown 模板模板参数
content: string; //原生 markdown 内容,与 template_id 和 params参数互斥,参数都传值将报错。
}

// CustomKeyboard 自定义 Keyboard
export interface CustomKeyboard {
rows?: Row[];
}

// Row 每行结构
export interface Row {
buttons?: Button[];
}

// Button 单个按纽
export interface Button {
id?: string; // 按钮 ID
render_data?: RenderData; // 渲染展示字段
action?: Action; // 该按纽操作相关字段
}

// RenderData 按纽渲染展示
export interface RenderData {
label?: string; // 按纽上的文字
visited_label?: string; // 点击后按纽上文字
style?: number; // 按钮样式,0:灰色线框,1:蓝色线框
}

// Action 按纽点击操作
export interface Action {
type?: number; // 操作类型
permission?: Permission; // 可操作
click_limit?: number; // 可点击的次数, 默认不限
data?: string; // 操作相关数据
at_bot_show_channel_list?: boolean; // false:当前 true:弹出展示子频道选择器
}

// Permission 按纽操作权限
export interface Permission {
type?: number; // PermissionType 按钮的权限类型
specify_role_ids?: string[]; // SpecifyRoleIDs 身份组
specify_user_ids?: string[]; // SpecifyUserIDs 指定 UserID
// MessageMarkdownParams markdown 模版参数
export interface MessageMarkdownParams{
key: string; //markdown 模版 key
values: string[]; //markdown 模版 key 对应的 values ,列表长度大小为 1 代表单 value 值,长度大于1则为列表类型的参数 values 传参数
}
Loading