fail gracefully when trying to delete /price command resposne messages

This commit is contained in:
Mike Shultz 2020-05-12 13:03:20 -06:00
parent 0df85d831e
commit b52d67076a
1 changed files with 8 additions and 4 deletions

12
bot.py
View File

@ -668,10 +668,14 @@ class TelegramMonitorBot:
and self.last_message_out.get('type') == 'price'
and self.last_message_out['message'].message_id
):
bot.delete_message(
chat_id,
self.last_message_out['message'].message_id
)
try:
bot.delete_message(
chat_id,
self.last_message_out['message'].message_id
)
except Exception as err:
print('Unable to delete previous price message: ', err)
print(traceback.format_exc())
self.last_message_out = {
'type': 'price',