telegram-bot-api icon indicating copy to clipboard operation
telegram-bot-api copied to clipboard

Is it possible for Telegram to accept an edit but still return `MESSAGE_NOT_MODIFIED`?

Open nmlorg opened this issue 6 months ago • 4 comments

I'm a little stumped, please bear with me.

I have a bot that sent a message to a group yesterday at 7 a.m. US/Pacific, then edited it successfully at 12:10 this morning, but failed at 12:20 with a MESSAGE_NOT_MODIFIED:

2024-08-08 07:00:13,533 INFO reminders.py:161] Sending reminder to -1001xxx.
⋮
2024-08-09 00:10:06,885 INFO reminders.py:185] Editing reminder -1001xxx/1991.
⋮
2024-08-09 00:20:12,006 INFO reminders.py:185] Editing reminder -1001xxx/1991.
2024-08-09 00:20:14,872 ERROR reminders.py:199] While editing 1991 in -1001xxx:
There are a bunch of events coming up:

⋮
Traceback (most recent call last):
  File "lib/python3.10/site-packages/metabot/modules/reminders.py", line 188, in reminder_edit
    return bot.edit_message_caption(chat_id=groupid,
  File "lib/python3.10/site-packages/ntelebot/bot.py", line 71, in __call__
    raise ntelebot.errors.Error(data)
ntelebot.errors.Error: {'ok': False, 'error_code': 400, 'description': 'Bad Request: message is not modified: specified new message content and reply markup are exactly the same as a current content and reply markup of the message'}

  I don't have a record of what it [thinks it] sent at 12:10, but it includes a countdown to an event that took place at 4 p.m. today, and that message 1991 currently includes the string "¹⁵ʰ⁴⁰ᵐ", which is what it tried to send at 12:20. The only way I can think of for that to happen is if it sent the wrong countdown at 12:10 somehow but still recorded the correct one somehow:

00:10 (15h50m before the event)   send "15h40m"   record that it sent "15h50m" 00:20 (15h40m before the event)   send "15h40m"     error

  I've tried to figure out where MESSAGE_NOT_MODIFIED comes from, but haven't gotten very far.

Is it possible the 12:20 edit did actually go through, but Telegram returned MESSAGE_NOT_MODIFIED anyway?

If so, is there any way to confirm that that happened in this case?

nmlorg avatar Aug 10 '24 01:08 nmlorg