From 7d7e3b3dc16c6524aa69a290125aaf655664dfbc Mon Sep 17 00:00:00 2001 From: xHyperElectric <71343435+xHyperElectric@users.noreply.github.com> Date: Sun, 3 Mar 2024 15:24:10 -0500 Subject: [PATCH 1/7] Send discord messages when players join and leave --- scripts/player_logging.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/player_logging.sh b/scripts/player_logging.sh index bf9f98e88..52574fceb 100644 --- a/scripts/player_logging.sh +++ b/scripts/player_logging.sh @@ -41,18 +41,20 @@ 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" + DiscordMessage "Player Left" "${DISCORD_PLAYER_LEAVE_MESSAGE}" "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" + DiscordMessage "Player Joined" "${DISCORD_PLAYER_JOIN_MESSAGE}" "success" done old_player_list=("${current_player_list[@]}") From 4f50f83cfe16131622d8f4d6436a934f417ec0ad Mon Sep 17 00:00:00 2001 From: xHyperElectric <71343435+xHyperElectric@users.noreply.github.com> Date: Sun, 3 Mar 2024 15:57:22 -0500 Subject: [PATCH 2/7] Add DISCORD_PLAYER_JOIN_MESSAGE and DISCORD_PLAYER_LEAVE_MESSAGE Add env variable for Discord Player Join Message and Discord Player Leave Message --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 3f515a334..9a944a782 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 \ From 9d4f499bb47baa47d8be8418af547e13d6b3646a Mon Sep 17 00:00:00 2001 From: xHyperElectric <71343435+xHyperElectric@users.noreply.github.com> Date: Sun, 3 Mar 2024 16:04:41 -0500 Subject: [PATCH 3/7] Update player_logging.sh to replace ${player_name} properly --- scripts/player_logging.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/player_logging.sh b/scripts/player_logging.sh index 52574fceb..8ae38bb17 100644 --- a/scripts/player_logging.sh +++ b/scripts/player_logging.sh @@ -46,7 +46,9 @@ while true; do player_name=$( get_playername "${player}" ) LogInfo "${player_name} has left" broadcast_command "${player_name} has left" - DiscordMessage "Player Left" "${DISCORD_PLAYER_LEAVE_MESSAGE}" "failure" + + # Replace ${player_name} with actual player's name + DiscordMessage "Player Left" "${DISCORD_PLAYER_LEAVE_MESSAGE//\$\{player_name\}/${player_name}}" "failure" done # Notify Discord and log all players who have joined @@ -54,7 +56,9 @@ while true; do player_name=$( get_playername "${player}" ) LogInfo "${player_name} has joined" broadcast_command "${player_name} has joined" - DiscordMessage "Player Joined" "${DISCORD_PLAYER_JOIN_MESSAGE}" "success" + + # 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[@]}") From 5d1d6239d16993f57510eece782d0934126abdd1 Mon Sep 17 00:00:00 2001 From: xHyperElectric <71343435+xHyperElectric@users.noreply.github.com> Date: Sun, 3 Mar 2024 16:15:24 -0500 Subject: [PATCH 4/7] Update README.md to add DISCORD_PLAYER_LEAVE_MESSAGE and DISCORD_PLAYER_JOIN_MESSAGE --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index cf0b20e30..b11659dcd 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 | From 4baea22a7374d1ed90283ec88e46ecd4f83c1c7a Mon Sep 17 00:00:00 2001 From: xHyperElectric <71343435+xHyperElectric@users.noreply.github.com> Date: Sun, 3 Mar 2024 16:17:47 -0500 Subject: [PATCH 5/7] Update server-settings.md to include DISCORD_PLAYER_JOIN_MESSAGE and DISCORD_PLAYER_LEAVE_MESSAGE --- .../docs/getting-started/configuration/server-settings.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docusaurus/docs/getting-started/configuration/server-settings.md b/docusaurus/docs/getting-started/configuration/server-settings.md index bbc440b4c..81f44583b 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 | From 0ee2b961ae04f7a6d5d6881b4e1261eeb978a771 Mon Sep 17 00:00:00 2001 From: xHyperElectric <71343435+xHyperElectric@users.noreply.github.com> Date: Mon, 4 Mar 2024 22:06:27 -0500 Subject: [PATCH 6/7] Update server-settings.md to attempt to escape the brackets in ${player_name} --- .../docs/getting-started/configuration/server-settings.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docusaurus/docs/getting-started/configuration/server-settings.md b/docusaurus/docs/getting-started/configuration/server-settings.md index 81f44583b..3f5243cfd 100644 --- a/docusaurus/docs/getting-started/configuration/server-settings.md +++ b/docusaurus/docs/getting-started/configuration/server-settings.md @@ -60,8 +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" | +| 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 | From ede5735878bd3ef3bffe2cb26362754a594af531 Mon Sep 17 00:00:00 2001 From: Thijs van Loef Date: Tue, 5 Mar 2024 11:02:26 +0100 Subject: [PATCH 7/7] no emojis by default --- Dockerfile | 4 ++-- README.md | 4 ++-- .../docs/getting-started/configuration/server-settings.md | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9a944a782..37f8f0770 100644 --- a/Dockerfile +++ b/Dockerfile @@ -107,8 +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." \ + 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 b11659dcd..f6bfd8792 100644 --- a/README.md +++ b/README.md @@ -240,8 +240,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" | +| 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/docusaurus/docs/getting-started/configuration/server-settings.md b/docusaurus/docs/getting-started/configuration/server-settings.md index 3f5243cfd..7e7238f35 100644 --- a/docusaurus/docs/getting-started/configuration/server-settings.md +++ b/docusaurus/docs/getting-started/configuration/server-settings.md @@ -60,8 +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" | +| 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 |