diff options
author | Dmitrii Morozov <snoopdesigns@gmail.com> | 2024-05-10 17:15:09 +0200 |
---|---|---|
committer | Dmitrii Morozov <snoopdesigns@gmail.com> | 2024-05-10 17:15:09 +0200 |
commit | f8d98b8b97c55bc7a1d496e8cb8855b9ebbc43ce (patch) | |
tree | 546fec6cf7db3e7bba0e18ee7da45e6002f9bb54 | |
parent | 8c7cd39bbdf860e77888f550bae1eb9d50ca47bc (diff) |
Remove exception handler, increase timeout
-rw-r--r-- | telegram_bot/__init__.py | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/telegram_bot/__init__.py b/telegram_bot/__init__.py index 1c68ade..5e3d455 100644 --- a/telegram_bot/__init__.py +++ b/telegram_bot/__init__.py @@ -22,13 +22,12 @@ class TelegramBot: raise AssertionError("Please configure TELEBOT_BOT_TOKEN as environment variables") self.__bot = telebot.async_telebot.AsyncTeleBot( - token=os.environ["TELEBOT_BOT_TOKEN"], - exception_handler=ExceptionHandler()) + token=os.environ["TELEBOT_BOT_TOKEN"]) async def run(self): await self.__bot.polling( non_stop=True, - timeout=100 + timeout=500 ) def register_command_handler(self, command: str, command_handler: CommandHandler): @@ -52,10 +51,4 @@ class TelegramBot: await self.__bot.reply_to( message, message_text, - parse_mode='MarkdownV2') - -class ExceptionHandler(telebot.ExceptionHandler): - def handle(self, exception): - logging.error('TeleBot exception happened: {}'.format(str(exception))) - logging.error(traceback.format_exc()) - return True
\ No newline at end of file + parse_mode='MarkdownV2')
\ No newline at end of file |