#930 Fix WI activation via slash command

This commit is contained in:
Cohee
2023-08-13 19:20:00 +03:00
parent 43089ee06f
commit 3688bd0b04

View File

@@ -1331,7 +1331,6 @@ export async function importEmbeddedWorldInfo() {
} }
function onWorldInfoChange(_, text) { function onWorldInfoChange(_, text) {
let selectedWorlds;
if (_ !== '__notSlashCommand__') { // if it's a slash command if (_ !== '__notSlashCommand__') { // if it's a slash command
if (text !== undefined) { // and args are provided if (text !== undefined) { // and args are provided
const slashInputSplitText = text.trim().toLowerCase().split(","); const slashInputSplitText = text.trim().toLowerCase().split(",");
@@ -1339,12 +1338,14 @@ function onWorldInfoChange(_, text) {
slashInputSplitText.forEach((worldName) => { slashInputSplitText.forEach((worldName) => {
const wiElement = getWIElement(worldName); const wiElement = getWIElement(worldName);
if (wiElement.length > 0) { if (wiElement.length > 0) {
selected_world_info.push(wiElement.text());
wiElement.prop("selected", true); wiElement.prop("selected", true);
toastr.success(`Activated world: ${wiElement.text()}`); toastr.success(`Activated world: ${wiElement.text()}`);
} else { } else {
toastr.error(`No world found named: ${worldName}`); toastr.error(`No world found named: ${worldName}`);
} }
}) });
$("#world_info").trigger("change");
} else { // if no args, unset all worlds } else { // if no args, unset all worlds
toastr.success('Deactivated all worlds'); toastr.success('Deactivated all worlds');
selected_world_info = []; selected_world_info = [];