Trying to make an commands which will allow me to update script plugins for PO. The code: Code (text): if (command == "updatescriptplugin") { var data = commandData; if (commandData === undefined) { normalbot.sendMessage(src, "Please specify script plugin!", channel); return; } normalbot.sendMessage(src, "Fetching script plugin...", channel); sys.webCall(Config.base_url+"scripts/"+commandData, function(resp) { if (resp !== "") { sys.writeToFile(commandData, resp); normalbot.sendAll("Updated " + commandData + "!", staffchannel); } else { normalbot.sendAll('Failed to update!', staffchannel); } }); return; } I believe the error starts at "sys.webCall(Config.base_url+"scripts/"+commandData, function(resp) {". And pretty sure "sys.writeToFile(commandData, resp);" is also wrong. **Note** "Script Warning in sys.write(filename, content): The system cannot find the path specified.". This showed up in server.exe. So "sys.writeToFile(commandData, resp);" is definitely wrong. Any suggestion on what it should be? Thanks for your help.
Update. Has not been tested. Code (text): if (command == "updatescriptplugin") { var data = commandData; if (commandData === undefined) { normalbot.sendMessage(src, "Please specify script plugin!", channel); return; } normalbot.sendMessage(src, "Fetching script plugin...", channel); sys.webCall(Config.base_url+"scripts/"+commandData, function(resp) { if (resp !== "") { sys.writeToFile("" + commandData + "", resp); normalbot.sendAll("Updated " + commandData + "!", staffchannel); } else { normalbot.sendAll('Failed to update!', staffchannel); } })''; return; }
/updateplugin already does exactly what you're trying to do But to answer The problem with sys.writeToFile is probably something to do with what you type as your commandData when using the command judging from the error. What are you typing exactly when using the command.
I must be using the command wrong then. How are you meant to use it. /updateplugin ??? commadData would be the name of the file.
/updatplugin didn't work for bots.js. Or any other command files. It always says "±Dratini: Module not found, can not update.". It works for battlefactory.js