Skip to content

Instantly share code, notes, and snippets.

@acid-chicken
Created October 14, 2018 13:08
Show Gist options
  • Save acid-chicken/583939c184c7aadf14f4834fbeb6f175 to your computer and use it in GitHub Desktop.
Save acid-chicken/583939c184c7aadf14f4834fbeb6f175 to your computer and use it in GitHub Desktop.
#!/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