我正在使用它并且可以作業。但是如何把一個按鈕自爆訊息?我嘗試了很多,但仍然不知道。
對不起,我忘了告訴它是關于 Telegram bot api 的。我想發送一個按鈕爆炸的訊息。
function sendadmin(){
if [ "$admin_id" -ne "$chat_id" ]; then
curl -s \
-d parse_mode="MarkdownV2" \
-d text="$stext" \
-d chat_id="$admin_id" \
-d -sendChatAction="videos" \
-d reply_markup="" \
https://api.telegram.org/bot$bot_token/sendMessage
fi
}
stext="||Hello darling||"
sendadmin
我試過解決這個問題。這是回傳Bad Request: can't parse reply keyboard markup JSON object錯誤。
uj5u.com熱心網友回復:
reply=$(cat <<-EOF
{
"inline_keyboard": [
[
{
"text": "Button1",
"callback_data": "lt"
},
{
"text": "Button1",
"callback_data": "rt"
}
],
[
{
"text": "Button3",
"callback_data": "ls"
}
]
]
}
EOF
)
用于將該jsoncar <<EOF EOF格式賦予變數,然后像reply_markup="$reply". 我就是這樣發現的。
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/433640.html
