diff --git a/src/onebot/action/extends/BotExit.ts b/src/onebot/action/extends/BotExit.ts new file mode 100644 index 00000000..60d98023 --- /dev/null +++ b/src/onebot/action/extends/BotExit.ts @@ -0,0 +1,10 @@ +import { ActionName } from '@/onebot/action/router'; +import { OneBotAction } from '../OneBotAction'; + +export class BotExit extends OneBotAction { + override actionName = ActionName.Exit; + + async _handle() { + process.exit(0); + } +} diff --git a/src/onebot/action/index.ts b/src/onebot/action/index.ts index 1830df9b..b3781912 100644 --- a/src/onebot/action/index.ts +++ b/src/onebot/action/index.ts @@ -104,6 +104,7 @@ import { GetClientkey } from './extends/GetClientkey'; import { SendPacket } from './extends/SendPacket'; import { SendPoke } from '@/onebot/action/packet/SendPoke'; import { SetDiyOnlineStatus } from './extends/SetDiyOnlineStatus'; +import { BotExit } from './extends/BotExit'; export function createActionMap(obContext: NapCatOneBot11Adapter, core: NapCatCore) { @@ -221,6 +222,7 @@ export function createActionMap(obContext: NapCatOneBot11Adapter, core: NapCatCo new SendPacket(obContext, core), new SendPoke(obContext, core), new GetGroupSystemMsg(obContext, core), + new BotExit(obContext, core), ]; type HandlerUnion = typeof actionHandlers[number]; diff --git a/src/onebot/action/router.ts b/src/onebot/action/router.ts index cf8a39b5..15d7947e 100644 --- a/src/onebot/action/router.ts +++ b/src/onebot/action/router.ts @@ -49,7 +49,7 @@ export const ActionName = { GetVersionInfo: 'get_version_info', // Reboot : 'set_restart', // CleanCache : 'clean_cache', - + Exit: 'bot_exit', // go-cqhttp SetQQProfile: 'set_qq_profile', // QidianGetAccountInfo : 'qidian_get_account_info',