From d54c860b16ad36c5d7666513a367b99ea317e9ef Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Wed, 8 Jun 2022 18:57:02 +0100 Subject: [PATCH] Add owner ID and default subscriber settings --- smsbot/__init__.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/smsbot/__init__.py b/smsbot/__init__.py index 7ad03d7..3d9f1c3 100644 --- a/smsbot/__init__.py +++ b/smsbot/__init__.py @@ -160,6 +160,16 @@ def main(): # Start bot telegram_bot = TelegramSmsBot(token) + + # Set the owner ID if configured + if 'SMSBOT_OWNER_ID' in os.environ: + telegram_bot.set_owner(os.environ.get('SMS_OWNER_ID')) + + # Add default subscribers + if 'SMSBOT_DEFAULT_SUBSCRIBERS' in os.environ: + for chat_id in os.environ.get('SMSBOT_DEFAULT_SUBSCRIBERS').split(','): + telegram_bot.add_subscriber(chat_id) + telegram_bot.start() # Start webhooks