• If you need help or want to discuss things, you now can also join us on our Discord Server!
  • A first preview of the unlimited version of SinusBot can be found in the Upcoming Changes thread. A version for Windows will follow, but we don't have a release date, yet.

EN saveConfig() Usage?

Status
Not open for further replies.

kanalumaddela

Insider
Insider
Docs
ce5a0f2ab9bd2cda6b60c6c9b7bed8c0.png

Does this mean you can change a script's own config values through itself? If so, what's a en example of using? If not, what's an example of using it? :p
 
I did some tests and you can change config values of that script.
You could for example use it to change config values with a chat comand instead of havig to do it through the web interface.
But at this time for some reason the set value can't be accessed right away (at least from my testing). The script has to be reloaded first or the value has to be set like a variable.
Usage is pretty easy:
Code:
var engine = require('engine');

engine.saveConfig({keyName: 'value'});
engine.log(config.keyName); //before reload: logs nothing; after reload: logs 'value'

config.keyName = 'value';
engine.log(config.keyName); //logs 'value'

config.keyName = 'test'; //'test' doesn't get saved to config but as variable
engine.log(config.keyName); //logs 'test'

PS: Sorry for late reply but I hope I helped someone.

Edit: Tested version was 0.9.16-10f0fad
 
Last edited:
Status
Not open for further replies.
Top