curlでwebhookを叩いてDiscordに投稿

#!/bin/sh -norc
message=${1:-"empty message"}

if [ "$2" == "" ] ;
then
    payload="{\"content\":\"${message}\"}"
else
    payload="{\"username\":\"$2\",\"content\":\"${message}\"}"
fi

url='https://discordapp.com/api/webhooks/aaa/bbb'
curl -X POST -H "Accept: application/json" -H "Content-type: application/json" -d "${payload}" ${url}