diff --git a/setup.py b/setup.py index eaec96b..83d089b 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name='telegram-task-bot', - version='0.1.0', + version='0.1.1', license='LGPLv3', description='Library for writing task based telegram bots', long_description=open('README.md').read(), diff --git a/telegramtaskbot/Tasks/UrlTask.py b/telegramtaskbot/Tasks/UrlTask.py index 118cf64..7f057fb 100644 --- a/telegramtaskbot/Tasks/UrlTask.py +++ b/telegramtaskbot/Tasks/UrlTask.py @@ -21,8 +21,13 @@ def callback(self, context: telegram.ext.CallbackContext): response_message = self.get_data() self.logger.info(f'Notifying {len(users)} users for {self.job_name}') for user in users: - context.bot.send_message(chat_id=user, text=response_message, - disable_notification=self.disable_notifications) + try: + self.logger.info(f'Notifying {user}') + context.bot.send_message(chat_id=user, text=response_message, + disable_notification=self.disable_notifications) + except telegram.TelegramError as e: + self.logger.info(f'Error occurred while notifying {user}') + self.logger.error(e.message) def get_actual_value(self, joblist: [], update: telegram.Update, context: telegram.ext.CallbackContext): self.handle_get_actual_value(context, update.callback_query.message.chat_id)