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
Showing only changes of commit f735b691e4 - Show all commits

View File

@ -33,6 +33,11 @@ class Config():
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):
server = self.config.get("Bot", "telegram_bot_api_server") server = self.config.get("Bot", "telegram_bot_api_server")

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)