From f41496bb3cfa93018690b4d256e0ab4ba2f41810 Mon Sep 17 00:00:00 2001 From: Pin Lin Date: Wed, 8 Sep 2021 19:17:25 +0800 Subject: [PATCH] Update keyboard and Hello at startup --- bot.sh | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/bot.sh b/bot.sh index e17430d..4dbe66c 100755 --- a/bot.sh +++ b/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