init minecraft server configs!
This commit is contained in:
commit
64820d502a
23 changed files with 24719 additions and 0 deletions
36
modules/discord.nix
Normal file
36
modules/discord.nix
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
let
|
||||
mcDataDir = "/srv/minecraft/data";
|
||||
in
|
||||
{
|
||||
systemd.services.minecraft-discord-config = {
|
||||
description = "Inject Discord bot token into Discord4Fabric 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"
|
||||
|
||||
TOKEN=$(cat ${config.age.secrets.discord-bot-token.path})
|
||||
|
||||
cat > "$CONFIG_DIR/config.json" <<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%"
|
||||
}
|
||||
EOF
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue