Quantcast
Channel: Bashタグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 2912

DiscordWebhookにbashのcurlでPOSTする

$
0
0

毎回400になるので

実行

curl -s-X POST -H'Content-Type: application/json'-d{"content": '\""$MESSAGE"\"'}' $WEBHOOK_URL

$MESSAGE

MESSAGE=`cat input.txt | sed"s/'//g" | perl -pe's/\n/\\\\n/g' | sed"s/\"//g"`
  • クオーテーション削り
  • 改行ねじこみ
  • \"の並びは削る

$WEBHOOK_URL

WEBHOOK_URL=https://discordapp.com/api/webhooks/hogehoge-hogehoge

Viewing all articles
Browse latest Browse all 2912

Trending Articles