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

12
bot.py
View File

@ -668,10 +668,14 @@ class TelegramMonitorBot:
and self.last_message_out.get('type') == 'price' and self.last_message_out.get('type') == 'price'
and self.last_message_out['message'].message_id and self.last_message_out['message'].message_id
): ):
bot.delete_message( try:
chat_id, bot.delete_message(
self.last_message_out['message'].message_id 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 = { self.last_message_out = {
'type': 'price', 'type': 'price',