rafguns / new-in-qss

Mastodon bot tooting about new papers in journal QSS
https://botsin.space/@new_in_qss
2 stars 0 forks source link

Check number of characters in toot #3

Open rafguns opened 3 months ago

rafguns commented 3 months ago

We have some logic to truncate the toot if it gets too long. However, it ignores the fact that URLs are treated as a fixed length in Mastodon:

If you include links in your post, they must begin with http:// or https://. All links are counted as 23 characters, no matter how long they actually are, so there is no need to use a link shortener to save characters. In fact, using a link shortener is actively discouraged.

rafguns commented 3 months ago

The code in question is: https://github.com/rafguns/new-in-qss/blob/29a7d3fa0627badd2f852ce511bf8028aa91bf50/qss-paper-bot.py#L26-L32

Seems like we can just replace len(self.url) with 23?