Probably not the answer OP was expecting, but still sharing so others may find this useful.
I've been trying to 'validate' the MarkDown messages to prevent the Bad Request: can't parse entities:
error received by Telegram. For example, the same issue this user encountered
Unfortunately I was unable to parse this with 100% accuracy, probably because (as you already mentioned) Telegram doesn't use the default Markdown syntax.
My 'solution' as I've implemented in quite some bots, and is working decent.
After sending a message (I've created a custom function to prevent duplicate code), check if Telegram responded with the Bad Request: can't parse entities
error, If so, send the same message again, but this time with HTML
parse_mode
, this way there won't be any parse errors.
Not the most clean solution, but it gets the message to the user, and that was my greatest concern.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…