mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-12 23:04:52 +09:00
Remove redundant API call in globalChat
Remove call to getInstanceName which in turn calls the rather expensive /api/slaves in the globalChat plugin.
This commit is contained in:
1 parent
f3171c2feb
commit
2f3b4c1aa8
2 files changed
+3
-5
No files matched your search
@@ -44,6 +44,7 @@ Version 2.0.0
|
||||
- Removed undocumented --port and --rcon-port arguments to client.
|
||||
- Removed undocumented FACTORIOPORT and RCONPORT enviroment variable
|
||||
handling in client.
|
||||
- Removed redundant call to /api/slaves in globalChat plugin.
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
const needle = require("needle");
|
||||
|
||||
module.exports = class remoteCommands {
|
||||
constructor(mergedConfig, messageInterface, extras){
|
||||
this.messageInterface = messageInterface;
|
||||
this.config = mergedConfig;
|
||||
this.socket = extras.socket;
|
||||
this.instances = {};
|
||||
this.getInstanceName = require("lib/clusterTools/getInstanceName")(mergedConfig);
|
||||
|
||||
this.socket.on("hello", () => this.socket.emit("registerChatReciever"));
|
||||
|
||||
@@ -25,11 +22,10 @@ module.exports = class remoteCommands {
|
||||
words.shift();
|
||||
let message = words.join(" ").replace(/[";]/g, " ").replace(/[']/g,"").replace("/shout ", "").replace("!shout ","").replace(/\[gps=.*?\]/g, "").replace(/\[train=.*?\]/g, "");
|
||||
|
||||
let instance = await this.getInstanceName(data.instanceID);
|
||||
if(data.data.includes("[gps=")){
|
||||
//Nothing
|
||||
}else{
|
||||
this.messageInterface("/silent-command game.print('[" + instance + "] " + message + "')");
|
||||
this.messageInterface("/silent-command game.print('[" + data.instanceName + "] " + message + "')");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,6 +35,7 @@ module.exports = class remoteCommands {
|
||||
try{
|
||||
this.socket.emit("gameChat", {
|
||||
instanceID: this.config.unique.toString(),
|
||||
instanceName: this.config.name,
|
||||
data,
|
||||
});
|
||||
if(data.includes("[CHAT]") && data.includes("!info")){
|
||||
|
||||
Reference in new issue
Block a user