mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2025-01-27 07:38:25 +00:00
modules: chatMember: fix user_is_botadmin
This commit is contained in:
parent
ac16103361
commit
7500ca0d12
@ -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
|
||||
}
|
||||
|
||||
|
@ -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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user