We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0c9e9a6 commit 0c56d39Copy full SHA for 0c56d39
1 file changed
db/observer.py
@@ -101,9 +101,13 @@ def _send_update_message(self, update_message):
101
.objects(subject=subject,
102
observer=official_observer)\
103
.order_by('-datetime').first()
104
- telegram_message = BotTelegramCore.forward_message(
105
- to_chat_id=self.chat_id,
106
- from_chat_id=official_observer.chat_id,
107
- message_id=last_official_message.message_id
108
- )
109
- self._create_message(telegram_message.message_id, subject)
+ try:
+ telegram_message = BotTelegramCore.forward_message(
+ to_chat_id=self.chat_id,
+ from_chat_id=official_observer.chat_id,
+ message_id=last_official_message.message_id
+ )
110
+ self._create_message(telegram_message.message_id, subject)
111
+ except BadRequest:
112
+ last_official_message.delete()
113
+ update_message.delete()
0 commit comments