mirror of
https://github.com/house-of-vanity/Wireguard-Peer-Manager.git
synced 2025-07-07 01:34:08 +00:00
Add multi admin mode
This commit is contained in:
4
bot.py
4
bot.py
@ -19,7 +19,7 @@ logging.basicConfig(
|
|||||||
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
token = os.environ.get('TG_TOKEN')
|
token = os.environ.get('TG_TOKEN')
|
||||||
admin = os.environ.get('TG_ADMIN')
|
admin = os.environ.get('TG_ADMIN').replace('"', '').replace(' ', '').split(',')
|
||||||
if not token or not admin:
|
if not token or not admin:
|
||||||
log.error("Env var TG_TOKEN or TG_ADMIN aren't set.")
|
log.error("Env var TG_TOKEN or TG_ADMIN aren't set.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@ -34,7 +34,7 @@ def _help(update, context):
|
|||||||
|
|
||||||
def auth(handler):
|
def auth(handler):
|
||||||
def wrapper(update, context):
|
def wrapper(update, context):
|
||||||
if update.message.chat.username != admin:
|
if update.message.chat.username not in admin:
|
||||||
update.message.reply_text(
|
update.message.reply_text(
|
||||||
'You are not allowed to do that.', parse_mode='HTML', disable_web_page_preview=True)
|
'You are not allowed to do that.', parse_mode='HTML', disable_web_page_preview=True)
|
||||||
return False
|
return False
|
||||||
|
Reference in New Issue
Block a user