Skip to content

Commit

Permalink
Send discord messages when players join and leave
Browse files Browse the repository at this point in the history
  • Loading branch information
xHyperElectric authored Mar 3, 2024
1 parent 1fd3325 commit 7d7e3b3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions scripts/player_logging.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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[@]}")
Expand Down

0 comments on commit 7d7e3b3

Please sign in to comment.