modules: fix new_chat_invite

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2021-01-14 22:56:43 +01:00
parent 29fa5cfcca
commit 8ae30faffc
2 changed files with 6 additions and 3 deletions

View File

@ -30,7 +30,7 @@ BOTCOMMANDS="-h help init start stop status suspendback resumeback killb
# 8 - curl/wget missing # 8 - curl/wget missing
# 10 - not bash! # 10 - not bash!
# #
#### $$VERSION$$ v1.30-dev-12-g0739a51 #### $$VERSION$$ v1.30-dev-13-g29fa5cf
################################################################## ##################################################################
# emmbeded system may claim bash but it is not # emmbeded system may claim bash but it is not
@ -558,7 +558,9 @@ sendJsonResult(){
[ -n "${BASHBOTDEBUG}" ] && log_message "New Result ==========\n$1" [ -n "${BASHBOTDEBUG}" ] && log_message "New Result ==========\n$1"
BOTSENT[OK]="$(JsonGetLine '"ok"' <<< "$1")" BOTSENT[OK]="$(JsonGetLine '"ok"' <<< "$1")"
if [ "${BOTSENT[OK]}" = "true" ]; then if [ "${BOTSENT[OK]}" = "true" ]; then
BOTSENT[RESULT]="$(JsonGetString '"result"' <<< "$1")"
BOTSENT[ID]="$(JsonGetValue '"result","message_id"' <<< "$1")" BOTSENT[ID]="$(JsonGetValue '"result","message_id"' <<< "$1")"
BOTSENT[CHAT]="$(JsonGetValue '"result","chat","id"' <<< "$1")"
return return
# hot path everything OK! # hot path everything OK!
else else

View File

@ -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$$ v1.30-dev-11-gab71f37 #### $$VERSION$$ v1.30-dev-13-g29fa5cf
# will be automatically sourced from bashbot # will be automatically sourced from bashbot
@ -17,6 +17,7 @@ eval "$(basename "${BASH_SOURCE[0]}")(){ :; }"
# $1 chat # $1 chat
new_chat_invite() { new_chat_invite() {
sendJson "$1" "" "${URL}/exportChatInviteLink" sendJson "$1" "" "${URL}/exportChatInviteLink"
[ "${BOTSENT[OK]}" = "true" ] && printf "%s\n" "${BOTSENT[RESULT]}"
} }
# $1 chat, $2 title # $1 chat, $2 title
@ -46,7 +47,7 @@ unpin_chat_message() {
# $1 chat # $1 chat
unpinall_chat_message() { unpinall_chat_message() {
sendJson "$1" "" "${URL}/unpinAllChatMessage" sendJson "$1" "" "${URL}/unpinAllChatMessages"
} }
# $1 chat # $1 chat