Files
factorio-clusterio/plugins/global_chat/control.js
T
Hornwitser bf5a4a8a9c Split up into multiple packages with Lerna
Split up codebase into the packages @clsterio/lib, @clusterio/master,
@clusterio/slave, and @clusterio/ctl using lerna to manage them.  This
will allow deployment to use only the parts needed reducing install
size, and better separate the code into shared library, master, slave
and control.
2020-09-21 18:00:07 +02:00

29 lines
806 B
JavaScript

"use strict";
const plugin = require("@clusterio/lib/plugin");
const info = require("./info");
const command = require("@clusterio/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,
};