From 89fdfdf14b2c3c6a85adfcc29e1fa6fdcc228818 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Tue, 19 Jan 2016 20:32:29 +0100 Subject: [PATCH] Removed token and added checks --- bashbot.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/bashbot.sh b/bashbot.sh index e4ef2ca..80befa6 100755 --- a/bashbot.sh +++ b/bashbot.sh @@ -12,7 +12,7 @@ # This file is public domain in the USA and all free countries. # If you're in Europe, and public domain does not exist, then haha. -TOKEN='179533649:AAHR470oLFSDD8WXy8L87uZFofxM6IDp5oU' +TOKEN='tokenhere' URL='https://api.telegram.org/bot'$TOKEN FORWARD_URL=$URL'/forwardMessage' @@ -199,10 +199,12 @@ process_client() { copid="$(cat $copidname 2>/dev/null)" if [ "$copid" = "" ]; then - curl -s ${URLS[*]} -o $NAME - send_file "${USER[ID]}" "$NAME" "$CAPTION" - rm "$NAME" - send_location "${USER[ID]}" "${LOCATION[LATITUDE]}" "${LOCATION[LONGITUDE]}" + [ "${URLS[*]}" != "" ] && { + curl -s ${URLS[*]} -o $NAME + send_file "${USER[ID]}" "$NAME" "$CAPTION" + rm "$NAME" + } + [ "${LOCATION[*]}" != "" ] && send_location "${USER[ID]}" "${LOCATION[LATITUDE]}" "${LOCATION[LONGITUDE]}" case $MESSAGE in '/question') startproc& @@ -224,6 +226,8 @@ Written by @topkecleon, Juan Potato (@awkward_potato), Lorenzo Santina (BigNerd9 Contribute to the project: https://github.com/topkecleon/telegram-bot-bash " ;; + '') + ;; *) send_message "${USER[ID]}" "$MESSAGE" esac