Factorio Server Manager & Discord Bridge
Linux
Golang 1.24+
ChatWire is approximately 15k lines of go code over 77 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 build
This 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.
Launch params:
Usage of ChatWire:
-cleanBans
Clean/minimize player database, along with bans and exit.
-cleanDB
Clean/minimize player database and exit.
-deregCommands
Deregister discord commands and quit.
-localTest
Turn off public/auth mode for testing
-noAutoLaunch
Turn off auto-launch
-regCommands
Register discord commands
The bot needs presence intent, server members intent, message content intent Perms: 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, use application commands.
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.
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
./ChatWire
Ensure the generated configuration files contain your Discord token, application ID, guild ID and channel ID, along with Factorio credentials.