mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-14 23:24:52 +09:00
25 lines
797 B
JavaScript
25 lines
797 B
JavaScript
module.exports = class remoteCommands {
|
|
constructor(mergedConfig, messageInterface, extras){
|
|
this.messageInterface = messageInterface;
|
|
this.config = mergedConfig;
|
|
this.socket = extras.socket;
|
|
|
|
this.socket.emit("registerChatReciever");
|
|
this.socket.on("gameChat", data => {
|
|
if(data.instanceID && data.instanceID != this.config.unique.toString()){
|
|
if(data.data.includes("[CHAT]") && data.data.toLowerCase().includes("!shout")){
|
|
let chatMessage = "["+data.instanceID+"]"+ data.data.trim().split(" ").shift().shift().shift().join(" ");
|
|
this.messageInterface("/c game.print('"+chatMessage+"')");
|
|
}
|
|
}
|
|
});
|
|
}
|
|
factorioOutput(data){
|
|
// console.log("GOT CHAT!"+data)
|
|
this.socket.emit("gameChat", {
|
|
instanceID: this.config.unique.toString(),
|
|
data,
|
|
});
|
|
}
|
|
}
|