diff --git a/crons/storage-alert.sh b/crons/storage-alert.sh index 8e5106e..965ff9f 100755 --- a/crons/storage-alert.sh +++ b/crons/storage-alert.sh @@ -27,9 +27,11 @@ for index in "${!STORAGE_ALERT[@]}"; do fi done +title="Storage Update" if [[ "$warn" = true ]]; then purple="purple" + title="Storage Alert" fi printf "%s\n" "${messages[@]}" -printf "%s\n" "${messages[@]}" | "$scriptRoot/discord.sh" -c "${purple-blue}" -d "Storage Alert" +printf "%s\n" "${messages[@]}" | "$scriptRoot/discord.sh" -c "${purple-blue}" -d "Storage Alert" -t "$title" diff --git a/discord.sh b/discord.sh index 5154796..0e3c6cb 100755 --- a/discord.sh +++ b/discord.sh @@ -19,7 +19,7 @@ colors=( ) print_usage() { - echo "Usage: $0 [-h hook-url], [-c color], [-d [distinct-name] | -t title] (message... | -z | < file.msg)" + echo "Usage: $0 [-h hook-url], [-c color], [-d [distinct-name]] [-t title] (message... | -z | < file.msg)" } # handle all arguments provided @@ -164,7 +164,7 @@ if [[ -n "$color" ]]; then content="$content, \"color\": ${colors[$color]}" fi if [[ -n "$distinct" ]] || [[ -n "$title" ]]; then - content="$content, \"title\": $(echo "${distinct-$title}" | jq -aRs .)" + content="$content, \"title\": $(echo "${title-$distinct}" | jq -aRs .)" fi content="$content}]}" @@ -177,7 +177,7 @@ if [ -n "$extra" ]; then args=("-h" "$hookUrl") # when we call again, we convert distinct into a title if [[ -n "$distinct" ]] || [[ -n "$title" ]]; then - args+=("-t" "${distinct-$title}") + args+=("-t" "${title-$distinct}") fi if [[ -n "$color" ]]; then args+=("-c" "$color")