From 6594b3c7fa935dc3323dc4c7cc8265e42ca71532 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Sun, 23 Jun 2024 17:21:55 +0300 Subject: [PATCH] Inject supports variables for ID --- public/scripts/slash-commands.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/public/scripts/slash-commands.js b/public/scripts/slash-commands.js index ed9618721..959b931e4 100644 --- a/public/scripts/slash-commands.js +++ b/public/scripts/slash-commands.js @@ -1251,9 +1251,17 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({ name: 'inject', callback: injectCallback, namedArgumentList: [ - new SlashCommandNamedArgument( - 'id', 'injection ID', [ARGUMENT_TYPE.STRING], true, - ), + SlashCommandNamedArgument.fromProps({ + name: 'id', + description: 'injection ID or variable name pointing to ID', + typeList: [ARGUMENT_TYPE.STRING, ARGUMENT_TYPE.VARIABLE_NAME], + isRequired: true, + + enumProvider: () => [ + ...commonEnumProviders.injects(), + ...commonEnumProviders.variables('all')().map(x => { x.description = 'Variable'; return x; }), + ], + }), new SlashCommandNamedArgument( 'position', 'injection position', [ARGUMENT_TYPE.STRING], false, false, 'after', ['before', 'after', 'chat'], ),