mycommands: better iBUTTONS example

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2021-01-26 20:59:10 +01:00
parent fa0cb75c60
commit cbf3945e4f
2 changed files with 19 additions and 4 deletions

View File

@ -13,7 +13,7 @@
# License: WTFPLv2 http://www.wtfpl.net/txt/copying/
# Author: KayM (gnadelwartz), kay@rrr.de
#
#### $$VERSION$$ v1.35-dev-14-g08a0524
#### $$VERSION$$ v1.35-dev-20-gfa0cb75
#######################################################
# shellcheck disable=SC1117
@ -203,8 +203,11 @@ else
return
;;
*) # all other callbacks are processed here
: # your processing here ...
:
# your processing here ...
if [[ -n "${iBUTTON[CHAT_ID]}" && -n "${iBUTTON[MESSAGE_ID]}" ]]; then
# output random button if message data is available
edit_inline_buttons "${iBUTTON[CHAT_ID]}" "${iBUTTON[MESSAGE_ID]}" "Button ${RANDOM}|${RANDOM}"
fi
# Telegram needs an ack each callback query, default empty
answer_callback_query "${iBUTTON[ID]}" ""
;;

View File

@ -10,7 +10,7 @@
# License: WTFPLv2 http://www.wtfpl.net/txt/copying/
# Author: KayM (gnadelwartz), kay@rrr.de
#
#### $$VERSION$$ v1.30-0-g3266427
#### $$VERSION$$ v1.35-dev-18-ge4ee880
#######################################################
# shellcheck disable=SC1117
@ -77,6 +77,18 @@ else
esac
}
mycallbacks() {
#######################
# callbacks from buttons attached to messages will be processed here
case "${iBUTTON[USER_ID]}+${iBUTTON[CHAT_ID]}" in
*) # all other callbacks are processed here
: # your processing here ...
:
# Telegram needs an ack each callback query, default empty
answer_callback_query "${iBUTTON[ID]}" ""
;;
esac
}
myinlines() {
#######################
# this fuinction is called only if you has set INLINE=1 !!