From 30b42356ab151090a51b5d1451a6ad9dbbacdddf Mon Sep 17 00:00:00 2001 From: Dmitrii Morozov Date: Wed, 8 May 2024 14:31:01 +0200 Subject: non-stop telebot polling --- fortnite_client/fortnite_events.py | 1 - telegram_bot/__init__.py | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/fortnite_client/fortnite_events.py b/fortnite_client/fortnite_events.py index d4fb2d0..01ca888 100644 --- a/fortnite_client/fortnite_events.py +++ b/fortnite_client/fortnite_events.py @@ -44,7 +44,6 @@ class NewFriendObserverImpl(NewFriendObserver): self.__stats_repository = stats_repository async def on_event(self, friend: User) -> None: - print('Record new friend stats') await self.__stats_repository.put_stats(friend) await self.__telegram_bot.send_message_to_all(format_new_friend(friend.display_name)) diff --git a/telegram_bot/__init__.py b/telegram_bot/__init__.py index ab9f61d..95b7af8 100644 --- a/telegram_bot/__init__.py +++ b/telegram_bot/__init__.py @@ -26,7 +26,10 @@ class TelegramBot: exception_handler=ExceptionHandler()) async def run(self): - await self.__bot.polling() + await self.__bot.polling( + non_stop=True, + timeout=100 + ) def register_command_handler(self, command: str, command_handler: CommandHandler): self.__bot.register_message_handler( -- cgit v1.2.3