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.
26 lines
945 B
TypeScript
26 lines
945 B
TypeScript
import { ActionName } from '@/napcat-onebot/action/router';
|
|
import { OneBotAction } from '../OneBotAction';
|
|
import { Type, Static } from '@sinclair/typebox';
|
|
|
|
import { ActionExamples } from '../examples';
|
|
|
|
const ReturnSchema = Type.Object({
|
|
clientkey: Type.Optional(Type.String({ description: '客户端Key' })),
|
|
}, { description: '获取ClientKey结果' });
|
|
|
|
type ReturnType = Static<typeof ReturnSchema>;
|
|
|
|
export class GetClientkey extends OneBotAction<void, ReturnType> {
|
|
override actionName = ActionName.GetClientkey;
|
|
override payloadSchema = Type.Void();
|
|
override returnSchema = ReturnSchema;
|
|
override actionDescription = '获取 ClientKey';
|
|
override actionTags = ['扩展接口'];
|
|
override payloadExample = ActionExamples.GetClientkey.payload;
|
|
override returnExample = ActionExamples.GetClientkey.return;
|
|
|
|
async _handle () {
|
|
return { clientkey: (await this.core.apis.UserApi.forceFetchClientKey()).clientKey };
|
|
}
|
|
}
|