-
-
Notifications
You must be signed in to change notification settings - Fork 295
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #172 from v4de/feature/discord-webhooks
Feat: Add pre and post update, start, backup, and shutdown discord hooks.
- Loading branch information
Showing
8 changed files
with
200 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
services: | ||
palworld: | ||
image: thijsvanloef/palworld-server-docker:latest | ||
restart: unless-stopped | ||
container_name: palworld-server | ||
stop_grace_period: 30s # Set to however long you are willing to wait for the container to gracefully stop | ||
ports: | ||
- 8211:8211/udp | ||
- 27015:27015/udp # Required if you want your server to show up in the community servers tab | ||
environment: | ||
- PUID=1000 | ||
- PGID=1000 | ||
- PORT=8211 # Optional but recommended | ||
- PLAYERS=16 # Optional but recommended | ||
- SERVER_PASSWORD=worldofpals # Optional but recommended | ||
- MULTITHREADING=true | ||
- RCON_ENABLED=true | ||
- RCON_PORT=25575 | ||
- TZ=UTC | ||
- ADMIN_PASSWORD=adminPasswordHere | ||
- COMMUNITY=false # Enable this if you want your server to show up in the community servers tab, USE WITH SERVER_PASSWORD! | ||
- SERVER_NAME=World of Pals | ||
- SERVER_DESCRIPTION=palworld-server-docker by Thijs van Loef | ||
volumes: | ||
- ./palworld:/palworld/ | ||
palworld: | ||
image: thijsvanloef/palworld-server-docker:latest | ||
restart: unless-stopped | ||
container_name: palworld-server | ||
stop_grace_period: 30s # Set to however long you are willing to wait for the container to gracefully stop | ||
ports: | ||
- 8211:8211/udp | ||
- 27015:27015/udp # Required if you want your server to show up in the community servers tab | ||
environment: | ||
- PUID=1000 | ||
- PGID=1000 | ||
- PORT=8211 # Optional but recommended | ||
- PLAYERS=16 # Optional but recommended | ||
- SERVER_PASSWORD=worldofpals # Optional but recommended | ||
- MULTITHREADING=true | ||
- RCON_ENABLED=true | ||
- RCON_PORT=25575 | ||
- TZ=UTC | ||
- ADMIN_PASSWORD=adminPasswordHere | ||
- COMMUNITY=false # Enable this if you want your server to show up in the community servers tab, USE WITH SERVER_PASSWORD! | ||
- SERVER_NAME=World of Pals | ||
- SERVER_DESCRIPTION=palworld-server-docker by Thijs van Loef | ||
volumes: | ||
- ./palworld:/palworld/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/bin/bash | ||
|
||
# Defaults | ||
DEFAULT_CONNECT_TIMEOUT=30 | ||
DEFAULT_MAX_TIMEOUT=30 | ||
DEFAULT_LEVEL="info" | ||
DISCORD_BLUE=1127128 | ||
DISCORD_YELLOW=15258703 | ||
DISCORD_ORANGE=14177041 | ||
DISCORD_RED=14614528 | ||
DISCORD_GREEN=52224 | ||
|
||
# Parse arguments | ||
MESSAGE=$1 | ||
LEVEL=$2 | ||
|
||
if [ -n "${DISCORD_CONNECT_TIMEOUT}" ] && [[ "${DISCORD_CONNECT_TIMEOUT}" =~ ^[0-9]+$ ]]; then | ||
CONNECT_TIMEOUT=$DISCORD_CONNECT_TIMEOUT | ||
else | ||
echo "CONNECT_TIMEOUT is not an integer, using default ${DEFAULT_CONNECT_TIMEOUT} seconds." | ||
CONNECT_TIMEOUT=$DEFAULT_CONNECT_TIMEOUT | ||
fi | ||
|
||
if [ -n "${DISCORD_MAX_TIMEOUT}" ] && [[ "${DISCORD_MAX_TIMEOUT}" =~ ^[0-9]+$ ]]; then | ||
MAX_TIMEOUT=$DISCORD_MAX_TIMEOUT | ||
else | ||
echo "MAX_TIMEOUT is not an integer, using default ${DEFAULT_MAX_TIMEOUT} seconds." | ||
MAX_TIMEOUT=$DEFAULT_MAX_TIMEOUT | ||
fi | ||
|
||
if [ -n "${LEVEL}" ]; then | ||
case $LEVEL in | ||
info ) | ||
COLOR=$DISCORD_BLUE | ||
;; | ||
in-progress ) | ||
COLOR=$DISCORD_YELLOW | ||
;; | ||
warn ) | ||
COLOR=$DISCORD_ORANGE | ||
;; | ||
failure ) | ||
COLOR=$DISCORD_RED | ||
;; | ||
success ) | ||
COLOR=$DISCORD_GREEN | ||
;; | ||
* ) | ||
echo "Could not find \"${LEVEL}\", using \"${DEFAULT_LEVEL}\"" | ||
COLOR=$DISCORD_BLUE | ||
;; | ||
esac | ||
else | ||
COLOR=$DISCORD_BLUE | ||
fi | ||
|
||
JSON=$(jo embeds[]="$(jo title="$MESSAGE" color=$COLOR)") | ||
echo "Sending Discord json: ${JSON}" | ||
curl -sfSL --connect-timeout "$CONNECT_TIMEOUT" --max-time "$MAX_TIMEOUT" -H "Content-Type: application/json" -d "$JSON" "$DISCORD_WEBHOOK_URL" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.