NapCatQQ/packages/napcat-onebot/action/system/SetRestart.ts
手瓜一十雪 fd1808e36a Add action examples and enhance action metadata
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.
2026-01-25 17:45:46 +08:00

20 lines
688 B
TypeScript

import { ActionName } from '@/napcat-onebot/action/router';
import { OneBotAction } from '../OneBotAction';
import { WebUiDataRuntime } from 'napcat-webui-backend/src/helper/Data';
import { Type } from '@sinclair/typebox';
export class SetRestart extends OneBotAction<void, void> {
override actionName = ActionName.Reboot;
override payloadSchema = Type.Object({});
override returnSchema = Type.Null();
override actionDescription = '重启服务';
override actionTags = ['系统接口'];
async _handle () {
const result = await WebUiDataRuntime.requestRestartProcess();
if (!result.result) {
throw new Error(result.message || '进程重启失败');
}
}
}