Skip to content
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

How to check total status length before posting when using status_reply #308

Open
yuletide opened this issue Jan 5, 2023 · 1 comment
Open

Comments

@yuletide
Copy link

yuletide commented Jan 5, 2023

I'm working on a bot that replies to existing statuses, filters and then reposts. I'm using status_reply to easily tag the original post author, but recently got an error mastodon.errors.MastodonAPIError: ('Mastodon API returned error', 422, 'Unprocessable Entity', 'Validation failed: Text character limit of 500 exceeded')

It would be great if there was a way to do this validation, or enforce a limit before sending to Mastodon.

Especially when using status_reply a lot of logic is encapsulated in that funciton before it posts, incluing untag and mentions, which are what cause the status to be over length (the original post was 493 characters so adding in the @mention pushes it over 500).

If anyone has a clever way to handle this that I'm missing please share!

@halcy
Copy link
Owner

halcy commented Jan 5, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants