fix nasty get_member_status bug, improve user_is_admin

This commit is contained in:
Kay Marquardt 2020-05-14 08:04:19 +02:00 committed by GitHub
parent fdc28e97f6
commit b3d7918a15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,7 +16,7 @@ GETMEMBER_URL=$URL'/getChatMember'
# usage: status="$(get_chat_member_status "chat" "user")"
get_chat_member_status() {
sendJson "$1" 'user_id: '"$2"'' "$GETMEMBER_URL"
sendJson "$1" '"user_id":'"$2"'' "$GETMEMBER_URL"
# shellcheck disable=SC2154
JsonGetString '"result","status"' <<< "$res"
}
@ -39,6 +39,7 @@ user_is_creator() {
}
user_is_admin() {
[ "$1" = "$2" ] && return 0
local me; me="$(get_chat_member_status "$1" "$2")"
if [ "${me}" = "creator" ] || [ "${me}" = "administrator" ]; then return 0; fi
return 1