Added conditional to prevent exceeding of 500 characters limit of API
This commit is contained in:
parent
068b03c578
commit
036d6a3358
|
@ -104,6 +104,11 @@ for account in transitions:
|
||||||
mastodon_text += "\n\nPosted " + parse(str(status.created_at)).strftime("%d. %B %Y - %H:%M on Twitter")
|
mastodon_text += "\n\nPosted " + parse(str(status.created_at)).strftime("%d. %B %Y - %H:%M on Twitter")
|
||||||
mastodon_text += "\nOrigin: https://twitter.com/" + account['twitter_handle'] + "/status/" + tweet_origin
|
mastodon_text += "\nOrigin: https://twitter.com/" + account['twitter_handle'] + "/status/" + tweet_origin
|
||||||
|
|
||||||
|
# Make sure that 500 char limit of Mastodon-API doesn't break the script
|
||||||
|
if len(mastodon_text) > 500:
|
||||||
|
mastodon_text = mastodon_text[:489]
|
||||||
|
|
||||||
|
|
||||||
# Output text to stdout respect. post it to Mastodon.
|
# Output text to stdout respect. post it to Mastodon.
|
||||||
print(mastodon_text)
|
print(mastodon_text)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue