Factorio Server Manager & Discord Bridge
Linux
Golang 1.24+
ChatWire is approximately 16k lines of Go code across 80 files.
Launching will create a default auto-config to get you started.
Needs permissions to create files and directories in its own directory, and up one directory.
Some dirs and files that can be auto-created:
cw-local-config.json, ../cw-global-config.json
cw.lock, ../playerdb.json
../map-gen-json/, ./logs/, ../update-cache/, ../public_html/archive/
Discord token, appid, guild-id and channel-id are required, as well as Factorio username and token.
git clone https://github.com/Distortions81/M45-ChatWire.git
cd M45-ChatWire
go buildThis produces the ChatWire binary in the current directory.
Launching the binary for the first time will create cw-local-config.json and ../cw-global-config.json.
Edit these files to provide your Discord credentials, Factorio token and server paths.
After configuring run ./ChatWire -regCommands to register slash commands.
A 'base' folder the chatwire folder resides in.
~/factServers/
For ChatWire:
./cw-a/ChatWire-binary-here
Factorio:
./cw-a/factorio/
Binary:
./cw-a/factorio/bin/x64/Factorio
This is setup to have many servers running, and so some files and directories are setup to be common.
The example-files directory contains sample systemd units, configuration files
and helper scripts for managing multiple servers. Copy them and adjust the paths
as needed for your environment.
| Flag | Description |
|---|---|
-cleanBans |
Clean and minimise the player database, remove bans then exit. |
-cleanDB |
Clean and minimise the player database then exit. |
-deregCommands |
Deregister Discord commands and quit. |
-localTest |
Disable public/auth mode for testing. |
-noAutoLaunch |
Disable auto-launch. |
-noDiscord |
Disable Discord integration. |
-panel |
Enable web control panel. |
-proxy |
HTTP caching proxy URL. Format: proxy/http://example.domain/path. |
-regCommands |
Register Discord commands. |
- Visit https://discord.com/developers/applications and create a New Application.
- Under Bot click Add Bot. Enable the Presence, Server Members and Message Content intents and grant these permissions: view channels, manage channels, manage roles, send messages, embed links, attach files, mention all roles, manage messages (delete message if register code leaked), read message history and use application commands.
- Copy the Token from the bot page and note the Application ID from OAuth2 > General.
- In Discord enable Developer Mode and right click your server to Copy ID for the guild ID.
- Copy a channel ID or leave
ChatChannelblank incw-local-config.jsonand ChatWire will create one on first run.
Run go fmt to format the code and go vet for linting before committing. Tests can be executed with:
go fmt ./...
go vet ./...
go test ./...These are the same checks executed by the CI pipeline. Some integration tests connect to Discord. Set CW_TEST_TOKEN, CW_TEST_GUILD and CW_TEST_APP to enable them.
If you need to reset the configuration files, delete cw-local-config.json and ../cw-global-config.json and start ChatWire again. Fresh copies will be generated automatically. You can also reload the configs at runtime using the ReloadConfig moderator command.
Build the binary and register the Discord slash commands:
go build
./ChatWire -regCommands
./ChatWireEnsure the generated configuration files contain your Discord token, application ID, guild ID and channel ID, along with Factorio credentials.
Create a file in the ChatWire directory to control the running game:
.startstarts Factorio if it is not running..stopstops the game gracefully..queuequeues a reboot once the current game ends..rfactrestarts Factorio.
ChatWire monitors the local and global configuration files, the player database and the ban list for modifications. Any changes are loaded automatically so you can update settings without restarting the bot.
- Start ChatWire with
-panelto enable the panel server. - Generate a temporary token with the
/web-panelcommand. - See
/infodetails like versions, uptime, next map reset and player stats. - Buttons let you start/stop Factorio, sync mods and update the game.
- The map section lists recent saves for one-click loading or custom filenames.
- Send arbitrary RCON commands from the browser.
- Styled in a dark theme similar to the staff docs.
- With
-localTestthe URL uses127.0.0.1for local access. - Mirrors
/info verboseshowing the last save name and UPS stats. - Extra forms adjust play hours, schedule map resets and set player levels.
