diff --git a/Dockerfile b/Dockerfile index 3f515a334..37f8f0770 100644 --- a/Dockerfile +++ b/Dockerfile @@ -107,6 +107,8 @@ ENV HOME=/home/steam \ DISCORD_PRE_START_MESSAGE="Server has been started!" \ DISCORD_PRE_SHUTDOWN_MESSAGE="Server is shutting down..." \ DISCORD_POST_SHUTDOWN_MESSAGE="Server has been stopped!" \ + DISCORD_PLAYER_JOIN_MESSAGE="\${player_name} has joined Palworld!" \ + DISCORD_PLAYER_LEAVE_MESSAGE="\${player_name} has left Palworld." \ ENABLE_PLAYER_LOGGING=true \ PLAYER_LOGGING_POLL_PERIOD=5 \ ARM_COMPATIBILITY_MODE=false \ diff --git a/README.md b/README.md index 217b79e35..20a6650e2 100644 --- a/README.md +++ b/README.md @@ -226,12 +226,12 @@ It is highly recommended you set the following environment values before startin | OLD_BACKUP_DAYS | How many days to keep backups | 30 | any positive integer | | AUTO_UPDATE_CRON_EXPRESSION | Setting affects frequency of automatic updates. | 0 \* \* \* \* | Needs a Cron-Expression - See [Configuring Automatic Backups with Cron](#configuring-automatic-backups-with-cron) | | AUTO_UPDATE_ENABLED | Enables automatic updates | false | true/false | -| AUTO_UPDATE_WARN_MINUTES | How long to wait to update the server, after the player were informed. (This will be ignored, if no Players are connected) | 30 | Integer | +| AUTO_UPDATE_WARN_MINUTES | How long to wait to update the server, after the player were informed. (This will be ignored, if no Players are connected) | 30 | Integer | | AUTO_REBOOT_CRON_EXPRESSION | Setting affects frequency of automatic updates. | 0 0 \* \* \* | Needs a Cron-Expression - See [Configuring Automatic Backups with Cron](#configuring-automatic-reboots-with-cron) | | AUTO_REBOOT_ENABLED | Enables automatic reboots | false | true/false | -| AUTO_REBOOT_WARN_MINUTES | How long to wait to reboot the server, after the player were informed. | 5 | Integer | +| AUTO_REBOOT_WARN_MINUTES | How long to wait to reboot the server, after the player were informed. | 5 | Integer | | AUTO_REBOOT_EVEN_IF_PLAYERS_ONLINE | Restart the Server even if there are players online. | false | true/false | -| TARGET_MANIFEST_ID | Locks game version to corespond with Manifest ID from Steam Download Depot. | | See [Manifest ID Table](#locking-specific-game-version) | +| TARGET_MANIFEST_ID | Locks game version to corespond with Manifest ID from Steam Download Depot. | | See [Manifest ID Table](#locking-specific-game-version) | | DISCORD_WEBHOOK_URL | Discord webhook url found after creating a webhook on a discord server | | `https://discord.com/api/webhooks/` | | DISCORD_CONNECT_TIMEOUT | Discord command initial connection timeout | 30 | !0 | | DISCORD_MAX_TIMEOUT | Discord total hook timeout | 30 | !0 | @@ -240,8 +240,10 @@ It is highly recommended you set the following environment values before startin | DISCORD_PRE_START_MESSAGE | Discord message sent when server begins to start | Server is started! | "string" | | DISCORD_PRE_SHUTDOWN_MESSAGE | Discord message sent when server begins to shutdown | Server is shutting down... | "string" | | DISCORD_POST_SHUTDOWN_MESSAGE | Discord message sent when server has stopped | Server is stopped! | "string" | +| DISCORD_PLAYER_JOIN_MESSAGE | Discord message sent when player joins the server | \${player_name} has joined Palworld! | "string" | +| DISCORD_PLAYER_LEAVE_MESSAGE | Discord message sent when player leaves the server | \${player_name} has left Palworld. | "string" | | DISABLE_GENERATE_SETTINGS | Whether to automatically generate the PalWorldSettings.ini | false | true/false | -| DISABLE_GENERATE_ENGINE | Whether to automatically generate the Engine.ini | true | true/false | +| DISABLE_GENERATE_ENGINE | Whether to automatically generate the Engine.ini | true | true/false | | ENABLE_PLAYER_LOGGING | Enables Logging and announcing when players join and leave | true | true/false | | PLAYER_LOGGING_POLL_PERIOD | Polling period (in seconds) to check for players who have joined or left | 5 | !0 | | ARM_COMPATIBILITY_MODE | Switches the compatibility layer from Box86 to QEMU when executing steamcmd for server updates. This setting is only applicable for ARM64 hosts. | false | true/false | diff --git a/docusaurus/docs/getting-started/configuration/server-settings.md b/docusaurus/docs/getting-started/configuration/server-settings.md index bbc440b4c..7e7238f35 100644 --- a/docusaurus/docs/getting-started/configuration/server-settings.md +++ b/docusaurus/docs/getting-started/configuration/server-settings.md @@ -60,6 +60,8 @@ It is highly recommended you set the following environment values before startin | DISCORD_PRE_START_MESSAGE | Discord message sent when server begins to start | Server is started! | "string" | | DISCORD_PRE_SHUTDOWN_MESSAGE | Discord message sent when server begins to shutdown | Server is shutting down... | "string" | | DISCORD_POST_SHUTDOWN_MESSAGE | Discord message sent when server has stopped | Server is stopped! | "string" | +| DISCORD_PLAYER_JOIN_MESSAGE | Discord message sent when player joins the server | \$\{player_name\} has joined Palworld! | "string" | +| DISCORD_PLAYER_LEAVE_MESSAGE | Discord message sent when player leaves the server | \$\{player_name\} has left Palworld. | "string" | | DISABLE_GENERATE_SETTINGS | Whether to automatically generate the PalWorldSettings.ini | false | true/false | | DISABLE_GENERATE_ENGINE | Whether to automatically generate the Engine.ini | true | true/false | | ENABLE_PLAYER_LOGGING | Enables Logging and announcing when players join and leave | true | true/false | diff --git a/scripts/player_logging.sh b/scripts/player_logging.sh index bf9f98e88..8ae38bb17 100644 --- a/scripts/player_logging.sh +++ b/scripts/player_logging.sh @@ -41,18 +41,24 @@ while true; do <(printf '%s\n' "${current_player_list[@]}") ) fi - # Log all players who have left + # Notify Discord and log all players who have left for player in "${players_who_left_list[@]}"; do player_name=$( get_playername "${player}" ) LogInfo "${player_name} has left" broadcast_command "${player_name} has left" + + # Replace ${player_name} with actual player's name + DiscordMessage "Player Left" "${DISCORD_PLAYER_LEAVE_MESSAGE//\$\{player_name\}/${player_name}}" "failure" done - # Log all players who have joined + # Notify Discord and log all players who have joined for player in "${players_who_joined_list[@]}"; do player_name=$( get_playername "${player}" ) LogInfo "${player_name} has joined" broadcast_command "${player_name} has joined" + + # Replace ${player_name} with actual player's name + DiscordMessage "Player Joined" "${DISCORD_PLAYER_JOIN_MESSAGE//\$\{player_name\}/${player_name}}" "success" done old_player_list=("${current_player_list[@]}")