mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-05 15:11:15 +00:00
Introduced a centralized examples.ts file providing payload and return examples for all actions. Updated numerous action classes to include actionDescription, actionTags, payloadExample, and returnExample fields, improving API documentation and discoverability.
32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
|
import { ActionName } from '@/napcat-onebot/action/router';
|
|
import { napCatVersion } from 'napcat-common/src/version';
|
|
import { Type, Static } from '@sinclair/typebox';
|
|
|
|
const ReturnSchema = Type.Object({
|
|
app_name: Type.String({ description: '应用名称' }),
|
|
protocol_version: Type.String({ description: '协议版本' }),
|
|
app_version: Type.String({ description: '应用版本' }),
|
|
}, { description: '版本信息' });
|
|
|
|
type ReturnType = Static<typeof ReturnSchema>;
|
|
|
|
import { ActionExamples } from '../examples';
|
|
|
|
export default class GetVersionInfo extends OneBotAction<void, ReturnType> {
|
|
override actionName = ActionName.GetVersionInfo;
|
|
override returnSchema = ReturnSchema;
|
|
override actionDescription = '获取版本信息';
|
|
override actionTags = ['系统接口'];
|
|
override payloadExample = ActionExamples.GetVersionInfo.payload;
|
|
override returnExample = ActionExamples.GetVersionInfo.return;
|
|
|
|
async _handle (): Promise<ReturnType> {
|
|
return {
|
|
app_name: 'NapCat.Onebot',
|
|
protocol_version: 'v11',
|
|
app_version: napCatVersion,
|
|
};
|
|
}
|
|
}
|