From ae157c4042710d5e977ef706991cb97c2d7af2ea Mon Sep 17 00:00:00 2001 From: "Kay Marquardt (Gnadelwartz)" Date: Fri, 12 Apr 2019 14:04:57 +0200 Subject: [PATCH] Bashbot Version 0.52 - missing fi --- commands.sh | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/commands.sh b/commands.sh index db84e54..e411a53 100755 --- a/commands.sh +++ b/commands.sh @@ -4,10 +4,11 @@ # This file is public domain in the USA and all free countries. # Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying) # -#### $$VERSION$$ v0.52-0-gdb7b19f +#### $$VERSION$$ v0.52-1-gdb7b19f # # shellcheck disable=SC2154 # shellcheck disable=SC2034 +SC2034="$CONTACT" # mute CONTACT not used ;-) # adjust your language setting here, e.g.when run from other user or cron. # https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment @@ -19,7 +20,7 @@ unset IFS # set -f # if you are paranoid use set -f to disable globbing -# chnage Info anf Help to fit your needs +# change Info anf Help to fit your needs bashbot_info() { send_markdown_message "${1}" 'This is bashbot, the Telegram bot written entirely in bash. It features background tasks and interactive chats, and can serve as an interface for CLI programs. @@ -40,6 +41,18 @@ Get the code in my [GitHub](http://github.com/topkecleon/telegram-bot-bash) ' } +# some handy shortcuts, e.g.: +_is_botadmin() { + user_is_botadmin "${USER[ID]}" +} +_is_admin() { + user_is_admin "${CHAT[ID]}" "${USER[ID]}" +} +_is_allowed() { # $1 = resource + user_is_allowed "${USER[ID]}" "$1" "${CHAT[ID]}" +} + + if [ "$1" = "source" ];then # Place the token in the token file TOKEN="$(cat token)" @@ -123,6 +136,7 @@ else bot_help "${CHAT[ID]}" else send_normal_message "${CHAT[ID]}" "You are not allowed to start Bot." + fi ;; '/leavechat') # bot leave chat if user is admin in chat