prevented empty messages from ending up in updates or sentmsgs
This commit is contained in:
parent
4574806ca6
commit
601128b856
|
@ -159,8 +159,8 @@ sendmsg() {
|
|||
|| sentmsg="$(curl -sX GET "${api_url}sendMessage" -d "chat_id=${1}" \
|
||||
-d "text=${2}" \
|
||||
-d "reply_markup=${3}")"
|
||||
[ ! -z "${sentmsg}" ] && sed 's/^{"ok":false.*\|^{"ok":true,"result":{\|}$//g'\
|
||||
<<< "${sentmsg}" >> "${bot_tmpdir}sentmsgs.txt"
|
||||
sentmsg="$(sed 's/^{"ok":false.*\|^{"ok":true,"result":{\|}$//g' <<< "${sentmsg}")"
|
||||
[ ! -z "${sentmsg}" ] && printf "%s\n" "${sentmsg}" >> "${bot_tmpdir}sentmsgs.txt"
|
||||
}
|
||||
|
||||
# $1 is target chat_id
|
||||
|
@ -174,8 +174,8 @@ replymsg() {
|
|||
-d "text=${3}")" ||
|
||||
sentmsg="$(curl -sX GET "${api_url}sendMessage" -d "chat_id=${1}" -d "reply_to_message_id=${2}"\
|
||||
-d "text=${3}" -d "reply_markup=${4}")"
|
||||
[ ! -z "${sentmsg}" ] && sed 's/^{"ok":false.*\|^{"ok":true,"result":{\|}$//g'\
|
||||
<<< "${sentmsg}" >> "${bot_tmpdir}sentmsgs.txt"
|
||||
sentmsg="$(sed 's/^{"ok":false.*\|^{"ok":true,"result":{\|}$//g' <<< "${sentmsg}")"
|
||||
[ ! -z "${sentmsg}" ] && printf "%s\n" "${sentmsg}" >> "${bot_tmpdir}sentmsgs.txt"
|
||||
}
|
||||
|
||||
# $1 is target chat_id
|
||||
|
@ -184,11 +184,11 @@ replymsg() {
|
|||
# $4 is inline keyboard (optional)
|
||||
editmsg() {
|
||||
local editmsg
|
||||
[ -z "${3}" ] && editmsg="$(curl -sX GET "${api_url}editMessageText" -d "chat_id=${1}" -d "message_id=${2}" \
|
||||
[ -z "${4}" ] && editmsg="$(curl -sX GET "${api_url}editMessageText" -d "chat_id=${1}" -d "message_id=${2}" \
|
||||
-d "text=${3}")" || editmsg="$(curl -sX GET "${api_url}editMessageText" -d "chat_id=${1}" -d "message_id=${2}" \
|
||||
-d "text=${3}" -d "reply_markup=${4}")"
|
||||
[ ! -z "${editmsg}" ] && sed 's/^{"ok":false.*\|^{"ok":true,"result":{\|}$//g'\
|
||||
<<< "${editmsg}" >> "${bot_tmpdir}sentmsgs.txt"
|
||||
editmsg="$(sed 's/^{"ok":false.*\|^{"ok":true,"result":{\|}$//g' <<< "${editmsg}")"
|
||||
[ ! -z "${editmsg}" ] && printf "%s\n" "${editmsg}" >> "${bot_tmpdir}sentmsgs.txt"
|
||||
}
|
||||
|
||||
# $1 is target chat_id
|
||||
|
|
Loading…
Reference in New Issue