discord will no longer send message if it was empty.

This commit is contained in:
2023-10-05 00:53:41 +00:00
parent 4a99766375
commit 7cec5c6878
2 changed files with 24 additions and 4 deletions
+12 -2
View File
@@ -8,11 +8,21 @@ if [[ $# -gt 2 ]]; then
HOOK_ARG="$1"
BOBBY="$2"
# sed removes spaces before each line
MESSAGE=`echo "${@:3}" | sed 's/^ *//'`
MESSAGE=`echo "${@:3}" | sed 's/^ *//' | sed 's/ *$//'`
else
BOBBY="$1"
# sed removes spaces before each line
MESSAGE=`echo "${@:2}" | sed 's/^ *//'`
MESSAGE=`echo "${@:2}" | sed 's/^ *//' | sed 's/ *$//'`
if [[ "$MESSAGE" == "general" ]] || [[ "$MESSAGE" == "block" ]] || [[ "$MESSAGE" == "restake" ]] || [[ "$MESSAGE" == "storage" ]]; then
HOOK_ARG="$MESSAGE"
MESSAGE=''
fi
fi
if [[ -z "$MESSAGE" ]]; then
echo 'no message provided'
exit 0
fi
# sed removes blank lines from the end of the message
+12 -2
View File
@@ -7,10 +7,20 @@ source "${LOCATION}/config.sh"
if [[ $# -gt 1 ]]; then
HOOK_ARG="$1"
# sed removes spaces before each line
MESSAGE=`echo "${@:2}" | sed 's/^ *//'`
MESSAGE=`echo "${@:2}" | sed 's/^ *//' | sed 's/ *$//'`
else
# sed removes spaces before each line
MESSAGE=`echo "${@}" | sed 's/^ *//'`
MESSAGE=`echo "${@}" | sed 's/^ *//' | sed 's/ *$//'`
if [[ "$MESSAGE" == "general" ]] || [[ "$MESSAGE" == "block" ]] || [[ "$MESSAGE" == "restake" ]] || [[ "$MESSAGE" == "storage" ]]; then
HOOK_ARG="$MESSAGE"
MESSAGE=''
fi
fi
if [[ -z "$MESSAGE" ]]; then
echo 'no message provided'
exit 0
fi
# if message is too long, split it, and after curl, recursively call with remainder