Files
factorio-clusterio/plugins/global_chat/control.js
T
Hornwitser fd307e58c2 Add global-chat shout command
Add command to broadcast a message to all instances from clusterctl.
2020-08-18 18:52:11 +02:00

29 lines
784 B
JavaScript

"use strict";
const plugin = require("lib/plugin");
const info = require("./info");
const command = require("lib/command");
const globalChatCommands = new command.CommandTree({ name: "global-chat", description: "Global Chat plugin commands" });
globalChatCommands.add(new command.Command({
definition: ["shout <message>", "Send message to all instances", (yargs) => {
yargs.positional("message", { describe: "message to send", type: "string" });
}],
handler: async function(args, control) {
await info.messages.chat.send(control, {
instance_name: "Console",
content: args.message,
});
},
}));
class ControlPlugin extends plugin.BaseControlPlugin {
async addCommands(rootCommand) {
rootCommand.add(globalChatCommands);
}
}
module.exports = {
ControlPlugin,
};