-
Notifications
You must be signed in to change notification settings - Fork 612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible for Telegram to accept an edit but still return MESSAGE_NOT_MODIFIED
?
#624
Comments
I was just preparing to push a fix for a bug in my code that's triggered by this situation, and it seems the situation just happened again; same bot, but different group:
The message in question does currently say "¹⁵ ʰᵒᵘʳˢ Sat 10ᵗʰ, 12–2ᵖᵐ". |
The error is returned by the Telegram servers. They compare the current message content and the new content provided by the bot. If they match, then the request is aborted and edit isn't performed. But you may handle the error as if the edit succeeded, because content of the message is already exactly as you have requested to be. The likely cause of the issue is the request sent twice in parallel by the bot, one of which succeeds, and one of which fails with the error. |
When Google Calendar first came out, a tool I wrote used to create duplicate events fairly often. Eventually it was determined that I would send a single "create" request to the API servers, then the API servers would send an RPC to create the event, and then a separate RPC for each attendee (I believe something to do with creating reminders). If any of the per-attendee RPCs failed, even transiently, the API server just immediately returned a 500 — it didn't roll back the event creation, but also didn't return the new event's id, so it existed (at least partially) but was completely orphaned.
I had to run a separate job once a week that downloaded the entirety of every calendar I managed and just deleted any events that weren't in my cache. They switched data stores a few years later and the problem went away (I think the new DS allowed them to run the whole create operation inside a transaction). Anyway, TBA has been so reliable for the past 7 years I haven't bothered to add any kind of retry logic, and I haven't been seeing any "conflict" errors (that would have suggested multiple instances of the bot were running somehow). Is it possible "api.telegram.org" is forwarding my request to something else, getting maybe a network error, and resending the request on my behalf? I don't send edit requests unless the copy of the message in my cache is different from what the message is [now] supposed to be. So if I send an edit, and the API server tells me the content hasn't changed, that means the copy in my cache is incorrect. There's no way to retrieve a message by id, right? I suppose I could |
The chance of this is extremely low, so I would say that it is impossible. It is much more likely that the request to api.telegram.org is retried because of a network error. If you receive "message is not modified" error, then message content is already as you want it to be. You must not do anything additionally with the message. |
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
: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?
The text was updated successfully, but these errors were encountered: