From ce7759e12f01bca9b39049c5fbabdaca7084b709 Mon Sep 17 00:00:00 2001 From: maver Date: Thu, 1 Jun 2023 18:51:30 +0200 Subject: [PATCH] Add ability to update multiple prompts at once To Promptmanager --- public/scripts/PromptManager.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/public/scripts/PromptManager.js b/public/scripts/PromptManager.js index 64ae9bf30..9ad20f602 100644 --- a/public/scripts/PromptManager.js +++ b/public/scripts/PromptManager.js @@ -231,6 +231,18 @@ PromptManagerModule.prototype.updatePrompt = function (prompt) { prompt.content = document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_prompt').value; } +PromptManagerModule.prototype.updatePromptByIdentifier = function (identifier, updatePrompt) { + let prompt = this.serviceSettings.prompts.find((item) => identifier === item.identifier); + if (prompt) prompt = Object.assign(prompt, updatePrompt); +} + +PromptManagerModule.prototype.updatePrompts = function (prompts) { + prompts.forEach((update) => { + let prompt = this.getPromptById(update.identifier); + if (prompt) Object.assign(prompt, update); + }) +} + // Add a prompt to the current characters prompt list PromptManagerModule.prototype.appendPrompt = function (prompt, character) { const promptList = this.getPromptListByCharacter(character);