consensus: keep a Discord channel up to date with Minecraft

consensus watches your Minecraft server's chat logs and sends any messages back to your group's Discord chat. It is a plugin for the Minecraft Bedrock dedicated server written in JavaScript. When running, consensus will send chat messages and join/leave messages through a Discord webhook. You can configure the channel the messages will be sent to in the webhook's settings.

implementation details

This is a one way bridge - messages from Minecraft will be sent to Discord, but messages from Discord will not be sent back to Minecraft. This is because a two-way bridge requires a much more complex and potentially fragile design and cannot be done in a single Minecraft mod. It would require a Discord bot to be running as long as the server runs, and the bot would constantly have to be in connection with the server.

install

The plugin is installed by cloning the git repository into your dedicated server directory. Do it with this command:
git clone https://git.reformers.dev/jeremy/consensus behavior_packs/consensus
Use this command to add your Discord webhook to the mod. Replace your webhook URL with your webhook URL you copied from Discord.
sed -ie 's@:webhook:@your webhook URL@' behavior_packs/consensus/scripts/main.js
That's all the configuration needed for the plugin. To load the behavior pack, you will need to allow use of the @minecraft/server-net JavaScript module, which is disabled by default. Add the module to the allowed_modules list in config/default/permissions.json. A typical copy of this file after adding this module could look like this:
{
  "allowed_modules": [
    "@minecraft/server-gametest",
    "@minecraft/server",
    "@minecraft/server-ui",
    "@minecraft/server-admin",
    "@minecraft/server-editor",
    "@minecraft/server-net"
  ]
}

troubleshooting

module requesting invalid module version [@minecraft/server - x.xx.x-beta]

This plugin was made for an older version of the dedicated server. Since network support in Minecraft mods is a beta feature, you must update the mod to use the latest beta version. With a text editor, open the file behavior_packs/consensus/manifest.json and find the dependency on @minecraft/server:
{
  "module_name": "@minecraft/server",
  "version": "1.17.0-beta"
}
The error message will show a list of available versions for the module. Replace the version in manifest.json with the latest version from the error message ending in -beta.

git repository

The git repository can be found at git.reformers.dev.

Maintained by Jeremy Baxter <jeremy@baxters.nz>