ok
This commit is contained in:
43
bot.sh
Executable file
43
bot.sh
Executable file
@ -0,0 +1,43 @@
|
||||
#!/bin/bash
|
||||
|
||||
token=$1
|
||||
user=$2
|
||||
|
||||
# 傳送訊息
|
||||
function sendMessage {
|
||||
curl "https://api.telegram.org/bot$token/sendMessage?chat_id=$user&text=$1"
|
||||
}
|
||||
|
||||
# 傳送照片
|
||||
function sendPhoto {
|
||||
curl "https://api.telegram.org/bot$token/sendPhoto?chat_id=$user&photo=$1&caption=$2"
|
||||
}
|
||||
|
||||
# 傳送貼圖
|
||||
function sendSticker {
|
||||
curl "https://api.telegram.org/bot$token/sendSticker?chat_id=$user&sticker=$1"
|
||||
}
|
||||
|
||||
# 主程式
|
||||
while true; do
|
||||
# 早上 9 點ㄘ吃黃色藥
|
||||
if [ "$(date "+%H:%M")" == "09:00" ]; then
|
||||
sendSticker "CAADAQADWAQAAvoPCRQhPbMdi-bNqQI"
|
||||
sendPhoto https://i.imgur.com/JA0tQPV.jpg "這次吃這顆"
|
||||
sleep 1m
|
||||
fi
|
||||
# 晚上 6 點ㄘ吃黃色藥
|
||||
if [ "$(date "+%H:%M")" == "18:00" ]; then
|
||||
sendSticker "CAADAQADWAQAAvoPCRQhPbMdi-bNqQI"
|
||||
sendPhoto https://i.imgur.com/JA0tQPV.jpg "這次吃這顆"
|
||||
sleep 1m
|
||||
fi
|
||||
# 晚上 11 點ㄘ吃白色藥
|
||||
if [ "$(date "+%H:%M")" == "23:00" ]; then
|
||||
sendSticker "CAADAQADWAQAAvoPCRQhPbMdi-bNqQI"
|
||||
sendPhoto https://i.imgur.com/hVZGmEH.jpg "這次吃這顆"
|
||||
sleep 1m
|
||||
fi
|
||||
|
||||
sleep 10s
|
||||
done
|
Reference in New Issue
Block a user