Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #通知內容
- msg="警告!!芮氏規模$1的地震,將於$2秒後到達!!"
- #Linebot token
- TOKEN="BXXXXXXXXX"
- #訊息要發送到哪裡,可輸入user_id或channel_id
- USER_ID="U8XXXXXXX"
- #HA對外網址,最後免加/
- DST="https://xxxxx.xxx.com:8123"
- #截圖指令
- VNC=:0 gnome-screenshot -w -f /config/www/tmp/OX.png
- #Linebot推播圖片加訊息
- #aspectMode可選fit或是cover
- #cover會裁掉右邊,fit則是全圖但會比較小
- curl -v -X POST https://api.line.me/v2/bot/message/push \
- -H 'Content-Type: application/json' \
- -H "Authorization: Bearer "$TOKEN \
- -d "{
- \"to\": \"$USER_ID\",
- \"messages\": [
- {
- \"type\": \"flex\",
- \"altText\": \"$msg\",
- \"contents\":
- {
- \"type\": \"bubble\",
- \"hero\": {
- \"type\": \"image\",
- \"url\": \"$DST/local/tmp/OX.png?rnd=$RANDOM\",
- \"size\": \"full\",
- \"aspectMode\": \"cover\"
- },
- \"body\": {
- \"type\": \"box\",
- \"layout\": \"vertical\",
- \"contents\": [
- {
- \"type\": \"text\",
- \"text\": \"$msg\",
- \"weight\": \"regular\",
- \"size\": \"lg\",
- \"wrap\": true,
- \"margin\": \"md\"
- }
- ],
- \"offsetTop\": \"none\",
- \"spacing\": \"none\",
- \"margin\": \"none\",
- \"paddingBottom\": \"lg\",
- \"paddingTop\": \"none\"
- }
- }
- }
- ]
- }"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement