Verified Commit 1863a27c authored by Mroik's avatar Mroik
Browse files

Added different type of admin chan

parent c8247b24
...@@ -6,7 +6,10 @@ PORT = int(environ.get("BITS_PORT", default=1883)) ...@@ -6,7 +6,10 @@ PORT = int(environ.get("BITS_PORT", default=1883))
USERNAME = environ.get("BITS_USER") USERNAME = environ.get("BITS_USER")
PASSWORD = environ.get("BITS_PASSWORD", default="") PASSWORD = environ.get("BITS_PASSWORD", default="")
TG_KEY = environ.get("BITS_TG_KEY", default="") TG_KEY = environ.get("BITS_TG_KEY", default="")
ADMIN_CHANNELS = [] # Channels that are allowed to change HQ's status ADMIN_CHANNELS_FULL = [] # Channels that are allowed to change HQ's status
ADMIN_CHANNELS_PRIV = [] # Channels that are allowed to change HQ's status
for chan in environ.get("BITS_TG_GROUPS", default="").split(":"): for chan in environ.get("BITS_TG_GROUPS_FULL", default="").split(":"):
ADMIN_CHANNELS.append(chan) ADMIN_CHANNELS_FULL.append(chan)
for chan in environ.get("BITS_TG_GROUPS_PRIV", default="").split(":"):
ADMIN_CHANNELS_PRIV.append(chan)
...@@ -7,7 +7,7 @@ from telegram import Update, Message ...@@ -7,7 +7,7 @@ from telegram import Update, Message
import mt import mt
from mt.const import OPEN, CLOSED from mt.const import OPEN, CLOSED
from config import ADMIN_CHANNELS from config import ADMIN_CHANNELS_PRIV, ADMIN_CHANNELS_FULL
LOGGER = logging.getLogger(__name__) LOGGER = logging.getLogger(__name__)
...@@ -23,7 +23,9 @@ def on_message(update: Update, context: CallbackContext): ...@@ -23,7 +23,9 @@ def on_message(update: Update, context: CallbackContext):
def check_admin(update: Update, context: CallbackContext): def check_admin(update: Update, context: CallbackContext):
if str(update.message.chat.id) not in ADMIN_CHANNELS: if str(update.message.chat.id) in ADMIN_CHANNELS_FULL:
return True
if str(update.message.chat.id) not in ADMIN_CHANNELS_PRIV:
raise DispatcherHandlerStop raise DispatcherHandlerStop
is_admin = False is_admin = False
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment