From f8d98b8b97c55bc7a1d496e8cb8855b9ebbc43ce Mon Sep 17 00:00:00 2001 From: Dmitrii Morozov Date: Fri, 10 May 2024 17:15:09 +0200 Subject: Remove exception handler, increase timeout --- telegram_bot/__init__.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'telegram_bot/__init__.py') 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 -- cgit v1.2.3