Last active
November 29, 2021 09:34
-
-
Save musaprg/04cc3c985bdf44c433258e7b17cb4d36 to your computer and use it in GitHub Desktop.
stdinの内容をDiscordに通知するくん
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
if [ -z "$DISCORD_WEBHOOK_URL" ]; then | |
echo '$DISCORD_WEBHOOK_URL is not set. Please set and try again.' | |
exit 1 | |
fi | |
if [ -t 0 ]; then | |
echo 'Usage: echo "<message>" | notify_discord' | |
exit 1 | |
fi | |
cat - | curl -H 'Content-Type: application/json' \ | |
-X POST \ | |
-d "{\"content\": \"$(cat)\"}" "$DISCORD_WEBHOOK_URL" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment