fixed issue with whitespace in inline keyboard text field
This commit is contained in:
parent
6483a070b0
commit
dc0cf65d2c
|
@ -114,7 +114,7 @@ mkinline_kbd(){
|
||||||
local -n rows="${1}"
|
local -n rows="${1}"
|
||||||
local -n text="${2}"
|
local -n text="${2}"
|
||||||
local -n data="${3}"
|
local -n data="${3}"
|
||||||
local kbd="reply_markup={\"inline_keyboard\":[]}"
|
local kbd="{\"inline_keyboard\":[]}"
|
||||||
local unit="\"text\":\"\",\"callback_data\":\"\""
|
local unit="\"text\":\"\",\"callback_data\":\"\""
|
||||||
local rowformat="[]"
|
local rowformat="[]"
|
||||||
local colformat="{}"
|
local colformat="{}"
|
||||||
|
@ -143,7 +143,7 @@ mkinline_kbd(){
|
||||||
for i in "${data[@]}"; do
|
for i in "${data[@]}"; do
|
||||||
kbd="$(sed "s/\"callback_data\":\"\"/\"callback_data\":\"${i}\"/" <<< "${kbd}")"
|
kbd="$(sed "s/\"callback_data\":\"\"/\"callback_data\":\"${i}\"/" <<< "${kbd}")"
|
||||||
done
|
done
|
||||||
sed "s/^\|$/\"/g" <<< "${kbd}"
|
sed "s/ /+/g;:a;N;$!ba;s/\n/%0A/g" <<< "${kbd}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# $1 is target chat_id
|
# $1 is target chat_id
|
||||||
|
@ -154,7 +154,7 @@ sendmsg() {
|
||||||
-d "text=${2}")" \
|
-d "text=${2}")" \
|
||||||
|| sentmsg="$(curl -sX GET "${api_url}sendMessage" -d "chat_id=${1}" \
|
|| sentmsg="$(curl -sX GET "${api_url}sendMessage" -d "chat_id=${1}" \
|
||||||
-d "text=${2}" \
|
-d "text=${2}" \
|
||||||
-d "${3}")"
|
-d "reply_markup=${3}")"
|
||||||
[ ! -z "${sentmsg}" ] && printf "%s\n" "${sentmsg}"\
|
[ ! -z "${sentmsg}" ] && printf "%s\n" "${sentmsg}"\
|
||||||
| sed 's/^{"ok":false.*\|^{"ok":true,"result":{\|}$//g'\
|
| sed 's/^{"ok":false.*\|^{"ok":true,"result":{\|}$//g'\
|
||||||
>> "${bot_tmpdir}sentmsgs.txt"
|
>> "${bot_tmpdir}sentmsgs.txt"
|
||||||
|
|
Loading…
Reference in New Issue