From 4ca6ae50cc2d102f78f3727394b29aed4f63e8b3 Mon Sep 17 00:00:00 2001 From: kiriharu Date: Tue, 1 Jun 2021 21:34:34 +0300 Subject: [PATCH] fix session closing bug --- apps/tgbot/tgbot/handlers/helpers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/tgbot/tgbot/handlers/helpers.py b/apps/tgbot/tgbot/handlers/helpers.py index d316364..04e89c0 100644 --- a/apps/tgbot/tgbot/handlers/helpers.py +++ b/apps/tgbot/tgbot/handlers/helpers.py @@ -47,11 +47,12 @@ async def send_api_requests(endpoint: str, data: dict, nodes: List[APINode]): yield res -async def send_message_to_admins(message: str): +async def send_message_to_admins(message: str) -> None: if NOTIFICATION_BOT_TOKEN: bot = Bot(token=NOTIFICATION_BOT_TOKEN) for user in NOTIFICATION_USERS: logger.info(f"Sended notification to {user}") await bot.send_message(user, message, parse_mode='Markdown') + await bot.close() else: logger.warning(f"Notificator bot token not setted. Skipping send notifications to admin")