feat: move to discord-mc-cat

This commit is contained in:
Jet Pham 2026-03-14 14:20:15 -07:00
parent 9009c2e2af
commit f135eeaf73
No known key found for this signature in database
2 changed files with 36 additions and 19 deletions

View file

@ -5,31 +5,45 @@ let
in
{
systemd.services.minecraft-discord-config = {
description = "Inject Discord bot token into Discord4Fabric config";
description = "Inject Discord bot token into Discord-MC-Chat config";
wantedBy = [ "multi-user.target" ];
before = [ "docker-minecraft.service" ];
after = [ "agenix.service" ];
serviceConfig = {
Type = "oneshot";
ExecStart = pkgs.writeShellScript "setup-discord4fabric" ''
CONFIG_DIR="${mcDataDir}/config/discord4fabric"
mkdir -p "$CONFIG_DIR"
ExecStart = pkgs.writeShellScript "setup-discord-mc-chat" ''
set -euo pipefail
CONFIG_FILE="${mcDataDir}/config/discord-mc-chat.json"
mkdir -p "${mcDataDir}/config"
TOKEN=$(cat ${config.age.secrets.discord-bot-token.path})
cat > "$CONFIG_DIR/config.json" <<EOF
# Admin Discord IDs: jet, z, edward
cat > "$CONFIG_FILE" <<EOF
{
"botToken": "$TOKEN",
"guildId": "849685154543960085",
"channelId": "1482269524571979899",
"chatMessageFormat": "**%player%** > %message%",
"joinFormat": "%player% joined the server",
"leaveFormat": "%player% left the server",
"deathFormat": "%message%",
"advancementFormat": "%player% has made the advancement **%advancement%**",
"discordToMinecraftFormat": "[Discord] <%user%> %message%"
"generic": {
"botToken": "$TOKEN",
"channelId": "1482486447591391285",
"consoleLogChannelId": "1482487413153464330",
"useWebhook": true,
"announceServerStartStop": true,
"announcePlayerJoinLeave": true,
"announceDeathMessages": true,
"announceAdvancements": true,
"broadcastChatMessages": true,
"adminsIds": [
"1008533670426050704",
"839601350865584158",
"373272898368176129"
]
},
"multiServer": {
"enable": false
}
}
EOF
chmod 600 "$CONFIG_FILE"
'';
};
};