diff --git a/bashbot.sh b/bashbot.sh index d3d763d..62dc1bf 100755 --- a/bashbot.sh +++ b/bashbot.sh @@ -30,7 +30,7 @@ BOTCOMMANDS="-h help init start stop status suspendback resumeback killb # 8 - curl/wget missing # 10 - not bash! # -#### $$VERSION$$ v1.30-dev-31-g161e883 +#### $$VERSION$$ v1.30-dev-32-g172a9e5 ################################################################## # emmbeded system may claim bash but it is not @@ -1133,9 +1133,10 @@ bot_init() { # adjust values in bashbot.rc if [ -w "bashbot.rc" ]; then printf "Adjust user and botname in bashbot.rc ...\n" - sed -i '/^[# ]*runas=/ s/runas=.*$/runas="'"${touser}"'"/' "bashbot.rc" + sed -i '/^[# ]*runas=/ s|runas=.*$|runas="'"${touser}"'"|' "bashbot.rc" + sed -i '/^[# ]*bashbot=/ s|bashbot=.*$|bashbot="cd '"${PWD}"'; '"${PWD}"'/'"${0##*/}"'"|' "bashbot.rc" botname="$(getConfigKey "botname")" - [ -n "${botname}" ] && sed -i '/^[# ]*name=/ s/name=.*$/name="'"${botname}"'"/' "bashbot.rc" + [ -n "${botname}" ] && sed -i '/^[# ]*name=/ s|name=.*$|name="'"${botname}"'"|' "bashbot.rc" printf "Done.\n" fi # ask to check bottoken online diff --git a/modules/chatMember.sh b/modules/chatMember.sh index fdd983b..d53b679 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.30-dev-28-gd269f98 +#### $$VERSION$$ v1.30-dev-31-g161e883 # will be automatically sourced from bashbot @@ -115,16 +115,16 @@ user_is_allowed() { [ -z "$1" ] && return 1 user_is_admin "$1" && return 0 # user can do everything - grep -F -xq "$1:*:*" <"${BOTACL}" && return 0 + grep -F -xq "$1:*:*" "${BOTACL}" && return 0 [ -z "$2" ] && return 1 # user is allowed todo one action in every chat - grep -F -xq "$1:$2:*" <"${BOTACL}" && return 0 + grep -F -xq "$1:$2:*" "${BOTACL}" && return 0 # all users are allowed to do one action in every chat - grep -F -xq "ALL:$2:*" <"${BOTACL}" && return 0 + grep -F -xq "ALL:$2:*" "${BOTACL}" && return 0 [ -z "$3" ] && return 1 # user is allowed to do one action in one chat - grep -F -xq "$1:$2:$3" <"${BOTACL}" && return 0 + grep -F -xq "$1:$2:$3" "${BOTACL}" && return 0 # all users are allowed to do one action in one chat - grep -F -xq "ALL:$2:$3" <"${BOTACL}" && return 0 + grep -F -xq "ALL:$2:$3" "${BOTACL}" && return 0 return 1 }