Skip to content

Latest commit

 

History

History
31 lines (27 loc) · 1.22 KB

README.md

File metadata and controls

31 lines (27 loc) · 1.22 KB

Why does this exist?

Send messages to discord (.. no Docker containers.. no npm install.. no bullshit..)

Shell script (discord.sh)

TITLE=${1:-"Title"}
MESSAGE=${2:-"Message"}
COLOR=${3:-"999999"}
URL=${4:-'https://discord.com/api/webhooks/XXXXXXXXXXXXX/XXXXXXXXXXXXX'}
# API: https://discord.com/developers/docs/resources/channel#embed-object
curl "$URL" -H "Content-Type: application/json" -X POST -g --data '{"embeds":[{"title":"'"$TITLE"'","description":"'"$MESSAGE"'","color":"'"$((16#$COLOR))"'"}]}'

▶️ ./discord.sh "Deploying" "$GIT_SHA" "009900"

... or as a function in your own script.

discord_message() {
	TITLE=${1:-"Title"}
	MESSAGE=${2:-"Message"}
	COLOR=${3:-"999999"}
	URL=${4:-'https://discord.com/api/webhooks/XXXXXXXXXXXXX/XXXXXXXXXXXXX'}
	# API: https://discord.com/developers/docs/resources/channel#embed-object
	curl "$URL" -H "Content-Type: application/json" -X POST -g --data '{"embeds":[{"title":"'"$TITLE"'","description":"'"$MESSAGE"'","color":"'"$((16#$COLOR))"'"}]}'
}

discord_message "Deploying" "$GIT_SHA" "009900"

Wisdom from levelsio

image

Thanks for coming to my TED talk.