mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Use raw metadata for set effect command
This commit is contained in:
@@ -585,12 +585,6 @@ class WorldInfoTimedEffects {
|
||||
return;
|
||||
}
|
||||
|
||||
const currentState = this.isEffectActive(type, entry);
|
||||
|
||||
if (currentState === newState) {
|
||||
return;
|
||||
}
|
||||
|
||||
const key = this.#getEntryKey(entry);
|
||||
delete chat_metadata.timedWorldInfo[type][key];
|
||||
|
||||
@@ -1106,7 +1100,7 @@ function registerWorldInfoSlashCommands() {
|
||||
}
|
||||
|
||||
const getNewEffectState = () => {
|
||||
const currentState = timedEffects.isEffectActive(effect, entry);
|
||||
const currentState = !!timedEffects.getEffectMetadata(effect, entry);
|
||||
|
||||
if (['toggle', 't', ''].includes(value.trim().toLowerCase())) {
|
||||
return !currentState;
|
||||
@@ -1123,12 +1117,10 @@ function registerWorldInfoSlashCommands() {
|
||||
return currentState;
|
||||
};
|
||||
|
||||
timedEffects.checkTimedEffects();
|
||||
const newEffectState = getNewEffectState();
|
||||
timedEffects.setTimedEffect(effect, entry, newEffectState);
|
||||
|
||||
await saveMetadata();
|
||||
timedEffects.cleanUp();
|
||||
toastr.success(`Timed effect "${effect}" for entry ${entry.uid} is now ${newEffectState ? 'active' : 'inactive'}`);
|
||||
|
||||
return '';
|
||||
|
Reference in New Issue
Block a user