mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
build: test api
This commit is contained in:
32
src/onebot11/action/extends/TestApi01.ts
Normal file
32
src/onebot11/action/extends/TestApi01.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import BaseAction from '../BaseAction';
|
||||
import { ActionName, BaseCheckResult } from '../types';
|
||||
import * as fs from 'node:fs';
|
||||
import { NTQQUserApi } from '@/core/apis/user';
|
||||
import { checkFileReceived, uri2local } from '@/common/utils/file';
|
||||
import { napCatCore, NTQQGroupApi } from '@/core';
|
||||
import { FromSchema, JSONSchema } from 'json-schema-to-ts';
|
||||
// import { log } from "../../../common/utils";
|
||||
|
||||
const SchemaData = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
cmd: { type: 'string' },
|
||||
param: { type: 'string' }
|
||||
},
|
||||
required: ['cmd', 'param'],
|
||||
} as const satisfies JSONSchema;
|
||||
|
||||
type Payload = FromSchema<typeof SchemaData>;
|
||||
|
||||
export default class TestApi01 extends BaseAction<Payload, any> {
|
||||
actionName = ActionName.TestApi01;
|
||||
// 用不着复杂检测
|
||||
protected async check(payload: Payload): Promise<BaseCheckResult> {
|
||||
return {
|
||||
valid: true,
|
||||
};
|
||||
}
|
||||
protected async _handle(payload: Payload): Promise<any> {
|
||||
return await napCatCore.session.getMsgService().sendSsoCmdReqByContend(payload.cmd, payload.param);
|
||||
}
|
||||
}
|
@@ -77,6 +77,7 @@ import { GetProfileLike } from './extends/GetProfileLike';
|
||||
import SetGroupHeader from './extends/SetGroupHeader';
|
||||
import { FetchCustomFace } from './extends/FetchCustomFace';
|
||||
import GoCQHTTPUploadPrivateFile from './go-cqhttp/UploadPrivareFile';
|
||||
import TestApi01 from './extends/TestApi01';
|
||||
|
||||
export const actionHandlers = [
|
||||
new RebootNormal(),
|
||||
@@ -160,7 +161,8 @@ export const actionHandlers = [
|
||||
new GetProfileLike(),
|
||||
new SetGroupHeader(),
|
||||
new FetchCustomFace(),
|
||||
new GoCQHTTPUploadPrivateFile()
|
||||
new GoCQHTTPUploadPrivateFile(),
|
||||
new TestApi01()
|
||||
];
|
||||
|
||||
function initActionMap() {
|
||||
|
@@ -101,5 +101,6 @@ export enum ActionName {
|
||||
GetProfileLike = 'get_profile_like',
|
||||
SetGroupHeader = 'set_group_head',
|
||||
FetchCustomFace = 'fetch_custom_face',
|
||||
GOCQHTTP_UploadPrivateFile = 'upload_private_file'
|
||||
GOCQHTTP_UploadPrivateFile = 'upload_private_file',
|
||||
TestApi01 = "test_api_01"
|
||||
}
|
||||
|
Reference in New Issue
Block a user