doc: add iBUTTON variables

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2021-01-27 19:05:12 +01:00
parent a3eec98491
commit 279a9e7ca3
2 changed files with 30 additions and 11 deletions

View File

@ -30,7 +30,7 @@ BOTCOMMANDS="-h help init start stop status suspendback resumeback killb
# 8 - curl/wget missing
# 10 - not bash!
#
#### $$VERSION$$ v1.35-dev-30-ge83f4d4
#### $$VERSION$$ v1.35-dev-31-ga3eec98
##################################################################
# emmbeded system may claim bash but it is not
@ -870,11 +870,9 @@ process_inline_button() {
# debugging for impelemetation
local num="$1"
iBUTTON[DATA]="${UPD["result,${num},callback_query,data"]}"
#iBUTTON[CHAT_INSTANCE]="${UPD["result,${num},callback_query,chat_instance"]}"
#iBUTTON[INLINE_ID]="${UPD["result,${num},callback_query,inline_message_id"]}"
iBUTTON[CHAT_ID]="${UPD["result,${num},callback_query,message,chat,id"]}"
iBUTTON[MESSAGE_ID]="${UPD["result,${num},callback_query,message,message_id"]}"
iBUTTON[MEESSAGE]="$(JsonDecode "${UPD["result,${num},callback_query,message,text"]}")"
iBUTTON[MESSAGE]="$(JsonDecode "${UPD["result,${num},callback_query,message,text"]}")"
# XXX should we give back pressed button, all buttons or nothing?
iBUTTON[USER_ID]="${UPD["result,${num},callback_query,from,id"]}"
iBUTTON[FIRST_NAME]="$(JsonDecode "${UPD["result,${num},callback_query,from,first_name"]}")"

View File

@ -33,14 +33,19 @@ Have FUN!
├── JSON.sh # bashbots JSON parser, see https://github.com/dominictarr/JSON.sh
├── bin # ready to use scripts, use `scriptname --help` for help
│   ├── bashbot_stats.sh # does what it says ...
│   ├── send_broadcast.sh # send message to all known chats
│   ├── send_message.sh # send message to given chat
│   ├── edit_message.sh # replace given message id in given chat
│   ├── delete_message.sh # delete given message id in given chat
│   ├── send_broadcast.sh # send message to all known chats
│   ├── send_file.sh # send file to given chat
│   ├── bashbot_stats.sh # does what it says ...
│   ├── delete_message.sh # delete given message id in given chat
│   ├── send_buttons.sh # send message with attached button
│   ├── edit_buttons.sh # attach/edit message buttons
│   ├── kickban_user.sh # kick/unban user from given chat
│   ├── promote_user.sh # promote/dente user rights in given chat
│ │
│   └── bashbot_env.inc.sh # bashbot location included from scripts, adapt if needed
│   └── bashbot_env.inc.sh # sourced from scripts, adapt locations if needed
│   └── bashbot_init.inc.sh # sourced from bashbot.sh init
├── scripts # place your bashbot interactive and background scripts here
│   └── interactive.sh.clean # interactive script template for new scripts
@ -91,6 +96,7 @@ Start or Stop your Bot use the following commands:
```
### Scripts in bin/
Use `script.sh -h` or `script --help` to get short/long help for script.
To count the total number of users and messages run the following command:
@ -244,8 +250,7 @@ e.g. if a new user joins a chat MESSAGE is set to "/_new_chat_user".
### Inline query messages
Inline query messages are small, non regular messages used for interaction with the user,
Inline query messages are special messages used for interaction with the user,
they contain the following variables only:
* `${iQUERY}`: Current inline query
@ -256,6 +261,22 @@ they contain the following variables only:
* `${iQUERY[LAST_NAME]}`: User's last name
### Callback button messages
Callback button messages special messages swedn from callback buttons,
they contain the following variables only:
* `$iBUTTON`: This array contains the ID, First name, last name, username and user id of the user clicked on the button
* `${iBUTTON[ID]}`: Callback query ID
* `${iBUTTON[DATA]`: Data attached to button, hopefully unique
* `${iBUTTON[CHAT_ID]`: Chat where button was pressed
* `${iBUTTON[MESSAGE_ID]`: Message to which button is attached
* `${iBUTTON[MESSAGE]`: Text of message
* `${iBUTTON[USER_ID]}`: User's id
* `${iBUTTON[FIRST_NAME]}`: User's first name
* `${iBUTTON[LAST_NAME]}`: User's last name
* `${iBUTTON[USERNAME]}`: User's @username
## Send data / get response
After every `send_xxx` `get_xxx` call the array BOTSENT contains the most important values from Telegram response.
@ -351,5 +372,5 @@ send_action "${CHAT[ID]}" "action"
#### [Prev Create Bot](1_firstbot.md)
#### [Next Advanced Usage](3_advanced.md)
#### $$VERSION$$ v1.30-0-g3266427
#### $$VERSION$$ v1.35-dev-31-ga3eec98