From f735b691e4b956180014b83a74b01f45e8828249 Mon Sep 17 00:00:00 2001 From: tema Date: Thu, 2 Feb 2023 23:10:35 +0200 Subject: [PATCH] Exclude send info update message --- configs/module.py | 5 +++++ example_config.ini | 1 + utils/announcements.py | 2 ++ 3 files changed, 8 insertions(+) diff --git a/configs/module.py b/configs/module.py index ae18fab..2cc3a2b 100644 --- a/configs/module.py +++ b/configs/module.py @@ -32,6 +32,11 @@ class Config(): def admin_user(self): usrs = self.config.get("Users", "admin_users").split(',') return [int(user_id) for user_id in usrs] + + @property + def exclude_send_msg(self): + usrs = self.config.get("Users", "exclude").split(',') + return [int(user_id) for user_id in usrs] @property def telegram_bot_api_server(self): diff --git a/example_config.ini b/example_config.ini index c95a10a..757ea69 100644 --- a/example_config.ini +++ b/example_config.ini @@ -20,6 +20,7 @@ link = https://example.com/parse_me ;Uncomment this variable, if you use filters to users ;allowed_users = 0,1,2,3 admin_users = 0,1,2,3 +exclude = 1,2,3 [DataBase] enable_logging = yes diff --git a/utils/announcements.py b/utils/announcements.py index 75d9a02..8562176 100644 --- a/utils/announcements.py +++ b/utils/announcements.py @@ -16,6 +16,8 @@ async def announce(): message = "Ошибка обновления данных!" if config.admin_user is not None: for user_id in config.admin_user: + if user_id in config.exclude_send_msg: + continue await dp.bot.send_message(user_id, message)