mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-11-21 23:25:08 +00:00
fix nasty get_member_status bug, improve user_is_admin
This commit is contained in:
parent
fdc28e97f6
commit
b3d7918a15
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user