Skip to content

💬 Message your Discord server. No setup. Zero dependencies. Just works on any of: bash, sh, curl, github actions, workflows, gitea... Uses webhooks api.

Notifications You must be signed in to change notification settings

gnat/send-to-discord.sh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

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.

Releases

No releases published

Packages

No packages published

Languages