mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-12-27 04:32:49 +00:00
better callback processing
This commit is contained in:
parent
9584068ea3
commit
cc4ac1a816
14
commands.sh
14
commands.sh
@ -15,7 +15,7 @@
|
||||
# This file is public domain in the USA and all free countries.
|
||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||
#
|
||||
#### $$VERSION$$ v1.35-dev-6-gc90b565
|
||||
#### $$VERSION$$ v1.35-dev-7-g9584068
|
||||
#
|
||||
|
||||
# bashbot locale defaults to c.UTF-8, adjust locale in mycommands.sh if needed
|
||||
@ -79,13 +79,13 @@ export FILE_REGEX="${BASHBOT_ETC}/.*"
|
||||
if [ -z "$1" ] || [[ "$1" == *"debug"* ]];then
|
||||
#################
|
||||
# detect inline and callback query
|
||||
if [[ -n "${iQUERY[ID]}" && "${INLINE:-0}" != "0" ]]; then
|
||||
# forward iinline query to optional dispatcher
|
||||
_exec_if_function myinlines
|
||||
if [ -n "${iQUERY[ID]}" ]; then
|
||||
# forward inline query to optional dispatcher
|
||||
[ "${INLINE:-0}" != "0" ] || _exec_if_function myinlines
|
||||
|
||||
elif [[ -n "${iBUTTON[ID]}" && "${CALLBACK:-0}" != "0" ]]; then
|
||||
# forward iinline query to optional dispatcher
|
||||
_exec_if_function mycallbacks
|
||||
elif [ -n "${iBUTTON[ID]}" ]; then
|
||||
# forward inline query to optional dispatcher
|
||||
[ "${CALLBACK:-0}" != "0" ] || _exec_if_function mycallbacks
|
||||
|
||||
#################
|
||||
# regular command
|
||||
|
@ -13,7 +13,7 @@
|
||||
# License: WTFPLv2 http://www.wtfpl.net/txt/copying/
|
||||
# Author: KayM (gnadelwartz), kay@rrr.de
|
||||
#
|
||||
#### $$VERSION$$ v1.35-dev-6-gc90b565
|
||||
#### $$VERSION$$ v1.35-dev-7-g9584068
|
||||
#######################################################
|
||||
# shellcheck disable=SC1117
|
||||
|
||||
@ -181,8 +181,8 @@ else
|
||||
|
||||
mycallbacks() {
|
||||
#######################
|
||||
# callbacks from buttons bot has attached to messages can processed here
|
||||
# we have no standard use case for processing callbacks, we log them based on user and chat
|
||||
# callbacks from buttons attached to messages will be processed here
|
||||
# no standard use case for processing callbacks, let's log them for some users and chats
|
||||
case "${USER[ID]}+${CHAT[ID]}" in
|
||||
'USERID1+'*) # do something for all callbacks from USER
|
||||
printf "%s: U=%s C=%s D=%s\n" "$(date)" "${iBOTTON[USER_ID]}" "${iBOTTON[CHAT_ID]}" "${iBUTTON[DATA]}"\
|
||||
|
Loading…
Reference in New Issue
Block a user