From d2490787aecf5aaf7dfec877740b5144d54cac0d Mon Sep 17 00:00:00 2001 From: DrSmoothl <1787882683@qq.com> Date: Fri, 26 Jun 2026 22:44:10 +0800 Subject: [PATCH] feat(onebot): backfill returnsSchema on info/group-info read-only actions --- packages/onebot/src/actions/group-info.ts | 35 +++++++++++++++++++++++ packages/onebot/src/actions/info.ts | 12 ++++++++ 2 files changed, 47 insertions(+) diff --git a/packages/onebot/src/actions/group-info.ts b/packages/onebot/src/actions/group-info.ts index 8cde7f47..83a8cc46 100644 --- a/packages/onebot/src/actions/group-info.ts +++ b/packages/onebot/src/actions/group-info.ts @@ -9,6 +9,20 @@ export const actions = [ name: 'get_group_list', summary: '获取群列表', readOnly: true, + returns: '群信息对象数组。', + returnsSchema: { + type: 'array', + items: { + type: 'object', + properties: { + group_id: { type: 'integer', description: '群号' }, + group_name: { type: 'string', description: '群名' }, + member_count: { type: 'integer', description: '当前成员数' }, + max_member_count: { type: 'integer', description: '成员上限' }, + }, + required: ['group_id', 'group_name', 'member_count', 'max_member_count'], + }, + }, params: { no_cache: f.bool().default(false) }, run: async (p, ctx) => { const noCache = p.no_cache; @@ -50,6 +64,27 @@ export const actions = [ name: 'get_group_member_list', summary: '获取群成员列表', readOnly: true, + returns: '群成员信息对象数组。', + returnsSchema: { + type: 'array', + items: { + type: 'object', + properties: { + group_id: { type: 'integer', description: '群号' }, + user_id: { type: 'integer', description: 'QQ 号' }, + nickname: { type: 'string', description: '昵称' }, + card: { type: 'string', description: '群名片' }, + sex: { type: 'string', enum: ['male', 'female', 'unknown'], description: '性别' }, + age: { type: 'integer', description: '年龄' }, + join_time: { type: 'integer', description: '入群时间戳(秒)' }, + last_sent_time: { type: 'integer', description: '最后发言时间戳(秒)' }, + level: { type: 'string', description: '群等级' }, + role: { type: 'string', enum: ['owner', 'admin', 'member'], description: '角色' }, + title: { type: 'string', description: '专属头衔' }, + }, + required: ['group_id', 'user_id', 'nickname', 'role'], + }, + }, params: { no_cache: f.bool().default(false) }, run: async (p, ctx) => { const groupId = p.group_id; diff --git a/packages/onebot/src/actions/info.ts b/packages/onebot/src/actions/info.ts index de70ceef..a489c7c7 100644 --- a/packages/onebot/src/actions/info.ts +++ b/packages/onebot/src/actions/info.ts @@ -70,6 +70,12 @@ export const actions = [ defineAction({ name: 'can_send_image', readOnly: true, + returns: '能力查询结果。', + returnsSchema: { + type: 'object', + properties: { yes: { type: 'boolean', description: '是否支持发送图片' } }, + required: ['yes'], + }, params: {}, run: (_p, ctx) => { return okResponse({ yes: ctx.canSendImage?.() ?? false }); @@ -79,6 +85,12 @@ export const actions = [ defineAction({ name: 'can_send_record', readOnly: true, + returns: '能力查询结果。', + returnsSchema: { + type: 'object', + properties: { yes: { type: 'boolean', description: '是否支持发送语音' } }, + required: ['yes'], + }, params: {}, run: (_p, ctx) => { return okResponse({ yes: ctx.canSendRecord?.() ?? false });