mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-11-21 23:25:08 +00:00
doc: add answer_callback_query
This commit is contained in:
parent
2222875e2b
commit
b096338c33
@ -289,6 +289,7 @@ In both cases the message itself is not changed, only the attached inline keyboa
|
||||
|
||||
To create a JSON button array I suggest to use `_button_row`.
|
||||
|
||||
*example:*
|
||||
```bash
|
||||
# message without button
|
||||
send_markdownv2_message "${CHAT[ID]}" "*HI* this is a _markdown_ message ..."
|
||||
@ -306,6 +307,18 @@ edit_markdownv2_message "${CHAT[ID]}" "*HI* this is a _markdown_ message inline
|
||||
|
||||
```
|
||||
|
||||
##### answer_callback_query
|
||||
Each request send from a callback button must be answered by a call to `answer_callback_query`.
|
||||
If alert is given an alert will be shown by the Telegram client instead of a notification.
|
||||
|
||||
*usage:* answer_callback_query "iBUTTON[ID]" "text notification ..." ["alert"]
|
||||
|
||||
*example:*
|
||||
```bash
|
||||
answer_callback_query "${iBUTTON[ID]}" "Button data is: ${iBUTTON[DATA]}"
|
||||
|
||||
answer_callback_query "${iBUTTON[ID]}" "Alert: Button pressed!" "alert"
|
||||
```
|
||||
|
||||
----
|
||||
|
||||
@ -1342,5 +1355,5 @@ The name of your bot is available as bash variable "$ME", there is no need to ca
|
||||
#### [Prev Best Practice](5_practice.md)
|
||||
#### [Next Notes for Developers](7_develop.md)
|
||||
|
||||
#### $$VERSION$$ v1.35-dev-10-g70a3c19
|
||||
#### $$VERSION$$ v1.35-dev-16-g2222875
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||
#
|
||||
# shellcheck disable=SC1117
|
||||
#### $$VERSION$$ v1.35-dev-15-gb441384
|
||||
#### $$VERSION$$ v1.35-dev-16-g2222875
|
||||
|
||||
# will be automatically sourced from bashbot
|
||||
|
||||
@ -174,7 +174,7 @@ _button_row() {
|
||||
printf "[%s]" "${json}"
|
||||
}
|
||||
|
||||
# $1 callback id, $2 test to show, alert if not empty
|
||||
# $1 callback id, $2 text to show, alert if not empty
|
||||
answer_callback_query() {
|
||||
local alert
|
||||
[ -n "$3" ] && alert='","show_alert": true'
|
||||
|
Loading…
Reference in New Issue
Block a user