GithubHelp home page GithubHelp logo

gnat / send-to-discord.sh Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 0.0 8 KB

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

Shell 100.00%
bash continuous-integration curl discord discord-api discord-bot gitea gitea-actions github-action github-workflow

send-to-discord.sh's Introduction

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.

send-to-discord.sh's People

Contributors

gnat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.