Open laviua opened 4 years ago
You could probably write a validator, but i might be hard parsing the exact html or markdown that telegram requires and ignoring the rest basically.
Why exactly do you need to validate the text on your bots side? Is it brought in via an external source?
Our content manager, from time to time, uses a telegram bot for sending messages with the news, updates, etc. He uses online markdown editors and, after that, pastes to telegram mailing form. I faced the issue when telegram API could not receive the "invalid" markdown and replied with the error. That's why I'm asking...if it's ok and the end-user gets a message without formatting, it's also ok, but an exception is not ok
You could either try to write a validator, or handle the error from telegram correctly. Maybe just remove all markdown when telegram replies with an error or show that error to the user
I'd like to have this functionality built-in too. My use case is similar, there is an external source which sends messages so it would be really helpful to validate it before executing some send method. It's not so easy to recover from such error because there are multiple send method supporting markdown and I have a single entry point for all outgoing messages, so I have to check for each type and rebuild PartialBotApiMethod
for each type.
I write a validator for markdown style message. It can filter out invalid markdown style messages and send normal messages instead. I hope it will help you fix some problem。
Hi,
I faced with the problem when i use broadcasting to the users via telegram bot and could't find any specific markdown and html validator based on telegram api.
Will be it be useful to create validation by this requirements: https://core.telegram.org/bots/api#html-style
or could you please provide existed solution?
Thanks