From 3bea7d4885fc9211dbb2d23c2a7db3a976c88cc5 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Fri, 6 Sep 2024 23:16:11 +0300 Subject: [PATCH] Add /instruct-state command --- public/script.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/public/script.js b/public/script.js index 54e5fecb6..e777a3296 100644 --- a/public/script.js +++ b/public/script.js @@ -9257,6 +9257,27 @@ jQuery(async function () { callback: disableInstructCallback, helpString: 'Disables instruct mode', })); + SlashCommandParser.addCommandObject(SlashCommand.fromProps({ + name: 'instruct-state', + aliases: ['instruct-toggle'], + helpString: 'Gets the current instruct mode state. If an argument is provided, it will set the instruct mode state.', + unnamedArgumentList: [ + SlashCommandArgument.fromProps({ + description: 'instruct mode state', + typeList: [ARGUMENT_TYPE.BOOLEAN], + enumList: commonEnumProviders.boolean('trueFalse')(), + }), + ], + callback: async (_args, state) => { + if (!state || typeof state !== 'string') { + return String(power_user.instruct.enabled); + } + + const newState = isTrueBoolean(state); + newState ? enableInstructCallback() : disableInstructCallback(); + return String(power_user.instruct.enabled); + }, + })); SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'context', callback: selectContextCallback,