mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-11-25 16:57:33 +00:00
fix bot_is_admin
This commit is contained in:
parent
1b8a1d4253
commit
b0281f1f32
@ -5,7 +5,7 @@
|
|||||||
# This file is public domain in the USA and all free countries.
|
# This file is public domain in the USA and all free countries.
|
||||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||||
#
|
#
|
||||||
#### $$VERSION$$ v1.2-1-gd30a700
|
#### $$VERSION$$ v1.2-2-g1b8a1d4
|
||||||
|
|
||||||
# will be automatically sourced from bashbot
|
# will be automatically sourced from bashbot
|
||||||
|
|
||||||
@ -45,12 +45,12 @@ user_is_creator() {
|
|||||||
|
|
||||||
# $1 chat
|
# $1 chat
|
||||||
bot_is_admin() {
|
bot_is_admin() {
|
||||||
[ "${2:-+}" ] && return 0
|
user_is_admin "$1" "$(getConfigKey "botid")"
|
||||||
user_is_admin "$2" "$(getConfigKey "botid")"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# $1 chat # $2 user
|
# $1 chat # $2 user
|
||||||
user_is_admin() {
|
user_is_admin() {
|
||||||
|
[[ -z "$1" || -z "$2" ]] && return 1
|
||||||
[ "${1:--}" == "${2:-+}" ] && return 0
|
[ "${1:--}" == "${2:-+}" ] && return 0
|
||||||
user_is_botadmin "$2" && return 0
|
user_is_botadmin "$2" && return 0
|
||||||
local me; me="$(get_chat_member_status "$1" "$2")"
|
local me; me="$(get_chat_member_status "$1" "$2")"
|
||||||
@ -60,6 +60,7 @@ user_is_admin() {
|
|||||||
|
|
||||||
# $1 user
|
# $1 user
|
||||||
user_is_botadmin() {
|
user_is_botadmin() {
|
||||||
|
[ -z "$1" ] && return 1
|
||||||
local admin; admin="$(getConfigKey "botadmin")"; [ -z "${admin}" ] && return 1
|
local admin; admin="$(getConfigKey "botadmin")"; [ -z "${admin}" ] && return 1
|
||||||
[[ "${admin}" == "${1}" || "${admin}" == "${2}" ]] && return 0
|
[[ "${admin}" == "${1}" || "${admin}" == "${2}" ]] && return 0
|
||||||
#[[ "${admin}" = "@*" ]] && [[ "${admin}" = "${2}" ]] && return 0
|
#[[ "${admin}" = "@*" ]] && [[ "${admin}" = "${2}" ]] && return 0
|
||||||
|
Loading…
Reference in New Issue
Block a user