feat(onebot): backfill returnsSchema on representative read-only actions

This commit is contained in:
DrSmoothl committed 2026-06-26 22:03:42 +08:00
1 parent 355cce1e52
commit 18014fb3c5
2 files changed
+57

No files matched your search

+28
View File
@@ -9,6 +9,15 @@ export const actions = [
defineAction({
name: 'get_login_info',
readOnly: true,
returns: '当前登录账号的 QQ 号与昵称。',
returnsSchema: {
type: 'object',
properties: {
user_id: { type: 'integer', description: '登录 QQ 号' },
nickname: { type: 'string', description: '登录昵称' },
},
required: ['user_id', 'nickname'],
},
params: {},
run: (_p, ctx) => {
const login = ctx.getLoginInfo();
@@ -19,6 +28,15 @@ export const actions = [
defineAction({
name: 'get_status',
readOnly: true,
returns: '运行状态。`online`/`good` 均表示账号是否在线。',
returnsSchema: {
type: 'object',
properties: {
online: { type: 'boolean', description: '是否在线' },
good: { type: 'boolean', description: '状态是否正常(与 online 一致)' },
},
required: ['online', 'good'],
},
params: {},
run: (_p, ctx) => {
const online = ctx.isOnline();
@@ -29,6 +47,16 @@ export const actions = [
defineAction({
name: 'get_version_info',
readOnly: true,
returns: '实现与协议版本信息。',
returnsSchema: {
type: 'object',
properties: {
app_name: { type: 'string', description: '实现名称(SnowLuma)' },
app_version: { type: 'string', description: '实现版本' },
protocol_version: { type: 'string', description: 'OneBot 协议版本' },
},
required: ['app_name', 'app_version', 'protocol_version'],
},
params: {},
run: () => {
return okResponse({