Created
October 14, 2018 13:08
-
-
Save acid-chicken/583939c184c7aadf14f4834fbeb6f175 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash | |
host='> YOUR INSTANCE URL GOES HERE <' | |
post='> WEBHOOK URL GOES HERE <' | |
user='> YOUR DISCORD ID GOES HERE <' | |
path='.example.com.status' | |
prev=$((`cat $path`)) | |
curr=$((`curl -ILSs -o /dev/null -w '%{http_code}\n' $host`)) | |
if [ $curr -ne $prev ] | |
then | |
if [ $curr -lt 400 ] | |
then | |
color=2932302 | |
else | |
color=13313073 | |
fi | |
echo '{"content":"<@!'$user'>","embeds":[{"type":"rich","title":"'$curr'","url":"'$host'","color":'$color'}]}' | \ | |
curl -A 'Misskey Status Webhook' -H 'Content-Type:application/json' -d @- $post | |
echo $curr > $path | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment