Skip to content

Instantly share code, notes, and snippets.

@ss44
Created July 15, 2023 23:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ss44/909a3dbdf37fd1b94b77e1cf81fcba51 to your computer and use it in GitHub Desktop.
Save ss44/909a3dbdf37fd1b94b77e1cf81fcba51 to your computer and use it in GitHub Desktop.
Bash Function To Ping Discord
#!/bin/bash
# The following ought to be added to any of the auto loaded bash files ~/.bash_profile or ~/.bash_aliases etc.
ping_discord ()
{
local strDiscordWebhookUrl=<replace with your webhook_url>
local strMessage="$@";
curl -i -H "Accept: application/json" \
-H "Content-Type:application/json" \
-X POST --data "{\"content\": \"${strMessage}\"}" \
"${strDiscordWebhookUrl}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment