Make it return empty array on cancel

40f2eae3f3297856d799c5789d3fcc3e67e25be8

Wolfsblvt <wolfsblvt@gmail.com>

1 files changed, +3 -2Showing whitespace changes
public/scripts/slash-commands.js+3 -2
@@ -69,7 +69,7 @@ import { SlashCommand } from './slash-commands/SlashCommand.js';
69import { SlashCommandAbortController } from './slash-commands/SlashCommandAbortController.js';69import { SlashCommandAbortController } from './slash-commands/SlashCommandAbortController.js';
70import { SlashCommandNamedArgumentAssignment } from './slash-commands/SlashCommandNamedArgumentAssignment.js';70import { SlashCommandNamedArgumentAssignment } from './slash-commands/SlashCommandNamedArgumentAssignment.js';
71import { SlashCommandEnumValue, enumTypes } from './slash-commands/SlashCommandEnumValue.js';71import { SlashCommandEnumValue, enumTypes } from './slash-commands/SlashCommandEnumValue.js';
72import { POPUP_TYPE, Popup, callGenericPopup } from './popup.js';72import { POPUP_RESULT, POPUP_TYPE, Popup, callGenericPopup } from './popup.js';
73import { commonEnumProviders, enumIcons } from './slash-commands/SlashCommandCommonEnumsProvider.js';73import { commonEnumProviders, enumIcons } from './slash-commands/SlashCommandCommonEnumsProvider.js';
74import { SlashCommandBreakController } from './slash-commands/SlashCommandBreakController.js';74import { SlashCommandBreakController } from './slash-commands/SlashCommandBreakController.js';
75import { SlashCommandExecutionError } from './slash-commands/SlashCommandExecutionError.js';75import { SlashCommandExecutionError } from './slash-commands/SlashCommandExecutionError.js';
@@ -2474,7 +2474,8 @@ async function buttonsCallback(args, text) {
2474 /** @returns {string} @param {string|number|boolean} result */2474 /** @returns {string} @param {string|number|boolean} result */
2475 function getResult(result) {2475 function getResult(result) {
2476 if (multiple) {2476 if (multiple) {
2477 return JSON.stringify(Array.from(multipleToggledState).map(r => resultToButtonMap.get(r) ?? ''));2477 const array = result === POPUP_RESULT.AFFIRMATIVE ? Array.from(multipleToggledState).map(r => resultToButtonMap.get(r) ?? '') : [];
2478 return JSON.stringify(array);
2478 }2479 }
2479 return typeof result === 'number' ? resultToButtonMap.get(result) ?? '' : '';2480 return typeof result === 'number' ? resultToButtonMap.get(result) ?? '' : '';
2480 }2481 }