feat: api Extend RebootNormol

This commit is contained in:
手瓜一十雪 2024-05-13 09:32:25 +08:00
parent 58291b7156
commit 1c965ef515
3 changed files with 19 additions and 3 deletions

View File

@ -54,9 +54,10 @@ import { GetGroupEssence } from './group/GetGroupEssence';
import { ForwardFriendSingleMsg, ForwardGroupSingleMsg } from '@/onebot11/action/msg/ForwardSingleMsg';
import { GetFriendWithCategory } from './extends/GetFriendWithCategory';
import { SendGroupNotice } from './go-cqhttp/SendGroupNotice';
import Reboot from './system/Reboot';
import { Reboot, RebootNormol } from './system/Reboot';
export const actionHandlers = [
new RebootNormol(),
new GetFile(),
new Debug(),
new Reboot(),

View File

@ -1,4 +1,4 @@
import { rebootWithQuickLogin } from '@/common/utils/reboot';
import { rebootWithNormolLogin, rebootWithQuickLogin } from '@/common/utils/reboot';
import BaseAction from '../BaseAction';
import { ActionName } from '../types';
import { selfInfo } from '@/core/data';
@ -7,7 +7,7 @@ interface Payload {
delay: number
}
export default class Reboot extends BaseAction<Payload, null> {
export class Reboot extends BaseAction<Payload, null> {
actionName = ActionName.Reboot;
protected async _handle(payload: Payload): Promise<null> {
@ -21,3 +21,17 @@ export default class Reboot extends BaseAction<Payload, null> {
return null;
}
}
export class RebootNormol extends BaseAction<Payload, null> {
actionName = ActionName.Reboot;
protected async _handle(payload: Payload): Promise<null> {
if (payload.delay) {
setTimeout(() => {
rebootWithNormolLogin();
}, payload.delay);
} else {
rebootWithNormolLogin();
}
return null;
}
}

View File

@ -15,6 +15,7 @@ export interface InvalidCheckResult {
export enum ActionName {
// 以下为扩展napcat扩展
RebootNormol = 'reboot_normol',//无快速登录重新启动
GetRobotUinRange = 'get_robot_uin_range',
SetOnlineStatus = 'set_online_status',
GetFriendsWithCategory = 'get_friends_with_category',