Exclude send info update message #5

Merged
tema merged 1 commits from testing into master 2023-02-03 00:14:56 +03:00
3 changed files with 8 additions and 0 deletions

View File

@ -32,6 +32,11 @@ class Config():
def admin_user(self): def admin_user(self):
usrs = self.config.get("Users", "admin_users").split(',') usrs = self.config.get("Users", "admin_users").split(',')
return [int(user_id) for user_id in usrs] 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 @property
def telegram_bot_api_server(self): def telegram_bot_api_server(self):

View File

@ -20,6 +20,7 @@ link = https://example.com/parse_me
;Uncomment this variable, if you use filters to users ;Uncomment this variable, if you use filters to users
;allowed_users = 0,1,2,3 ;allowed_users = 0,1,2,3
admin_users = 0,1,2,3 admin_users = 0,1,2,3
exclude = 1,2,3
[DataBase] [DataBase]
enable_logging = yes enable_logging = yes

View File

@ -16,6 +16,8 @@ async def announce():
message = "Ошибка обновления данных!" message = "Ошибка обновления данных!"
if config.admin_user is not None: if config.admin_user is not None:
for user_id in config.admin_user: for user_id in config.admin_user:
if user_id in config.exclude_send_msg:
continue
await dp.bot.send_message(user_id, message) await dp.bot.send_message(user_id, message)