mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-05 23:19:37 +00:00
Added or updated actionSummary, actionTags, payloadExample, and returnExample properties for all OneBot action classes in the napcat-onebot package. This improves API documentation and discoverability by providing concise summaries, categorization tags, and usage examples for each action.
33 lines
1018 B
TypeScript
33 lines
1018 B
TypeScript
import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
|
import { ActionName } from '@/napcat-onebot/action/router';
|
|
import { Type, Static } from '@sinclair/typebox';
|
|
|
|
export const GetCSRFReturnSchema = Type.Object({
|
|
token: Type.Number({ description: 'CSRF Token' }),
|
|
});
|
|
|
|
export type GetCSRFReturnType = Static<typeof GetCSRFReturnSchema>;
|
|
|
|
export class GetCSRF extends OneBotAction<void, GetCSRFReturnType> {
|
|
override actionName = ActionName.GetCSRF;
|
|
override payloadSchema = Type.Object({});
|
|
override returnSchema = GetCSRFReturnSchema;
|
|
override actionSummary = '获取 CSRF Token';
|
|
override actionDescription = '获取 CSRF Token';
|
|
override actionTags = ['系统接口'];
|
|
override payloadExample = {};
|
|
override returnExample = {
|
|
token: 123456789
|
|
};
|
|
|
|
async _handle () {
|
|
const sKey = await this.core.apis.UserApi.getSKey();
|
|
if (!sKey) {
|
|
throw new Error('SKey is undefined');
|
|
}
|
|
return {
|
|
token: +this.core.apis.WebApi.getBknFromSKey(sKey),
|
|
};
|
|
}
|
|
}
|