diff --git a/public/scripts/slash-commands.js b/public/scripts/slash-commands.js index 3ff9fbc5f..c0154ee66 100644 --- a/public/scripts/slash-commands.js +++ b/public/scripts/slash-commands.js @@ -174,6 +174,7 @@ parser.addCommand('input', inputCallback, ['prompt'], '( parser.addCommand('run', runCallback, ['call', 'exec'], '(QR label) – runs a Quick Reply with the specified name from the current preset.', true, true); parser.addCommand('messages', getMessagesCallback, ['message'], '(names=off/on [message index or range]) – returns the specified message or range of messages as a string.', true, true); parser.addCommand('setinput', setInputCallback, [], '(text) – sets the user input to the specified text and passes it to the next command through the pipe.', true, true); +parser.addCommand('popup', popupCallback, [], '(text) – shows a blocking popup with the specified text.', true, true); registerVariableCommands(); const NARRATOR_NAME_KEY = 'narrator_name'; @@ -185,6 +186,14 @@ function setInputCallback(_, value) { return value; } +async function popupCallback(_, value) { + const safeValue = DOMPurify.sanitize(value || ''); + await delay(1); + await callPopup(safeValue, 'text'); + await delay(1); + return value; +} + function getMessagesCallback(args, value) { const includeNames = !isFalseBoolean(args?.names); const range = stringToRange(value, 0, chat.length - 1);