From 7500ca0d12179a20bb9caff5ec73b46da4eedb05 Mon Sep 17 00:00:00 2001 From: "Kay Marquardt (Gnadelwartz)" Date: Wed, 3 Mar 2021 15:57:58 +0100 Subject: [PATCH] modules: chatMember: fix user_is_botadmin --- modules/chatMember.sh | 4 ++-- test/d-user_is-test.sh | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/modules/chatMember.sh b/modules/chatMember.sh index 7b5add0..8089f2c 100644 --- a/modules/chatMember.sh +++ b/modules/chatMember.sh @@ -5,7 +5,7 @@ # This file is public domain in the USA and all free countries. # Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying) # -#### $$VERSION$$ v1.45-dev-69-gb454827 +#### $$VERSION$$ v1.45-dev-71-gac16103 # will be automatically sourced from bashbot @@ -149,7 +149,7 @@ user_is_botadmin() { [ -z "$1" ] && return 1 [ -z "${BOTADMIN}" ] && return 1 [[ "${BOTADMIN}" == "$1" || "${BOTADMIN}" == "$2" ]] && return 0 - if [ "${BOTADMIN}" = "?" ]; then setConfigKey "botadmin" "${1:-?}"; return 0; fi + if [ "${BOTADMIN}" = "?" ]; then setConfigKey "botadmin" "${1:-?}"; BOTADMIN="${1:-?}"; return 0; fi return 1 } diff --git a/test/d-user_is-test.sh b/test/d-user_is-test.sh index 8daf09b..5d19501 100755 --- a/test/d-user_is-test.sh +++ b/test/d-user_is-test.sh @@ -10,7 +10,7 @@ # LICENSE: WTFPLv2 http://www.wtfpl.net/txt/copying/ # AUTHOR: KayM (gnadelwartz), kay@rrr.de # -#### $$VERSION$$ v1.40-0-gf9dab50 +#### $$VERSION$$ v1.45-dev-71-gac16103 #=============================================================================== # include common functions and definitions @@ -22,6 +22,9 @@ set +f cd "${TESTDIR}" || exit 1 +# reset BOTADMIN +printf '["botadmin"] "?"\n' >>"${ADMINFILE}" # auto mode + # source bashbot.sh function, uncomment if you want to test functions # shellcheck source=./bashbot.sh source "${TESTDIR}/bashbot.sh" source @@ -33,8 +36,6 @@ source "${TESTDIR}/commands.sh" source # first user asking for botadmin will botadmin printf "Check \"user_is_botadmin\" ...\n" -printf '["botadmin"] "?"\n' >>"${ADMINFILE}" # auto mode - printf "BOTADMIN ...\n" user_is_botadmin "BOTADMIN" || exit 1 # should never fail printf "NOBOTADMIN ...\n"