From 3531eb9565d0fd80235f42aca4ec6465e814d983 Mon Sep 17 00:00:00 2001 From: "Kay Marquardt (Gnadelwartz)" Date: Mon, 24 Jun 2019 10:38:24 +0200 Subject: [PATCH] no send events when sourced --- bashbot.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bashbot.sh b/bashbot.sh index 758d7d9..b79bfba 100755 --- a/bashbot.sh +++ b/bashbot.sh @@ -11,7 +11,7 @@ # This file is public domain in the USA and all free countries. # Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying) # -#### $$VERSION$$ v0.94-dev2-5-gc5caf93 +#### $$VERSION$$ v0.94-dev2-6-g7843de5 # # Exit Codes: # - 0 sucess (hopefully) @@ -243,7 +243,7 @@ if [ "${BASHBOT_WGET}" = "" ] && _exists curl ; then -H "Content-Type: application/json" | "${JSONSHFILE}" -s -b -n )" BOTSENT[OK]="$(JsonGetLine '"ok"' <<< "$res")" BOTSENT[ID]="$(JsonGetValue '"result","message_id"' <<< "$res")" - [ "${BASHBOT_EVENT_SEND[*]}" != "" ] && event_send "send" "$@" & + [ "${SOURCE}" != "yes" ] && [ "${BASHBOT_EVENT_SEND[*]}" != "" ] && event_send "send" "$@" & } #$1 Chat, $2 what , $3 file, $4 URL, $5 caption sendUpload() { @@ -256,7 +256,7 @@ if [ "${BASHBOT_WGET}" = "" ] && _exists curl ; then res="$(curl -s -k ${BASHBOT_CURL_ARGS} "$4" -F "chat_id=$1" -F "$2=@$3;${3##*/}" | "${JSONSHFILE}" -s -b -n )" fi BOTSENT[OK]="$(JsonGetLine '"ok"' <<< "$res")" - [ "${BASHBOT_EVENT_SEND[*]}" != "" ] && event_send "upload" "$@" & + [ "${SOURCE}" != "yes" ] && [ "${BASHBOT_EVENT_SEND[*]}" != "" ] && event_send "upload" "$@" & } else # simple curl or wget call outputs result to stdout @@ -273,12 +273,12 @@ else --header='Content-Type:application/json' "${3}" | "${JSONSHFILE}" -s -b -n )" BOTSENT[OK]="$(JsonGetLine '"ok"' <<< "$res")" BOTSENT[ID]="$(JsonGetValue '"result","message_id"' <<< "$res")" - [ "${BASHBOT_EVENT_SEND[*]}" != "" ] && event_send "send" "$@" & + [ "${SOURCE}" != "yes" ] && [ "${BASHBOT_EVENT_SEND[*]}" != "" ] && event_send "send" "$@" & } sendUpload() { sendJson "$1" '"text":"Sorry, wget does not support file upload"' "${MSG_URL}" BOTSENT[OK]="false" - [ "${BASHBOT_EVENT_SEND[*]}" != "" ] && event_send "upload" "$@" & + [ "${SOURCE}" != "yes" ] && [ "${BASHBOT_EVENT_SEND[*]}" != "" ] && event_send "upload" "$@" & } fi