Update keyboard and Hello at startup
This commit is contained in:
15
bot.sh
15
bot.sh
@ -15,11 +15,6 @@ function sendPhoto {
|
||||
--data '{"chat_id": "'"$user"'", "photo": "'"$1"'", "caption": "'"$2"'"'"$3"'}'
|
||||
}
|
||||
|
||||
# 傳送貼圖
|
||||
function sendSticker {
|
||||
curl "https://api.telegram.org/bot$token/sendSticker?chat_id=$user&sticker=$1$2"
|
||||
}
|
||||
|
||||
function getRandomPhoto {
|
||||
declare -a PHOTO_URLS=(
|
||||
"https://imgur.com/p3Y0XU8.png"
|
||||
@ -29,21 +24,19 @@ function getRandomPhoto {
|
||||
echo ${PHOTO_URLS[RANDOM % ${#PHOTO_URLS[@]}]}
|
||||
}
|
||||
|
||||
sendMessage "你好,我會在你需要吃藥的時候提醒你哦~"
|
||||
while true; do
|
||||
# 早上 10 點
|
||||
if [ "$(date "+%H:%M")" == "10:00" ]; then
|
||||
sendSticker "CAADAQADWAQAAvoPCRQhPbMdi-bNqQI"
|
||||
sendPhoto $(getRandomPhoto) "吃了嗎~" ', "reply_markup": {"inline_keyboard": [[{"text": "😊吃了", "callback_data": "1"}, {"text": "😢等等", "callback_data": "2"}]]}'
|
||||
sendPhoto $(getRandomPhoto) "該吃藥囉~" ', "reply_markup": {"resize_keyboard": true, "keyboard": [[{"text": "😊吃了"}, {"text": "😢等等"}]]}'
|
||||
fi
|
||||
# 晚上 7 點半
|
||||
if [ "$(date "+%H:%M")" == "19:30" ]; then
|
||||
sendSticker "CAADAQADWAQAAvoPCRQhPbMdi-bNqQI"
|
||||
sendPhoto $(getRandomPhoto) "吃了嗎~" ', "reply_markup": {"inline_keyboard": [[{"text": "😊吃了", "callback_data": "1"}, {"text": "😢等等", "callback_data": "2"}]]}'
|
||||
sendPhoto $(getRandomPhoto) "該吃藥囉~" ', "reply_markup": {"resize_keyboard": true, "keyboard": [[{"text": "😊吃了"}, {"text": "😢等等"}]]}'
|
||||
fi
|
||||
# 晚上 11 點半
|
||||
if [ "$(date "+%H:%M")" == "23:30" ]; then
|
||||
sendSticker "CAADAQADWAQAAvoPCRQhPbMdi-bNqQI"
|
||||
sendPhoto $(getRandomPhoto) "吃了嗎" ', "reply_markup": {"inline_keyboard": [[{"text": "😊吃了", "callback_data": "1"}, {"text": "😢等等", "callback_data": "2"}]]}'
|
||||
sendPhoto $(getRandomPhoto) "該吃藥囉~" ', "reply_markup": {"resize_keyboard": true, "keyboard": [[{"text": "😊吃了"}, {"text": "😢等等"}]]}'
|
||||
fi
|
||||
sleep 60
|
||||
done
|
||||
|
Reference in New Issue
Block a user