mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-22 00:13:12 +09:00
Add global-chat shout command
Add command to broadcast a message to all instances from clusterctl.
This commit is contained in:
1 parent
da1cbc16f7
commit
fd307e58c2
2 files changed
+30
-1
No files matched your search
@@ -0,0 +1,28 @@
|
|||||||
|
"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,
|
||||||
|
};
|
||||||
@@ -8,11 +8,12 @@ module.exports = {
|
|||||||
description: "Forwards chat between instances.",
|
description: "Forwards chat between instances.",
|
||||||
version: "2.0.0-alpha",
|
version: "2.0.0-alpha",
|
||||||
instanceEntrypoint: "instance",
|
instanceEntrypoint: "instance",
|
||||||
|
controlEntrypoint: "control",
|
||||||
|
|
||||||
messages: {
|
messages: {
|
||||||
chat: new link.Event({
|
chat: new link.Event({
|
||||||
type: "global_chat:chat",
|
type: "global_chat:chat",
|
||||||
links: ["instance-slave", "slave-master", "master-slave", "slave-instance"],
|
links: ["instance-slave", "slave-master", "master-slave", "slave-instance", "control-master"],
|
||||||
forwardTo: "master",
|
forwardTo: "master",
|
||||||
broadcastTo: "instance",
|
broadcastTo: "instance",
|
||||||
eventProperties: {
|
eventProperties: {
|
||||||
|
|||||||
Reference in new issue
Block a user