Hello is there any way i can make the bot refresh the json config file? like “save settings” in sbot? I want to change a value in the config file and with the help of some forum posts from [JellyBitz] and the api guide for plugins i could replace the config file with my file where i changed a value but it cannot be loaded “live” into the bot. Is there a way to make it work without restarting the bot?
set_profile('default') worked well! thanks. I found the set_profile(‘default’) in the guide before as im very new to python and phbot plugins the wording were a little bit confusing to me. I searched for “Profiles” inside of phbot but havent found one so i thought it were something from an older Version. Anyways, i know want to loop the config change. Ive tried def event_loop(): but that didnt worked. I dont know if a “def” can be looped? if i try to loop def event_loop(): log(‘loop’) it does work, but with the changing config def from JellyBitz it does not. Can you help me out again?
Cheers,
rbrt
Here is the code
from phBot import *
import shutil
import os
log('Plugin: xAutoConfig successfully loaded.')
# Called when the user successfully selects a character. No character data has been loaded yet.
def joined_game():
# JSON config not found
if not os.path.exists(get_config_path()):
# Looking for JSON default configs
defaultConfig = get_config_dir()+"config2"
# Loading JSON default configs
if os.path.exists(defaultConfig):
shutil.copyfile(defaultConfig,get_config_path())
log("Plugin: Default JSON configurations successfully loaded (xAutoConfig)")
set_profile('config2')
log('[%s] Loaded' % __name__)