mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-12-31 22:01:46 +00:00
fix replacement of \n
This commit is contained in:
parent
8f03835ccc
commit
0b8c0476db
@ -5,7 +5,7 @@
|
|||||||
# This file is public domain in the USA and all free countries.
|
# This file is public domain in the USA and all free countries.
|
||||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||||
#
|
#
|
||||||
#### $$VERSION$$ v0.98-dev-59-g21f29a4
|
#### $$VERSION$$ v0.98-dev-62-g8f03835
|
||||||
|
|
||||||
# will be automatically sourced from bashbot
|
# will be automatically sourced from bashbot
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ send_normal_message() {
|
|||||||
until [ -z "${text}" ]; do
|
until [ -z "${text}" ]; do
|
||||||
if [ "${#text}" -le 4096 ]; then
|
if [ "${#text}" -le 4096 ]; then
|
||||||
sendJson "${1}" '"text":"'"${text}"'"' "${MSG_URL}"
|
sendJson "${1}" '"text":"'"${text}"'"' "${MSG_URL}"
|
||||||
unset text
|
break
|
||||||
else
|
else
|
||||||
len=4095
|
len=4095
|
||||||
[ "${text:4095:2}" != "\n" ] &&\
|
[ "${text:4095:2}" != "\n" ] &&\
|
||||||
@ -200,7 +200,8 @@ send_message() {
|
|||||||
[ -z "$2" ] && return
|
[ -z "$2" ] && return
|
||||||
local text keyboard btext burl no_keyboard file lat long title address sent
|
local text keyboard btext burl no_keyboard file lat long title address sent
|
||||||
text="$(sed <<< "${2}" 's/ mykeyboardend.*//;s/ *my[kfltab][a-z]\{2,13\}startshere.*//')$(sed <<< "${2}" -n '/mytextstartshere/ s/.*mytextstartshere//p')"
|
text="$(sed <<< "${2}" 's/ mykeyboardend.*//;s/ *my[kfltab][a-z]\{2,13\}startshere.*//')$(sed <<< "${2}" -n '/mytextstartshere/ s/.*mytextstartshere//p')"
|
||||||
text="${text//*([[:space:]])mynewlinestartshere*([[:space:]])/ \\n}"
|
#shellcheck disable=SC2001
|
||||||
|
text="$(sed <<< "${text}" 's/ *mynewlinestartshere */\\n/g')"
|
||||||
text="${text//$'\n'/\\n}"
|
text="${text//$'\n'/\\n}"
|
||||||
[ "$3" != "safe" ] && {
|
[ "$3" != "safe" ] && {
|
||||||
no_keyboard="$(sed <<< "${2}" '/mykeyboardendshere/!d;s/.*mykeyboardendshere.*/mykeyboardendshere/')"
|
no_keyboard="$(sed <<< "${2}" '/mykeyboardendshere/!d;s/.*mykeyboardendshere.*/mykeyboardendshere/')"
|
||||||
|
Loading…
Reference in New Issue
Block a user