mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-12-28 12:50:44 +00:00
modules: JsonEscape button text
This commit is contained in:
parent
e923e2e8fc
commit
8854e03ece
@ -6,7 +6,7 @@
|
||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||
#
|
||||
# shellcheck disable=SC1117
|
||||
#### $$VERSION$$ v1.31-dev-6-gf2dd64c
|
||||
#### $$VERSION$$ v1.31-dev-7-ge923e2e
|
||||
|
||||
# will be automatically sourced from bashbot
|
||||
|
||||
@ -145,9 +145,9 @@ send_inline_keyboard() {
|
||||
}
|
||||
|
||||
|
||||
# $1 CHAT $2 message $3 button text
|
||||
# $1 CHAT $2 message $3 button text $4 button url
|
||||
send_button() {
|
||||
send_inline_keyboard "$1" "$2" '[{"text":"'"$3"'", "url":"'"$4"'"}]'
|
||||
send_inline_keyboard "$1" "$2" '[{"text":"'"$(JsonEscape "$3")"'", "url":"'"$4"'"}]'
|
||||
}
|
||||
|
||||
# helper function to create json for a button row
|
||||
@ -158,7 +158,7 @@ _button_row() {
|
||||
for arg in "$@"
|
||||
do
|
||||
[ -n "${json}" ] && json+=","
|
||||
json+='{"text":"'"${arg%|*}"'", "url":"'"${arg##*|}"'"}'
|
||||
json+='{"text":"'"$(JsonEscape "${arg%|*}")"'", "url":"'"${arg##*|}"'"}'
|
||||
done
|
||||
printf "[%s]" "${json}"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user