Files
factorio-clusterio/sharedPlugins/remoteCommands/index.js
T

26 lines
611 B
JavaScript

module.exports = class remoteCommands {
constructor(mergedConfig, messageInterface, extras){
this.messageInterface = messageInterface;
this.config = mergedConfig;
this.socket = extras.socket;
if(this.config.allowRemoteCommandExecution){
this.socket.on("runCommand", data => {
let {commandID} = data;
this.messageInterface(data.command);
if(commandID){
this.socket.emit("runCommandReturnValue", {
commandID,
body: {
info: "Command was sent to factorio",
},
});
}
});
}
}
scriptOutput(data){
// we don't return anything yet
}
}