Skip to content

Commit

Permalink
Updated sendMessageToDiscordSmartContractsChannel to sendMessageToSla…
Browse files Browse the repository at this point in the history
…ckSmartContractsChannel
  • Loading branch information
mirooon committed Feb 28, 2025
1 parent 6e40915 commit 70e2151
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
16 changes: 7 additions & 9 deletions script/helperFunctions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3389,33 +3389,31 @@ function compareAddresses() {
return 1
fi
}
function sendMessageToDiscordSmartContractsChannel() {
function sendMessageToSlackSmartContractsChannel() {
# read function arguments into variable
local MESSAGE=$1

if [ -z "$DISCORD_WEBHOOK_DEV_SMARTCONTRACTS" ]; then
if [ -z "$SLACK_WEBHOOK_SC_GENERAL" ]; then
echo ""
warning "Discord webhook URL for dev-smartcontracts is missing. Cannot send log message."
warning "Slack webhook URL for dev-sc-general is missing. Cannot send log message."
echo ""
return 1
fi

echo ""
echoDebug "sending the following message to Discord webhook ('dev-smartcontracts' channel):"
echoDebug "sending the following message to Slack webhook ('dev-sc-general' channel):"
echoDebug "$MESSAGE"
echo ""

# Send the message
curl -H "Content-Type: application/json" \
-X POST \
-d "{\"content\": \"$MESSAGE\"}" \
$DISCORD_WEBHOOK_DEV_SMARTCONTRACTS
-d "{\"text\": \"$MESSAGE\"}" \
$SLACK_WEBHOOK_SC_GENERAL

echoDebug "Log message sent to Discord"
echoDebug "Log message sent to Slack"

return 0


}

function getUserInfo() {
Expand Down
2 changes: 1 addition & 1 deletion script/tasks/diamondEMERGENCYPause.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function diamondEMERGENCYPause {

# get user info and send message to discord server
local USER_INFO=$(getUserInfo)
sendMessageToDiscordSmartContractsChannel ":warning: an emergency diamond action was just triggered (action: $ACTION, user info: $USER_INFO). Please immediately investigate if this action was not planned. :warning:"
sendMessageToSlackSmartContractsChannel ":warning: an emergency diamond action was just triggered (action: $ACTION, user info: $USER_INFO). Please immediately investigate if this action was not planned. :warning:"

# Initialize return status
local RETURN=0
Expand Down

0 comments on commit 70e2151

Please sign in to comment.