nmlorg / metabot

Modularized, multi-account bot.
https://metabot.readthedocs.io/
5 stars 0 forks source link

Use `editMessageMedia` to keep daily announcements updated #111

Open nmlorg opened 4 days ago

nmlorg commented 4 days ago

https://core.telegram.org/bots/api#october-31-2024:

  • Introduced the ability to add media to existing text messages using the method editMessageMedia.

Depending on how this turns out, I'd like to start sending all announcements as text messages, immediately editing them to add media (if appropriate), and also keeping media updated (including removing it) as event titles/etc. change.

nmlorg commented 3 days ago

(After a power outage just for fun…)

Calling editMessageMedia on a sendMessaged message converts it to a media message altogether, and its existing text is simply discarded. If you want it to have text, you have to supply a caption= to editMessageMedia (as part of the media= argument).

So this would be a one-way process:  If the record for a message that didn't include any image when sent is changed so that the message would have included an image if it were sent now, we can go ahead and add the image. That's it :slightly_frowning_face:.