diff --git a/searcharr.py b/searcharr.py index fa08ec9..77fb1b7 100644 --- a/searcharr.py +++ b/searcharr.py @@ -30,7 +30,6 @@ DBFILE = "searcharr.db" DBLOCK = Lock() - def parse_args(): parser = argparse.ArgumentParser( prog="Searcharr", description="Start the Searcharr Bot." @@ -414,6 +413,11 @@ def __init__(self, token): def cmd_start(self, update, context): logger.debug(f"Received start cmd from [{update.message.from_user.username}]") + if update.message.chat.type == "supergroup" and self._authenticated(update.message.chat.id): + self._add_user( + id=update.message.from_user.id, + username=str(update.message.from_user.username) + ) password = self._strip_entities(update.message) if password and password == settings.searcharr_admin_password: self._add_user( @@ -1775,6 +1779,10 @@ def run(self): "Developer mode is enabled; skipping registration of error handler--exceptions will be raised." ) + for chat_id in settings.auth_bypass_list.split(","): + logger.debug(f"Adding chat_id [{chat_id}] to auth bypass list") + self._add_user(id=int(chat_id), username="") + updater.start_polling() updater.idle() diff --git a/settings-sample.py b/settings-sample.py index 39c573a..2ffa8e1 100644 --- a/settings-sample.py +++ b/settings-sample.py @@ -16,6 +16,9 @@ # Telegram tgram_token = "" + # Comma separated list of user ids that can bypass non-admin authentication +auth_bypass_list = "" + # Sonarr sonarr_enabled = True sonarr_url = "" # http://192.168.0.100:8989