discord_bridge_2.1 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +4 -9
- package/controller.js +18 -18
- package/dist/web/manifest.json +1 -1
- package/dist/web/static/discord_bridge-BqDrM65a.js +2 -0
- package/dist/web/static/discord_bridge-BqDrM65a.js.map +1 -0
- package/dist/web/static/{discord_bridge_2.1-i5H2dxwC.js → discord_bridge_2.1-BUF8XPP0.js} +1 -1
- package/dist/web/static/package-BQnGX2fn.js +2 -0
- package/dist/web/static/{package-Dp_yn2wZ.js.map → package-BQnGX2fn.js.map} +1 -1
- package/index.js +17 -17
- package/package.json +2 -1
- package/dist/web/static/discord_bridge-DSao3KFQ.js +0 -2
- package/dist/web/static/discord_bridge-DSao3KFQ.js.map +0 -1
- package/dist/web/static/package-Dp_yn2wZ.js +0 -2
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -9,21 +9,16 @@ Installation
|
|
|
9
9
|
This version targets Clusterio 2.1.x and Factorio 2.1.x. The instance must
|
|
10
10
|
allow script commands so the bridge can display Discord messages in game.
|
|
11
11
|
|
|
12
|
-
Build a package from this checkout with PowerShell:
|
|
13
|
-
|
|
14
|
-
Set-Location -LiteralPath W:\work\clusterio\discord_bridge
|
|
15
|
-
npm install
|
|
16
|
-
npm pack --dry-run
|
|
17
|
-
npm pack
|
|
18
|
-
|
|
19
12
|
From the Clusterio installation folder, install the generated archive and register the plugin:
|
|
20
13
|
|
|
21
|
-
npm install W:\work\clusterio\discord_bridge\discord_bridge_2.1-0.3.
|
|
14
|
+
npm install W:\work\clusterio\discord_bridge\discord_bridge_2.1-0.3.2.tgz
|
|
22
15
|
npx clusteriocontroller plugin add discord_bridge_2.1
|
|
23
16
|
|
|
17
|
+
When upgrading from 0.3.1 or earlier, run `npx clusteriocontroller plugin remove discord_bridge` in the Clusterio installation folder before installing this version. Reapply your existing bridge settings under the `discord_bridge_2.1.` prefix.
|
|
18
|
+
|
|
24
19
|
Repeat on dedicated hosts using `clusteriohost` in place of `clusteriocontroller`.
|
|
25
20
|
Restart the controller and hosts after installation.
|
|
26
21
|
|
|
27
|
-
Once installed you need to set the `
|
|
22
|
+
Once installed you need to set the `discord_bridge_2.1.bot_token` and `discord_bridge_2.1.channel_id` in the controller config to make the bridge operational.
|
|
28
23
|
|
|
29
24
|
Note that the Message Content Intent is required to be enabled in Discords developer dashboard for the bot.
|
package/controller.js
CHANGED
|
@@ -10,9 +10,9 @@ export class ControllerPlugin extends BaseControllerPlugin {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
async onControllerConfigFieldChanged(field) {
|
|
13
|
-
if (field === "
|
|
13
|
+
if (field === "discord_bridge_2.1.bot_token") {
|
|
14
14
|
await this.connect();
|
|
15
|
-
} else if (field === "
|
|
15
|
+
} else if (field === "discord_bridge_2.1.channel_id") {
|
|
16
16
|
await this.fetchChannel();
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -24,7 +24,7 @@ export class ControllerPlugin extends BaseControllerPlugin {
|
|
|
24
24
|
}
|
|
25
25
|
this.channel = null;
|
|
26
26
|
|
|
27
|
-
let token = this.controller.config.get("
|
|
27
|
+
let token = this.controller.config.get("discord_bridge_2.1.bot_token");
|
|
28
28
|
if (!token) {
|
|
29
29
|
this.logger.warn("Bot token not configured, bridge is offline");
|
|
30
30
|
return;
|
|
@@ -43,7 +43,7 @@ export class ControllerPlugin extends BaseControllerPlugin {
|
|
|
43
43
|
|
|
44
44
|
this.logger.info("Logging in to Discord");
|
|
45
45
|
try {
|
|
46
|
-
await this.client.login(this.controller.config.get("
|
|
46
|
+
await this.client.login(this.controller.config.get("discord_bridge_2.1.bot_token"));
|
|
47
47
|
} catch (err) {
|
|
48
48
|
this.logger.error(`Error logging in to Discord, bridge is offline:\n${err.stack}`);
|
|
49
49
|
this.client.destroy();
|
|
@@ -60,7 +60,7 @@ export class ControllerPlugin extends BaseControllerPlugin {
|
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
let id = this.controller.config.get("
|
|
63
|
+
let id = this.controller.config.get("discord_bridge_2.1.channel_id");
|
|
64
64
|
if (!id) {
|
|
65
65
|
this.logger.warn("Channel ID not configured, bridge is offline");
|
|
66
66
|
return
|
|
@@ -98,7 +98,7 @@ export class ControllerPlugin extends BaseControllerPlugin {
|
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
const template = this.controller.config.get("
|
|
101
|
+
const template = this.controller.config.get("discord_bridge_2.1.discord_template");
|
|
102
102
|
const content = template.replace(/(__display_name__|__username__|__content__)/g, (sub) => ({
|
|
103
103
|
"__display_name__": message.member.displayName,
|
|
104
104
|
"__username__": message.member.user.tag,
|
|
@@ -120,7 +120,7 @@ export class ControllerPlugin extends BaseControllerPlugin {
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
async onInstanceStatusChanged(instance, prev) {
|
|
123
|
-
if (!this.channel || !this.controller.config.get("
|
|
123
|
+
if (!this.channel || !this.controller.config.get("discord_bridge_2.1.notify_instance_status")) {
|
|
124
124
|
return;
|
|
125
125
|
}
|
|
126
126
|
|
|
@@ -128,8 +128,8 @@ export class ControllerPlugin extends BaseControllerPlugin {
|
|
|
128
128
|
const hostName = this.getHostName(instance.config.get("instance.assigned_host"));
|
|
129
129
|
|
|
130
130
|
const template =
|
|
131
|
-
this.controller.config.get("
|
|
132
|
-
?? this.controller.config.get("
|
|
131
|
+
this.controller.config.get("discord_bridge_2.1.instance_status_templates")[`${prev}:${instance.status}`]
|
|
132
|
+
?? this.controller.config.get("discord_bridge_2.1.instance_status_templates")[instance.status]
|
|
133
133
|
;
|
|
134
134
|
|
|
135
135
|
if (!template) {
|
|
@@ -140,12 +140,12 @@ export class ControllerPlugin extends BaseControllerPlugin {
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
onHostConnectionEvent(hostConnection, event) {
|
|
143
|
-
if (!this.channel || !this.controller.config.get("
|
|
143
|
+
if (!this.channel || !this.controller.config.get("discord_bridge_2.1.notify_host_connections")) {
|
|
144
144
|
return;
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
let hostName = this.controller.hosts.get(hostConnection.id).name;
|
|
148
|
-
const template = this.controller.config.get("
|
|
148
|
+
const template = this.controller.config.get("discord_bridge_2.1.host_templates")[event];
|
|
149
149
|
if (!template) {
|
|
150
150
|
return;
|
|
151
151
|
}
|
|
@@ -164,20 +164,20 @@ export class ControllerPlugin extends BaseControllerPlugin {
|
|
|
164
164
|
// WARNING COMMAND SHOUT CHAT COLOR JOIN LEAVE KICK BAN UNBANNED PROMOTE DEMOTE
|
|
165
165
|
let { instanceName, action, content } = request;
|
|
166
166
|
if (
|
|
167
|
-
["JOIN", "LEAVE"].includes(action) && this.controller.config.get("
|
|
168
|
-
|| action === "CHAT" && this.controller.config.get("
|
|
169
|
-
|| action === "SHOUT" && this.controller.config.get("
|
|
167
|
+
["JOIN", "LEAVE"].includes(action) && this.controller.config.get("discord_bridge_2.1.bridge_player_joins")
|
|
168
|
+
|| action === "CHAT" && this.controller.config.get("discord_bridge_2.1.bridge_player_chat")
|
|
169
|
+
|| action === "SHOUT" && this.controller.config.get("discord_bridge_2.1.bridge_player_shouts")
|
|
170
170
|
|| (
|
|
171
171
|
["KICK", "BAN", "UNBANNED"].includes(action)
|
|
172
|
-
&& this.controller.config.get("
|
|
172
|
+
&& this.controller.config.get("discord_bridge_2.1.bridge_player_kicks_and_bans")
|
|
173
173
|
)
|
|
174
|
-
|| action === "COMMAND" && this.controller.config.get("
|
|
174
|
+
|| action === "COMMAND" && this.controller.config.get("discord_bridge_2.1.bridge_player_commands")
|
|
175
175
|
|| (
|
|
176
176
|
["PROMOTE", "DEMOTE"].includes(action)
|
|
177
|
-
&& this.controller.config.get("
|
|
177
|
+
&& this.controller.config.get("discord_bridge_2.1.bridge_player_promotions")
|
|
178
178
|
)
|
|
179
179
|
) {
|
|
180
|
-
const template = this.controller.config.get("
|
|
180
|
+
const template = this.controller.config.get("discord_bridge_2.1.player_templates")[action];
|
|
181
181
|
if (!template) {
|
|
182
182
|
return;
|
|
183
183
|
}
|
package/dist/web/manifest.json
CHANGED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var InstanceActionEvent=class{static type=`event`;static src=`instance`;static dst=`controller`;static plugin=`discord_bridge_2.1`;constructor(e,t,n){this.instanceName=e,this.action=t,this.content=n}static jsonSchema={type:`object`,required:[`instanceName`,`action`,`content`],properties:{instanceName:{type:`string`},action:{type:`string`},content:{type:`string`}}};static fromJSON(e){return new this(e.instanceName,e.action,e.content)}},DiscordChatEvent=class{static type=`event`;static src=`controller`;static dst=`instance`;static plugin=`discord_bridge_2.1`;constructor(e){this.content=e}static jsonSchema={type:`object`,required:[`content`],properties:{content:{type:`string`}}};static fromJSON(e){return new this(e.content)}},e={name:`discord_bridge_2.1`,title:`Discord Bridge`,description:`Bridges chat between instances and Discord.`,instanceEntrypoint:`./instance.js`,controllerEntrypoint:`./controller.js`,controllerConfigFields:{"discord_bridge_2.1.bot_token":{title:`Bot Token`,description:`Bot token to log into Discord with.`,type:`string`,optional:!0},"discord_bridge_2.1.channel_id":{title:`Channel ID`,description:`Channel ID to bridge chat to.`,type:`string`,optional:!0},"discord_bridge_2.1.discord_template":{title:`Discord template`,description:`Template to use for sending chat messages from Discord in game. In the template the string __display_name__ is replaced with the display name of the user sending the message, __username__ is replaced with the username and __content__ with the message content.`,type:`string`,initialValue:`[Discord] __display_name__: __content__`},"discord_bridge_2.1.bridge_player_shouts":{title:`Bridge Player Shouts`,description:`Bridge shouts made with /shout to the Discord channel.`,type:`boolean`,initialValue:!0},"discord_bridge_2.1.bridge_player_chat":{title:`Bridge Player Chat`,description:`Bridge player chat to the Discord channel.`,type:`boolean`,initialValue:!0},"discord_bridge_2.1.bridge_player_commands":{title:`Bridge Player Commands`,description:`Bridge /command lua commands players execute to the Discord channel.`,type:`boolean`,initialValue:!1},"discord_bridge_2.1.bridge_player_joins":{title:`Bridge Player Joins`,description:`Bridge join and leave notifications to the Discord channel.`,type:`boolean`,initialValue:!0},"discord_bridge_2.1.bridge_player_kicks_and_bans":{title:`Bridge Player Kicks and Bans`,description:`Bridge kick and ban messages to the Discord channel.`,type:`boolean`,initialValue:!0},"discord_bridge_2.1.bridge_player_promotions":{title:`Bridge Player Promotions`,description:`Bridge admin promotion messages to the Discord channel.`,type:`boolean`,initialValue:!1},"discord_bridge_2.1.player_templates":{title:`Player templates`,description:`Template to use for sending bridged player action messages from Factorio. In the template the string __instance_name__ is replaced with the name of the instance the message originated from and __content__ is replaced with the content of the message. The available actions that can be bridged are COMMAND SHOUT CHAT JOIN LEAVE KICK BAN UNBANNED PROMOTE DEMOTE.`,type:`object`,initialValue:{COMMAND:`[__instance_name__] __content__`,SHOUT:`[__instance_name__] __content__`,CHAT:`[__instance_name__] __content__`,JOIN:`[__instance_name__] __content__`,LEAVE:`[__instance_name__] __content__`,KICK:`[__instance_name__] __content__`,BAN:`[__instance_name__] __content__`,UNBANNED:`[__instance_name__] __content__`,PROMOTE:`[__instance_name__] __content__`,DEMOTE:`[__instance_name__] __content__`}},"discord_bridge_2.1.notify_instance_status":{title:`Notify Instance Status`,description:`Notify of instance status changes to the Discord channel.`,type:`boolean`,initialValue:!0},"discord_bridge_2.1.instance_status_templates":{title:`Instance Status Templates`,description:`Template to use for sending notifications about instance status changes. In the template the string __instance_name__ and __host_name__ are replaced with the instance and host the change occured on. Templates specify previous:current status and the possible instance statuses are undefined unknown stopped starting running stopping creating_save exporting_data deleted`,type:`object`,initialValue:{"starting:running":`[__instance_name__] started`,"starting:stopped":`[__instance_name__] failed to start`,"running:stopped":`[__instance_name__] abruptly stopped`,"stopping:stopped":`[__instance_name__] stopped`,"undefined:unassigned":`[__instance_name__] was created`,deleted:`[__instance_name__] was deleted`}},"discord_bridge_2.1.notify_host_connections":{title:`Notify Host Connections`,description:`Notify of host connecting and disconnecting to the Discord channel.`,type:`boolean`,initialValue:!0},"discord_bridge_2.1.host_templates":{title:`Host templates`,description:`Template to use for sending notifications about host connection events. In the template the string __host_name__ is replaced with the name of the host the connection event occured from. The possible events that can happen are connect drop resume close.`,type:`object`,initialValue:{connect:`[__host_name__] connected`,drop:``,resume:``,close:`[__host_name__] disconnected`}}},features:[`ScriptCommands`],messages:[InstanceActionEvent,DiscordChatEvent]};export{DiscordChatEvent,InstanceActionEvent,e as plugin};
|
|
2
|
+
//# sourceMappingURL=discord_bridge-BqDrM65a.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discord_bridge-BqDrM65a.js","names":["instanceName","action","content","\"instanceName\"","\"action\"","\"content\"","json","plugin","\"COMMAND\"","\"SHOUT\"","\"CHAT\"","\"JOIN\"","\"LEAVE\"","\"KICK\"","\"BAN\"","\"UNBANNED\"","\"PROMOTE\"","\"DEMOTE\"","\"deleted\"","\"connect\"","\"drop\"","\"resume\"","\"close\""],"sources":["../../../index.js"],"sourcesContent":["export class InstanceActionEvent {\r\n\tstatic type = \"event\";\r\n\tstatic src = \"instance\";\r\n\tstatic dst = \"controller\";\r\n\tstatic plugin = \"discord_bridge_2.1\";\r\n\r\n\tconstructor(instanceName, action, content) {\r\n\t\tthis.instanceName = instanceName;\r\n\t\tthis.action = action;\r\n\t\tthis.content = content;\r\n\t}\r\n\r\n\tstatic jsonSchema = {\r\n\t\ttype: \"object\",\r\n\t\trequired: [\"instanceName\", \"action\", \"content\"],\r\n\t\tproperties: {\r\n\t\t\t\"instanceName\": { type: \"string\" },\r\n\t\t\t\"action\": { type: \"string\" },\r\n\t\t\t\"content\": { type: \"string\" },\r\n\t\t},\r\n\t};\r\n\r\n\tstatic fromJSON(json) {\r\n\t\treturn new this(json.instanceName, json.action, json.content);\r\n\t}\r\n}\r\n\r\nexport class DiscordChatEvent {\r\n\tstatic type = \"event\";\r\n\tstatic src = \"controller\";\r\n\tstatic dst = \"instance\";\r\n\tstatic plugin = \"discord_bridge_2.1\";\r\n\r\n\tconstructor(content) {\r\n\t\tthis.content = content;\r\n\t}\r\n\r\n\tstatic jsonSchema = {\r\n\t\ttype: \"object\",\r\n\t\trequired: [\"content\"],\r\n\t\tproperties: {\r\n\t\t\t\"content\": { type: \"string\" },\r\n\t\t},\r\n\t};\r\n\r\n\tstatic fromJSON(json) {\r\n\t\treturn new this(json.content);\r\n\t}\r\n}\r\n\r\nexport const plugin = {\r\n\tname: \"discord_bridge_2.1\",\r\n\ttitle: \"Discord Bridge\",\r\n\tdescription: \"Bridges chat between instances and Discord.\",\r\n\tinstanceEntrypoint: \"./instance.js\",\r\n\tcontrollerEntrypoint: \"./controller.js\",\r\n\tcontrollerConfigFields: {\r\n\t\t\"discord_bridge_2.1.bot_token\": {\r\n\t\t\ttitle: \"Bot Token\",\r\n\t\t\tdescription: \"Bot token to log into Discord with.\",\r\n\t\t\ttype: \"string\",\r\n\t\t\toptional: true,\r\n\t\t},\r\n\t\t\"discord_bridge_2.1.channel_id\": {\r\n\t\t\ttitle: \"Channel ID\",\r\n\t\t\tdescription: \"Channel ID to bridge chat to.\",\r\n\t\t\ttype: \"string\",\r\n\t\t\toptional: true,\r\n\t\t},\r\n\t\t\"discord_bridge_2.1.discord_template\": {\r\n\t\t\ttitle: \"Discord template\",\r\n\t\t\tdescription:\r\n\t\t\t\t\"Template to use for sending chat messages from Discord in game. In the template the string \" +\r\n\t\t\t\t\"__display_name__ is replaced with the display name of the user sending the message, \" +\r\n\t\t\t\t\"__username__ is replaced with the username and __content__ with the message content.\",\r\n\t\t\ttype: \"string\",\r\n\t\t\tinitialValue: \"[Discord] __display_name__: __content__\",\r\n\t\t},\r\n\t\t\"discord_bridge_2.1.bridge_player_shouts\": {\r\n\t\t\ttitle: \"Bridge Player Shouts\",\r\n\t\t\tdescription: \"Bridge shouts made with /shout to the Discord channel.\",\r\n\t\t\ttype: \"boolean\",\r\n\t\t\tinitialValue: true,\r\n\t\t},\r\n\t\t\"discord_bridge_2.1.bridge_player_chat\": {\r\n\t\t\ttitle: \"Bridge Player Chat\",\r\n\t\t\tdescription: \"Bridge player chat to the Discord channel.\",\r\n\t\t\ttype: \"boolean\",\r\n\t\t\tinitialValue: true,\r\n\t\t},\r\n\t\t\"discord_bridge_2.1.bridge_player_commands\": {\r\n\t\t\ttitle: \"Bridge Player Commands\",\r\n\t\t\tdescription: \"Bridge /command lua commands players execute to the Discord channel.\",\r\n\t\t\ttype: \"boolean\",\r\n\t\t\tinitialValue: false,\r\n\t\t},\r\n\t\t\"discord_bridge_2.1.bridge_player_joins\": {\r\n\t\t\ttitle: \"Bridge Player Joins\",\r\n\t\t\tdescription: \"Bridge join and leave notifications to the Discord channel.\",\r\n\t\t\ttype: \"boolean\",\r\n\t\t\tinitialValue: true,\r\n\t\t},\r\n\t\t\"discord_bridge_2.1.bridge_player_kicks_and_bans\": {\r\n\t\t\ttitle: \"Bridge Player Kicks and Bans\",\r\n\t\t\tdescription: \"Bridge kick and ban messages to the Discord channel.\",\r\n\t\t\ttype: \"boolean\",\r\n\t\t\tinitialValue: true,\r\n\t\t},\r\n\t\t\"discord_bridge_2.1.bridge_player_promotions\": {\r\n\t\t\ttitle: \"Bridge Player Promotions\",\r\n\t\t\tdescription: \"Bridge admin promotion messages to the Discord channel.\",\r\n\t\t\ttype: \"boolean\",\r\n\t\t\tinitialValue: false,\r\n\t\t},\r\n\t\t\"discord_bridge_2.1.player_templates\": {\r\n\t\t\ttitle: \"Player templates\",\r\n\t\t\tdescription:\r\n\t\t\t\t\"Template to use for sending bridged player action messages from Factorio. In the template the \" +\r\n\t\t\t\t\"string __instance_name__ is replaced with the name of the instance the message originated from \" +\r\n\t\t\t\t\"and __content__ is replaced with the content of the message. The available actions that can be \" +\r\n\t\t\t\t\"bridged are COMMAND SHOUT CHAT JOIN LEAVE KICK BAN UNBANNED PROMOTE DEMOTE.\",\r\n\t\t\ttype: \"object\",\r\n\t\t\tinitialValue: {\r\n\t\t\t\t\"COMMAND\": \"[__instance_name__] __content__\",\r\n\t\t\t\t\"SHOUT\": \"[__instance_name__] __content__\",\r\n\t\t\t\t\"CHAT\": \"[__instance_name__] __content__\",\r\n\t\t\t\t\"JOIN\": \"[__instance_name__] __content__\",\r\n\t\t\t\t\"LEAVE\": \"[__instance_name__] __content__\",\r\n\t\t\t\t\"KICK\": \"[__instance_name__] __content__\",\r\n\t\t\t\t\"BAN\": \"[__instance_name__] __content__\",\r\n\t\t\t\t\"UNBANNED\": \"[__instance_name__] __content__\",\r\n\t\t\t\t\"PROMOTE\": \"[__instance_name__] __content__\",\r\n\t\t\t\t\"DEMOTE\": \"[__instance_name__] __content__\",\r\n\t\t\t},\r\n\t\t},\r\n\t\t\"discord_bridge_2.1.notify_instance_status\": {\r\n\t\t\ttitle: \"Notify Instance Status\",\r\n\t\t\tdescription: \"Notify of instance status changes to the Discord channel.\",\r\n\t\t\ttype: \"boolean\",\r\n\t\t\tinitialValue: true,\r\n\t\t},\r\n\t\t\"discord_bridge_2.1.instance_status_templates\": {\r\n\t\t\ttitle: \"Instance Status Templates\",\r\n\t\t\tdescription:\r\n\t\t\t\t\"Template to use for sending notifications about instance status changes. In the template the \" +\r\n\t\t\t\t\"string __instance_name__ and __host_name__ are replaced with the instance and host the change \" +\r\n\t\t\t\t\"occured on. Templates specify previous:current status and the possible instance statuses are \" +\r\n\t\t\t\t\"undefined unknown stopped starting running stopping creating_save exporting_data deleted\",\r\n\t\t\ttype: \"object\",\r\n\t\t\tinitialValue: {\r\n\t\t\t\t\"starting:running\": \"[__instance_name__] started\",\r\n\t\t\t\t\"starting:stopped\": \"[__instance_name__] failed to start\",\r\n\t\t\t\t\"running:stopped\": \"[__instance_name__] abruptly stopped\",\r\n\t\t\t\t\"stopping:stopped\": \"[__instance_name__] stopped\",\r\n\t\t\t\t\"undefined:unassigned\": \"[__instance_name__] was created\",\r\n\t\t\t\t\"deleted\": \"[__instance_name__] was deleted\",\r\n\t\t\t},\r\n\t\t},\r\n\t\t\"discord_bridge_2.1.notify_host_connections\": {\r\n\t\t\ttitle: \"Notify Host Connections\",\r\n\t\t\tdescription: \"Notify of host connecting and disconnecting to the Discord channel.\",\r\n\t\t\ttype: \"boolean\",\r\n\t\t\tinitialValue: true,\r\n\t\t},\r\n\t\t\"discord_bridge_2.1.host_templates\": {\r\n\t\t\ttitle: \"Host templates\",\r\n\t\t\tdescription:\r\n\t\t\t\t\"Template to use for sending notifications about host connection events. In the template the \" +\r\n\t\t\t\t\"string __host_name__ is replaced with the name of the host the connection event occured from. \" +\r\n\t\t\t\t\"The possible events that can happen are connect drop resume close.\",\r\n\t\t\ttype: \"object\",\r\n\t\t\tinitialValue: {\r\n\t\t\t\t\"connect\": \"[__host_name__] connected\",\r\n\t\t\t\t\"drop\": \"\",\r\n\t\t\t\t\"resume\": \"\",\r\n\t\t\t\t\"close\": \"[__host_name__] disconnected\",\r\n\t\t\t},\r\n\t\t},\r\n\t},\r\n\r\n\tfeatures: [\"ScriptCommands\"],\n\n\tmessages: [\r\n\t\tInstanceActionEvent,\r\n\t\tDiscordChatEvent,\r\n\t],\r\n};\r\n"],"mappings":"AAAA,IAAa,oBAAb,KAAiC,CAChC,OAAO,KAAO,QACd,OAAO,IAAM,WACb,OAAO,IAAM,aACb,OAAO,OAAS,qBAEhB,YAAY,EAAc,EAAQ,EAAS,CAC1C,KAAK,aAAeA,EACpB,KAAK,OAASC,EACd,KAAK,QAAUC,CAChB,CAEA,OAAO,WAAa,CACnB,KAAM,SACN,SAAU,CAAC,eAAgB,SAAU,SAAS,EAC9C,WAAY,CACXC,aAAgB,CAAE,KAAM,QAAS,EACjCC,OAAU,CAAE,KAAM,QAAS,EAC3BC,QAAW,CAAE,KAAM,QAAS,CAC7B,CACD,EAEA,OAAO,SAAS,EAAM,CACrB,OAAO,IAAI,KAAKC,EAAK,aAAcA,EAAK,OAAQA,EAAK,OAAO,CAC7D,CACD,EAEa,iBAAb,KAA8B,CAC7B,OAAO,KAAO,QACd,OAAO,IAAM,aACb,OAAO,IAAM,WACb,OAAO,OAAS,qBAEhB,YAAY,EAAS,CACpB,KAAK,QAAUJ,CAChB,CAEA,OAAO,WAAa,CACnB,KAAM,SACN,SAAU,CAAC,SAAS,EACpB,WAAY,CACXG,QAAW,CAAE,KAAM,QAAS,CAC7B,CACD,EAEA,OAAO,SAAS,EAAM,CACrB,OAAO,IAAI,KAAKC,EAAK,OAAO,CAC7B,CACD,EAEaC,EAAS,CACrB,KAAM,qBACN,MAAO,iBACP,YAAa,8CACb,mBAAoB,gBACpB,qBAAsB,kBACtB,uBAAwB,CACvB,+BAAgC,CAC/B,MAAO,YACP,YAAa,sCACb,KAAM,SACN,SAAU,EACX,EACA,gCAAiC,CAChC,MAAO,aACP,YAAa,gCACb,KAAM,SACN,SAAU,EACX,EACA,sCAAuC,CACtC,MAAO,mBACP,YACC,sQAGD,KAAM,SACN,aAAc,yCACf,EACA,0CAA2C,CAC1C,MAAO,uBACP,YAAa,yDACb,KAAM,UACN,aAAc,EACf,EACA,wCAAyC,CACxC,MAAO,qBACP,YAAa,6CACb,KAAM,UACN,aAAc,EACf,EACA,4CAA6C,CAC5C,MAAO,yBACP,YAAa,uEACb,KAAM,UACN,aAAc,EACf,EACA,yCAA0C,CACzC,MAAO,sBACP,YAAa,8DACb,KAAM,UACN,aAAc,EACf,EACA,kDAAmD,CAClD,MAAO,+BACP,YAAa,uDACb,KAAM,UACN,aAAc,EACf,EACA,8CAA+C,CAC9C,MAAO,2BACP,YAAa,0DACb,KAAM,UACN,aAAc,EACf,EACA,sCAAuC,CACtC,MAAO,mBACP,YACC,0WAID,KAAM,SACN,aAAc,CACbC,QAAW,kCACXC,MAAS,kCACTC,KAAQ,kCACRC,KAAQ,kCACRC,MAAS,kCACTC,KAAQ,kCACRC,IAAO,kCACPC,SAAY,kCACZC,QAAW,kCACXC,OAAU,iCACX,CACD,EACA,4CAA6C,CAC5C,MAAO,yBACP,YAAa,4DACb,KAAM,UACN,aAAc,EACf,EACA,+CAAgD,CAC/C,MAAO,4BACP,YACC,mXAID,KAAM,SACN,aAAc,CACb,mBAAoB,8BACpB,mBAAoB,sCACpB,kBAAmB,uCACnB,mBAAoB,8BACpB,uBAAwB,kCACxBC,QAAW,iCACZ,CACD,EACA,6CAA8C,CAC7C,MAAO,0BACP,YAAa,sEACb,KAAM,UACN,aAAc,EACf,EACA,oCAAqC,CACpC,MAAO,iBACP,YACC,+PAGD,KAAM,SACN,aAAc,CACbC,QAAW,4BACXC,KAAQ,GACRC,OAAU,GACVC,MAAS,8BACV,CACD,CACD,EAEA,SAAU,CAAC,gBAAgB,EAE3B,SAAU,CACT,oBACA,gBACD,CACD,E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=function(e,t){return new URL(e,t).href},t={},n=function(e){return e.pathname.endsWith(`.css`)},r=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},i=function(i,a,o){let s=Promise.resolve();if(a&&a.length>0){let i,c=document.querySelector(`meta[property=csp-nonce]`),l=c?.nonce||c?.getAttribute(`nonce`);function u(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function d(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}s=u(a.map(a=>{a=e(a,o);let s=d(a),c=n(s);return r(t,s.href,()=>{if(i===void 0){i={all:new Set,styles:new Set};let e=document.getElementsByTagName(`link`);for(let t=e.length-1;t>=0;t--){let n=e[t];i.all.add(n.href),n.rel===`stylesheet`&&i.styles.add(n.href)}}if((c?i.styles:i.all).has(s.href))return;let e=document.createElement(`link`);if(e.rel=c?`stylesheet`:`modulepreload`,c||(e.as=`script`),e.crossOrigin=``,e.href=s.href,l&&e.setAttribute(`nonce`,l),document.head.appendChild(e),c)return new Promise((t,n)=>{let r=i=>{e.removeEventListener(`load`,r),e.removeEventListener(`error`,r),i.type===`error`?n(Error(`Unable to preload CSS for ${s}`)):t(i)};e.addEventListener(`load`,r),e.addEventListener(`error`,r)})})}).filter(e=>e!==void 0))}function c(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return s.then(e=>{for(let t of e||[])t.status===`rejected`&&c(t.reason);return i().catch(c)})},a={"./":()=>i(()=>import(`./discord_bridge-
|
|
1
|
+
var e=function(e,t){return new URL(e,t).href},t={},n=function(e){return e.pathname.endsWith(`.css`)},r=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},i=function(i,a,o){let s=Promise.resolve();if(a&&a.length>0){let i,c=document.querySelector(`meta[property=csp-nonce]`),l=c?.nonce||c?.getAttribute(`nonce`);function u(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function d(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}s=u(a.map(a=>{a=e(a,o);let s=d(a),c=n(s);return r(t,s.href,()=>{if(i===void 0){i={all:new Set,styles:new Set};let e=document.getElementsByTagName(`link`);for(let t=e.length-1;t>=0;t--){let n=e[t];i.all.add(n.href),n.rel===`stylesheet`&&i.styles.add(n.href)}}if((c?i.styles:i.all).has(s.href))return;let e=document.createElement(`link`);if(e.rel=c?`stylesheet`:`modulepreload`,c||(e.as=`script`),e.crossOrigin=``,e.href=s.href,l&&e.setAttribute(`nonce`,l),document.head.appendChild(e),c)return new Promise((t,n)=>{let r=i=>{e.removeEventListener(`load`,r),e.removeEventListener(`error`,r),i.type===`error`?n(Error(`Unable to preload CSS for ${s}`)):t(i)};e.addEventListener(`load`,r),e.addEventListener(`error`,r)})})}).filter(e=>e!==void 0))}function c(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return s.then(e=>{for(let t of e||[])t.status===`rejected`&&c(t.reason);return i().catch(c)})},a={"./":()=>i(()=>import(`./discord_bridge-BqDrM65a.js`),[],import.meta.url),"./package.json":()=>i(()=>import(`./package-BQnGX2fn.js`),[],import.meta.url),"./web":()=>i(()=>import(`./web-BvRk9kiK.js`),[],import.meta.url)};async function o(e){if(!Object.hasOwn(a,e))throw Error(`Module `+e+` is not exposed by this plugin`);return await a[e]()}export{o as get};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e=`discord_bridge_2.1`,t=`0.3.2`,n=`Clusterio plugin bridging chat between instances and Discord`,r=`index.js`,i={test:`npm pack --dry-run`,prepare:`vite build`},a={type:`git`,url:`git+https://github.com/Hornwitser/discord_bridge.git`},o=[`clusterio`,`clusterio-plugin`,`factorio`,`discord`],s=`Hornwitser <github@hornwitser.no>`,c=`MIT`,l={url:`https://github.com/Hornwitser/discord_bridge/issues`},u=`https://github.com/Hornwitser/discord_bridge#readme`,d={"@clusterio/controller":`~2.1.0`,"@clusterio/lib":`~2.1.0`},f={"@clusterio/controller":`~2.1.0`,"@clusterio/lib":`~2.1.0`,"@clusterio/web_ui":`~2.1.0`,vite:`^8.3.4`},p={"discord.js":`^14.14.1`},m={access:`public`},h=`module`,g={node:`^22.18.0 || >=24.2.0`},_={"@clusterio/controller":{optional:!0}},v={name:e,version:t,description:n,main:r,scripts:i,repository:a,keywords:o,author:s,license:`MIT`,bugs:l,homepage:u,peerDependencies:d,devDependencies:f,dependencies:p,publishConfig:m,type:h,engines:g,peerDependenciesMeta:_};export{s as author,l as bugs,v as default,p as dependencies,n as description,f as devDependencies,g as engines,u as homepage,o as keywords,c as license,r as main,e as name,d as peerDependencies,_ as peerDependenciesMeta,m as publishConfig,a as repository,i as scripts,h as type,t as version};
|
|
2
|
+
//# sourceMappingURL=package-BQnGX2fn.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-
|
|
1
|
+
{"version":3,"file":"package-BQnGX2fn.js","names":["name","version","description","main","scripts","\"test\"","\"prepare\"","repository","\"type\"","\"url\"","keywords","author","license","bugs","homepage","peerDependencies","devDependencies","\"vite\"","dependencies","publishConfig","\"access\"","type","engines","\"node\"","peerDependenciesMeta","\"optional\"","package_default"],"sources":[],"mappings":""}
|
package/index.js
CHANGED
|
@@ -2,7 +2,7 @@ export class InstanceActionEvent {
|
|
|
2
2
|
static type = "event";
|
|
3
3
|
static src = "instance";
|
|
4
4
|
static dst = "controller";
|
|
5
|
-
static plugin = "
|
|
5
|
+
static plugin = "discord_bridge_2.1";
|
|
6
6
|
|
|
7
7
|
constructor(instanceName, action, content) {
|
|
8
8
|
this.instanceName = instanceName;
|
|
@@ -29,7 +29,7 @@ export class DiscordChatEvent {
|
|
|
29
29
|
static type = "event";
|
|
30
30
|
static src = "controller";
|
|
31
31
|
static dst = "instance";
|
|
32
|
-
static plugin = "
|
|
32
|
+
static plugin = "discord_bridge_2.1";
|
|
33
33
|
|
|
34
34
|
constructor(content) {
|
|
35
35
|
this.content = content;
|
|
@@ -49,25 +49,25 @@ export class DiscordChatEvent {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
export const plugin = {
|
|
52
|
-
name: "
|
|
52
|
+
name: "discord_bridge_2.1",
|
|
53
53
|
title: "Discord Bridge",
|
|
54
54
|
description: "Bridges chat between instances and Discord.",
|
|
55
55
|
instanceEntrypoint: "./instance.js",
|
|
56
56
|
controllerEntrypoint: "./controller.js",
|
|
57
57
|
controllerConfigFields: {
|
|
58
|
-
"
|
|
58
|
+
"discord_bridge_2.1.bot_token": {
|
|
59
59
|
title: "Bot Token",
|
|
60
60
|
description: "Bot token to log into Discord with.",
|
|
61
61
|
type: "string",
|
|
62
62
|
optional: true,
|
|
63
63
|
},
|
|
64
|
-
"
|
|
64
|
+
"discord_bridge_2.1.channel_id": {
|
|
65
65
|
title: "Channel ID",
|
|
66
66
|
description: "Channel ID to bridge chat to.",
|
|
67
67
|
type: "string",
|
|
68
68
|
optional: true,
|
|
69
69
|
},
|
|
70
|
-
"
|
|
70
|
+
"discord_bridge_2.1.discord_template": {
|
|
71
71
|
title: "Discord template",
|
|
72
72
|
description:
|
|
73
73
|
"Template to use for sending chat messages from Discord in game. In the template the string " +
|
|
@@ -76,43 +76,43 @@ export const plugin = {
|
|
|
76
76
|
type: "string",
|
|
77
77
|
initialValue: "[Discord] __display_name__: __content__",
|
|
78
78
|
},
|
|
79
|
-
"
|
|
79
|
+
"discord_bridge_2.1.bridge_player_shouts": {
|
|
80
80
|
title: "Bridge Player Shouts",
|
|
81
81
|
description: "Bridge shouts made with /shout to the Discord channel.",
|
|
82
82
|
type: "boolean",
|
|
83
83
|
initialValue: true,
|
|
84
84
|
},
|
|
85
|
-
"
|
|
85
|
+
"discord_bridge_2.1.bridge_player_chat": {
|
|
86
86
|
title: "Bridge Player Chat",
|
|
87
87
|
description: "Bridge player chat to the Discord channel.",
|
|
88
88
|
type: "boolean",
|
|
89
89
|
initialValue: true,
|
|
90
90
|
},
|
|
91
|
-
"
|
|
91
|
+
"discord_bridge_2.1.bridge_player_commands": {
|
|
92
92
|
title: "Bridge Player Commands",
|
|
93
93
|
description: "Bridge /command lua commands players execute to the Discord channel.",
|
|
94
94
|
type: "boolean",
|
|
95
95
|
initialValue: false,
|
|
96
96
|
},
|
|
97
|
-
"
|
|
97
|
+
"discord_bridge_2.1.bridge_player_joins": {
|
|
98
98
|
title: "Bridge Player Joins",
|
|
99
99
|
description: "Bridge join and leave notifications to the Discord channel.",
|
|
100
100
|
type: "boolean",
|
|
101
101
|
initialValue: true,
|
|
102
102
|
},
|
|
103
|
-
"
|
|
103
|
+
"discord_bridge_2.1.bridge_player_kicks_and_bans": {
|
|
104
104
|
title: "Bridge Player Kicks and Bans",
|
|
105
105
|
description: "Bridge kick and ban messages to the Discord channel.",
|
|
106
106
|
type: "boolean",
|
|
107
107
|
initialValue: true,
|
|
108
108
|
},
|
|
109
|
-
"
|
|
109
|
+
"discord_bridge_2.1.bridge_player_promotions": {
|
|
110
110
|
title: "Bridge Player Promotions",
|
|
111
111
|
description: "Bridge admin promotion messages to the Discord channel.",
|
|
112
112
|
type: "boolean",
|
|
113
113
|
initialValue: false,
|
|
114
114
|
},
|
|
115
|
-
"
|
|
115
|
+
"discord_bridge_2.1.player_templates": {
|
|
116
116
|
title: "Player templates",
|
|
117
117
|
description:
|
|
118
118
|
"Template to use for sending bridged player action messages from Factorio. In the template the " +
|
|
@@ -133,13 +133,13 @@ export const plugin = {
|
|
|
133
133
|
"DEMOTE": "[__instance_name__] __content__",
|
|
134
134
|
},
|
|
135
135
|
},
|
|
136
|
-
"
|
|
136
|
+
"discord_bridge_2.1.notify_instance_status": {
|
|
137
137
|
title: "Notify Instance Status",
|
|
138
138
|
description: "Notify of instance status changes to the Discord channel.",
|
|
139
139
|
type: "boolean",
|
|
140
140
|
initialValue: true,
|
|
141
141
|
},
|
|
142
|
-
"
|
|
142
|
+
"discord_bridge_2.1.instance_status_templates": {
|
|
143
143
|
title: "Instance Status Templates",
|
|
144
144
|
description:
|
|
145
145
|
"Template to use for sending notifications about instance status changes. In the template the " +
|
|
@@ -156,13 +156,13 @@ export const plugin = {
|
|
|
156
156
|
"deleted": "[__instance_name__] was deleted",
|
|
157
157
|
},
|
|
158
158
|
},
|
|
159
|
-
"
|
|
159
|
+
"discord_bridge_2.1.notify_host_connections": {
|
|
160
160
|
title: "Notify Host Connections",
|
|
161
161
|
description: "Notify of host connecting and disconnecting to the Discord channel.",
|
|
162
162
|
type: "boolean",
|
|
163
163
|
initialValue: true,
|
|
164
164
|
},
|
|
165
|
-
"
|
|
165
|
+
"discord_bridge_2.1.host_templates": {
|
|
166
166
|
title: "Host templates",
|
|
167
167
|
description:
|
|
168
168
|
"Template to use for sending notifications about host connection events. In the template the " +
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "discord_bridge_2.1",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Clusterio plugin bridging chat between instances and Discord",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"keywords": [
|
|
15
15
|
"clusterio",
|
|
16
|
+
"clusterio-plugin",
|
|
16
17
|
"factorio",
|
|
17
18
|
"discord"
|
|
18
19
|
],
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var InstanceActionEvent=class{static type=`event`;static src=`instance`;static dst=`controller`;static plugin=`discord_bridge`;constructor(e,t,n){this.instanceName=e,this.action=t,this.content=n}static jsonSchema={type:`object`,required:[`instanceName`,`action`,`content`],properties:{instanceName:{type:`string`},action:{type:`string`},content:{type:`string`}}};static fromJSON(e){return new this(e.instanceName,e.action,e.content)}},DiscordChatEvent=class{static type=`event`;static src=`controller`;static dst=`instance`;static plugin=`discord_bridge`;constructor(e){this.content=e}static jsonSchema={type:`object`,required:[`content`],properties:{content:{type:`string`}}};static fromJSON(e){return new this(e.content)}},e={name:`discord_bridge`,title:`Discord Bridge`,description:`Bridges chat between instances and Discord.`,instanceEntrypoint:`./instance.js`,controllerEntrypoint:`./controller.js`,controllerConfigFields:{"discord_bridge.bot_token":{title:`Bot Token`,description:`Bot token to log into Discord with.`,type:`string`,optional:!0},"discord_bridge.channel_id":{title:`Channel ID`,description:`Channel ID to bridge chat to.`,type:`string`,optional:!0},"discord_bridge.discord_template":{title:`Discord template`,description:`Template to use for sending chat messages from Discord in game. In the template the string __display_name__ is replaced with the display name of the user sending the message, __username__ is replaced with the username and __content__ with the message content.`,type:`string`,initialValue:`[Discord] __display_name__: __content__`},"discord_bridge.bridge_player_shouts":{title:`Bridge Player Shouts`,description:`Bridge shouts made with /shout to the Discord channel.`,type:`boolean`,initialValue:!0},"discord_bridge.bridge_player_chat":{title:`Bridge Player Chat`,description:`Bridge player chat to the Discord channel.`,type:`boolean`,initialValue:!0},"discord_bridge.bridge_player_commands":{title:`Bridge Player Commands`,description:`Bridge /command lua commands players execute to the Discord channel.`,type:`boolean`,initialValue:!1},"discord_bridge.bridge_player_joins":{title:`Bridge Player Joins`,description:`Bridge join and leave notifications to the Discord channel.`,type:`boolean`,initialValue:!0},"discord_bridge.bridge_player_kicks_and_bans":{title:`Bridge Player Kicks and Bans`,description:`Bridge kick and ban messages to the Discord channel.`,type:`boolean`,initialValue:!0},"discord_bridge.bridge_player_promotions":{title:`Bridge Player Promotions`,description:`Bridge admin promotion messages to the Discord channel.`,type:`boolean`,initialValue:!1},"discord_bridge.player_templates":{title:`Player templates`,description:`Template to use for sending bridged player action messages from Factorio. In the template the string __instance_name__ is replaced with the name of the instance the message originated from and __content__ is replaced with the content of the message. The available actions that can be bridged are COMMAND SHOUT CHAT JOIN LEAVE KICK BAN UNBANNED PROMOTE DEMOTE.`,type:`object`,initialValue:{COMMAND:`[__instance_name__] __content__`,SHOUT:`[__instance_name__] __content__`,CHAT:`[__instance_name__] __content__`,JOIN:`[__instance_name__] __content__`,LEAVE:`[__instance_name__] __content__`,KICK:`[__instance_name__] __content__`,BAN:`[__instance_name__] __content__`,UNBANNED:`[__instance_name__] __content__`,PROMOTE:`[__instance_name__] __content__`,DEMOTE:`[__instance_name__] __content__`}},"discord_bridge.notify_instance_status":{title:`Notify Instance Status`,description:`Notify of instance status changes to the Discord channel.`,type:`boolean`,initialValue:!0},"discord_bridge.instance_status_templates":{title:`Instance Status Templates`,description:`Template to use for sending notifications about instance status changes. In the template the string __instance_name__ and __host_name__ are replaced with the instance and host the change occured on. Templates specify previous:current status and the possible instance statuses are undefined unknown stopped starting running stopping creating_save exporting_data deleted`,type:`object`,initialValue:{"starting:running":`[__instance_name__] started`,"starting:stopped":`[__instance_name__] failed to start`,"running:stopped":`[__instance_name__] abruptly stopped`,"stopping:stopped":`[__instance_name__] stopped`,"undefined:unassigned":`[__instance_name__] was created`,deleted:`[__instance_name__] was deleted`}},"discord_bridge.notify_host_connections":{title:`Notify Host Connections`,description:`Notify of host connecting and disconnecting to the Discord channel.`,type:`boolean`,initialValue:!0},"discord_bridge.host_templates":{title:`Host templates`,description:`Template to use for sending notifications about host connection events. In the template the string __host_name__ is replaced with the name of the host the connection event occured from. The possible events that can happen are connect drop resume close.`,type:`object`,initialValue:{connect:`[__host_name__] connected`,drop:``,resume:``,close:`[__host_name__] disconnected`}}},features:[`ScriptCommands`],messages:[InstanceActionEvent,DiscordChatEvent]};export{DiscordChatEvent,InstanceActionEvent,e as plugin};
|
|
2
|
-
//# sourceMappingURL=discord_bridge-DSao3KFQ.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"discord_bridge-DSao3KFQ.js","names":["instanceName","action","content","\"instanceName\"","\"action\"","\"content\"","json","plugin","\"COMMAND\"","\"SHOUT\"","\"CHAT\"","\"JOIN\"","\"LEAVE\"","\"KICK\"","\"BAN\"","\"UNBANNED\"","\"PROMOTE\"","\"DEMOTE\"","\"deleted\"","\"connect\"","\"drop\"","\"resume\"","\"close\""],"sources":["../../../index.js"],"sourcesContent":["export class InstanceActionEvent {\r\n\tstatic type = \"event\";\r\n\tstatic src = \"instance\";\r\n\tstatic dst = \"controller\";\r\n\tstatic plugin = \"discord_bridge\";\r\n\r\n\tconstructor(instanceName, action, content) {\r\n\t\tthis.instanceName = instanceName;\r\n\t\tthis.action = action;\r\n\t\tthis.content = content;\r\n\t}\r\n\r\n\tstatic jsonSchema = {\r\n\t\ttype: \"object\",\r\n\t\trequired: [\"instanceName\", \"action\", \"content\"],\r\n\t\tproperties: {\r\n\t\t\t\"instanceName\": { type: \"string\" },\r\n\t\t\t\"action\": { type: \"string\" },\r\n\t\t\t\"content\": { type: \"string\" },\r\n\t\t},\r\n\t};\r\n\r\n\tstatic fromJSON(json) {\r\n\t\treturn new this(json.instanceName, json.action, json.content);\r\n\t}\r\n}\r\n\r\nexport class DiscordChatEvent {\r\n\tstatic type = \"event\";\r\n\tstatic src = \"controller\";\r\n\tstatic dst = \"instance\";\r\n\tstatic plugin = \"discord_bridge\";\r\n\r\n\tconstructor(content) {\r\n\t\tthis.content = content;\r\n\t}\r\n\r\n\tstatic jsonSchema = {\r\n\t\ttype: \"object\",\r\n\t\trequired: [\"content\"],\r\n\t\tproperties: {\r\n\t\t\t\"content\": { type: \"string\" },\r\n\t\t},\r\n\t};\r\n\r\n\tstatic fromJSON(json) {\r\n\t\treturn new this(json.content);\r\n\t}\r\n}\r\n\r\nexport const plugin = {\r\n\tname: \"discord_bridge\",\r\n\ttitle: \"Discord Bridge\",\r\n\tdescription: \"Bridges chat between instances and Discord.\",\r\n\tinstanceEntrypoint: \"./instance.js\",\r\n\tcontrollerEntrypoint: \"./controller.js\",\r\n\tcontrollerConfigFields: {\r\n\t\t\"discord_bridge.bot_token\": {\r\n\t\t\ttitle: \"Bot Token\",\r\n\t\t\tdescription: \"Bot token to log into Discord with.\",\r\n\t\t\ttype: \"string\",\r\n\t\t\toptional: true,\r\n\t\t},\r\n\t\t\"discord_bridge.channel_id\": {\r\n\t\t\ttitle: \"Channel ID\",\r\n\t\t\tdescription: \"Channel ID to bridge chat to.\",\r\n\t\t\ttype: \"string\",\r\n\t\t\toptional: true,\r\n\t\t},\r\n\t\t\"discord_bridge.discord_template\": {\r\n\t\t\ttitle: \"Discord template\",\r\n\t\t\tdescription:\r\n\t\t\t\t\"Template to use for sending chat messages from Discord in game. In the template the string \" +\r\n\t\t\t\t\"__display_name__ is replaced with the display name of the user sending the message, \" +\r\n\t\t\t\t\"__username__ is replaced with the username and __content__ with the message content.\",\r\n\t\t\ttype: \"string\",\r\n\t\t\tinitialValue: \"[Discord] __display_name__: __content__\",\r\n\t\t},\r\n\t\t\"discord_bridge.bridge_player_shouts\": {\r\n\t\t\ttitle: \"Bridge Player Shouts\",\r\n\t\t\tdescription: \"Bridge shouts made with /shout to the Discord channel.\",\r\n\t\t\ttype: \"boolean\",\r\n\t\t\tinitialValue: true,\r\n\t\t},\r\n\t\t\"discord_bridge.bridge_player_chat\": {\r\n\t\t\ttitle: \"Bridge Player Chat\",\r\n\t\t\tdescription: \"Bridge player chat to the Discord channel.\",\r\n\t\t\ttype: \"boolean\",\r\n\t\t\tinitialValue: true,\r\n\t\t},\r\n\t\t\"discord_bridge.bridge_player_commands\": {\r\n\t\t\ttitle: \"Bridge Player Commands\",\r\n\t\t\tdescription: \"Bridge /command lua commands players execute to the Discord channel.\",\r\n\t\t\ttype: \"boolean\",\r\n\t\t\tinitialValue: false,\r\n\t\t},\r\n\t\t\"discord_bridge.bridge_player_joins\": {\r\n\t\t\ttitle: \"Bridge Player Joins\",\r\n\t\t\tdescription: \"Bridge join and leave notifications to the Discord channel.\",\r\n\t\t\ttype: \"boolean\",\r\n\t\t\tinitialValue: true,\r\n\t\t},\r\n\t\t\"discord_bridge.bridge_player_kicks_and_bans\": {\r\n\t\t\ttitle: \"Bridge Player Kicks and Bans\",\r\n\t\t\tdescription: \"Bridge kick and ban messages to the Discord channel.\",\r\n\t\t\ttype: \"boolean\",\r\n\t\t\tinitialValue: true,\r\n\t\t},\r\n\t\t\"discord_bridge.bridge_player_promotions\": {\r\n\t\t\ttitle: \"Bridge Player Promotions\",\r\n\t\t\tdescription: \"Bridge admin promotion messages to the Discord channel.\",\r\n\t\t\ttype: \"boolean\",\r\n\t\t\tinitialValue: false,\r\n\t\t},\r\n\t\t\"discord_bridge.player_templates\": {\r\n\t\t\ttitle: \"Player templates\",\r\n\t\t\tdescription:\r\n\t\t\t\t\"Template to use for sending bridged player action messages from Factorio. In the template the \" +\r\n\t\t\t\t\"string __instance_name__ is replaced with the name of the instance the message originated from \" +\r\n\t\t\t\t\"and __content__ is replaced with the content of the message. The available actions that can be \" +\r\n\t\t\t\t\"bridged are COMMAND SHOUT CHAT JOIN LEAVE KICK BAN UNBANNED PROMOTE DEMOTE.\",\r\n\t\t\ttype: \"object\",\r\n\t\t\tinitialValue: {\r\n\t\t\t\t\"COMMAND\": \"[__instance_name__] __content__\",\r\n\t\t\t\t\"SHOUT\": \"[__instance_name__] __content__\",\r\n\t\t\t\t\"CHAT\": \"[__instance_name__] __content__\",\r\n\t\t\t\t\"JOIN\": \"[__instance_name__] __content__\",\r\n\t\t\t\t\"LEAVE\": \"[__instance_name__] __content__\",\r\n\t\t\t\t\"KICK\": \"[__instance_name__] __content__\",\r\n\t\t\t\t\"BAN\": \"[__instance_name__] __content__\",\r\n\t\t\t\t\"UNBANNED\": \"[__instance_name__] __content__\",\r\n\t\t\t\t\"PROMOTE\": \"[__instance_name__] __content__\",\r\n\t\t\t\t\"DEMOTE\": \"[__instance_name__] __content__\",\r\n\t\t\t},\r\n\t\t},\r\n\t\t\"discord_bridge.notify_instance_status\": {\r\n\t\t\ttitle: \"Notify Instance Status\",\r\n\t\t\tdescription: \"Notify of instance status changes to the Discord channel.\",\r\n\t\t\ttype: \"boolean\",\r\n\t\t\tinitialValue: true,\r\n\t\t},\r\n\t\t\"discord_bridge.instance_status_templates\": {\r\n\t\t\ttitle: \"Instance Status Templates\",\r\n\t\t\tdescription:\r\n\t\t\t\t\"Template to use for sending notifications about instance status changes. In the template the \" +\r\n\t\t\t\t\"string __instance_name__ and __host_name__ are replaced with the instance and host the change \" +\r\n\t\t\t\t\"occured on. Templates specify previous:current status and the possible instance statuses are \" +\r\n\t\t\t\t\"undefined unknown stopped starting running stopping creating_save exporting_data deleted\",\r\n\t\t\ttype: \"object\",\r\n\t\t\tinitialValue: {\r\n\t\t\t\t\"starting:running\": \"[__instance_name__] started\",\r\n\t\t\t\t\"starting:stopped\": \"[__instance_name__] failed to start\",\r\n\t\t\t\t\"running:stopped\": \"[__instance_name__] abruptly stopped\",\r\n\t\t\t\t\"stopping:stopped\": \"[__instance_name__] stopped\",\r\n\t\t\t\t\"undefined:unassigned\": \"[__instance_name__] was created\",\r\n\t\t\t\t\"deleted\": \"[__instance_name__] was deleted\",\r\n\t\t\t},\r\n\t\t},\r\n\t\t\"discord_bridge.notify_host_connections\": {\r\n\t\t\ttitle: \"Notify Host Connections\",\r\n\t\t\tdescription: \"Notify of host connecting and disconnecting to the Discord channel.\",\r\n\t\t\ttype: \"boolean\",\r\n\t\t\tinitialValue: true,\r\n\t\t},\r\n\t\t\"discord_bridge.host_templates\": {\r\n\t\t\ttitle: \"Host templates\",\r\n\t\t\tdescription:\r\n\t\t\t\t\"Template to use for sending notifications about host connection events. In the template the \" +\r\n\t\t\t\t\"string __host_name__ is replaced with the name of the host the connection event occured from. \" +\r\n\t\t\t\t\"The possible events that can happen are connect drop resume close.\",\r\n\t\t\ttype: \"object\",\r\n\t\t\tinitialValue: {\r\n\t\t\t\t\"connect\": \"[__host_name__] connected\",\r\n\t\t\t\t\"drop\": \"\",\r\n\t\t\t\t\"resume\": \"\",\r\n\t\t\t\t\"close\": \"[__host_name__] disconnected\",\r\n\t\t\t},\r\n\t\t},\r\n\t},\r\n\r\n\tfeatures: [\"ScriptCommands\"],\n\n\tmessages: [\r\n\t\tInstanceActionEvent,\r\n\t\tDiscordChatEvent,\r\n\t],\r\n};\r\n"],"mappings":"AAAA,IAAa,oBAAb,KAAiC,CAChC,OAAO,KAAO,QACd,OAAO,IAAM,WACb,OAAO,IAAM,aACb,OAAO,OAAS,iBAEhB,YAAY,EAAc,EAAQ,EAAS,CAC1C,KAAK,aAAeA,EACpB,KAAK,OAASC,EACd,KAAK,QAAUC,CAChB,CAEA,OAAO,WAAa,CACnB,KAAM,SACN,SAAU,CAAC,eAAgB,SAAU,SAAS,EAC9C,WAAY,CACXC,aAAgB,CAAE,KAAM,QAAS,EACjCC,OAAU,CAAE,KAAM,QAAS,EAC3BC,QAAW,CAAE,KAAM,QAAS,CAC7B,CACD,EAEA,OAAO,SAAS,EAAM,CACrB,OAAO,IAAI,KAAKC,EAAK,aAAcA,EAAK,OAAQA,EAAK,OAAO,CAC7D,CACD,EAEa,iBAAb,KAA8B,CAC7B,OAAO,KAAO,QACd,OAAO,IAAM,aACb,OAAO,IAAM,WACb,OAAO,OAAS,iBAEhB,YAAY,EAAS,CACpB,KAAK,QAAUJ,CAChB,CAEA,OAAO,WAAa,CACnB,KAAM,SACN,SAAU,CAAC,SAAS,EACpB,WAAY,CACXG,QAAW,CAAE,KAAM,QAAS,CAC7B,CACD,EAEA,OAAO,SAAS,EAAM,CACrB,OAAO,IAAI,KAAKC,EAAK,OAAO,CAC7B,CACD,EAEaC,EAAS,CACrB,KAAM,iBACN,MAAO,iBACP,YAAa,8CACb,mBAAoB,gBACpB,qBAAsB,kBACtB,uBAAwB,CACvB,2BAA4B,CAC3B,MAAO,YACP,YAAa,sCACb,KAAM,SACN,SAAU,EACX,EACA,4BAA6B,CAC5B,MAAO,aACP,YAAa,gCACb,KAAM,SACN,SAAU,EACX,EACA,kCAAmC,CAClC,MAAO,mBACP,YACC,sQAGD,KAAM,SACN,aAAc,yCACf,EACA,sCAAuC,CACtC,MAAO,uBACP,YAAa,yDACb,KAAM,UACN,aAAc,EACf,EACA,oCAAqC,CACpC,MAAO,qBACP,YAAa,6CACb,KAAM,UACN,aAAc,EACf,EACA,wCAAyC,CACxC,MAAO,yBACP,YAAa,uEACb,KAAM,UACN,aAAc,EACf,EACA,qCAAsC,CACrC,MAAO,sBACP,YAAa,8DACb,KAAM,UACN,aAAc,EACf,EACA,8CAA+C,CAC9C,MAAO,+BACP,YAAa,uDACb,KAAM,UACN,aAAc,EACf,EACA,0CAA2C,CAC1C,MAAO,2BACP,YAAa,0DACb,KAAM,UACN,aAAc,EACf,EACA,kCAAmC,CAClC,MAAO,mBACP,YACC,0WAID,KAAM,SACN,aAAc,CACbC,QAAW,kCACXC,MAAS,kCACTC,KAAQ,kCACRC,KAAQ,kCACRC,MAAS,kCACTC,KAAQ,kCACRC,IAAO,kCACPC,SAAY,kCACZC,QAAW,kCACXC,OAAU,iCACX,CACD,EACA,wCAAyC,CACxC,MAAO,yBACP,YAAa,4DACb,KAAM,UACN,aAAc,EACf,EACA,2CAA4C,CAC3C,MAAO,4BACP,YACC,mXAID,KAAM,SACN,aAAc,CACb,mBAAoB,8BACpB,mBAAoB,sCACpB,kBAAmB,uCACnB,mBAAoB,8BACpB,uBAAwB,kCACxBC,QAAW,iCACZ,CACD,EACA,yCAA0C,CACzC,MAAO,0BACP,YAAa,sEACb,KAAM,UACN,aAAc,EACf,EACA,gCAAiC,CAChC,MAAO,iBACP,YACC,+PAGD,KAAM,SACN,aAAc,CACbC,QAAW,4BACXC,KAAQ,GACRC,OAAU,GACVC,MAAS,8BACV,CACD,CACD,EAEA,SAAU,CAAC,gBAAgB,EAE3B,SAAU,CACT,oBACA,gBACD,CACD,E"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var e=`discord_bridge_2.1`,t=`0.3.0`,n=`Clusterio plugin bridging chat between instances and Discord`,r=`index.js`,i={test:`npm pack --dry-run`,prepare:`vite build`},a={type:`git`,url:`git+https://github.com/Hornwitser/discord_bridge.git`},o=[`clusterio`,`factorio`,`discord`],s=`Hornwitser <github@hornwitser.no>`,c=`MIT`,l={url:`https://github.com/Hornwitser/discord_bridge/issues`},u=`https://github.com/Hornwitser/discord_bridge#readme`,d={"@clusterio/controller":`~2.1.0`,"@clusterio/lib":`~2.1.0`},f={"@clusterio/controller":`~2.1.0`,"@clusterio/lib":`~2.1.0`,"@clusterio/web_ui":`~2.1.0`,vite:`^8.3.4`},p={"discord.js":`^14.14.1`},m={access:`public`},h=`module`,g={node:`^22.18.0 || >=24.2.0`},_={"@clusterio/controller":{optional:!0}},v={name:e,version:t,description:n,main:r,scripts:i,repository:a,keywords:o,author:s,license:`MIT`,bugs:l,homepage:u,peerDependencies:d,devDependencies:f,dependencies:p,publishConfig:m,type:h,engines:g,peerDependenciesMeta:_};export{s as author,l as bugs,v as default,p as dependencies,n as description,f as devDependencies,g as engines,u as homepage,o as keywords,c as license,r as main,e as name,d as peerDependencies,_ as peerDependenciesMeta,m as publishConfig,a as repository,i as scripts,h as type,t as version};
|
|
2
|
-
//# sourceMappingURL=package-Dp_yn2wZ.js.map
|