add closure support to /run
This commit is contained in:
parent
1ab11cf85f
commit
12e30bde99
|
@ -1075,7 +1075,7 @@ export function initDefaultSlashCommands() {
|
|||
unnamedArgumentList: [
|
||||
SlashCommandArgument.fromProps({
|
||||
description: 'scoped variable or qr label',
|
||||
typeList: [ARGUMENT_TYPE.VARIABLE_NAME, ARGUMENT_TYPE.STRING],
|
||||
typeList: [ARGUMENT_TYPE.VARIABLE_NAME, ARGUMENT_TYPE.STRING, ARGUMENT_TYPE.CLOSURE],
|
||||
isRequired: true,
|
||||
enumProvider: () => [
|
||||
...commonEnumProviders.variables('scope')(),
|
||||
|
@ -1775,6 +1775,10 @@ async function runCallback(args, name) {
|
|||
throw new Error('No name provided for /run command');
|
||||
}
|
||||
|
||||
if (name instanceof SlashCommandClosure) {
|
||||
return await name.execute();
|
||||
}
|
||||
|
||||
/**@type {SlashCommandScope} */
|
||||
const scope = args._scope;
|
||||
if (scope.existsVariable(name)) {
|
||||
|
|
Loading…
Reference in New Issue