nmlorg / metabot

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

Edited announcement crossing the sendPhoto character limit #94

Closed nmlorg closed 4 months ago

nmlorg commented 5 months ago

Just ran into an edge case related to #76:  A message was sent containing 10 events, which came out as 948 rendered characters and so was sent as a photo + caption. During the day, an 11th event was added, pushing the caption to 1072 rendered characters. The bot sent its "Updated:" message, then failed the editMessageCaption call, and dutifully moved on — but then sent another "Updated:" message every hour.

There's no way to convert a sendPhoto message to a sendMessage message, so I think the options are:

  1. Go back to the idea of calculating the rendered characters myself (and silently truncating if it exceeds the [hard-coded] character limit).
  2. Send a new announcement from scratch.
  3. Record the update as having gone through even though it hasn't.
  4. Ignore the update (and deleteMessage the "Updated:" message).

All of these seem pretty poor. I guess 2 might be the best of the worst...

nmlorg commented 5 months ago

Option 5:  Send the image as one message, then the announcement as a second message (always using sendMessage). No more caption limits, no more downgrading to plain text, no more flakiness. Obviously this would mean daily announcements would [sometimes] be two separate messages now.

Option 6:  Just turn the images off (at least if they're not manually set).

nmlorg commented 5 months ago

The photo isn't super useful to me. I would turn it off if it allowed for more characters for events lol