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

fix MarkdownV2 support in Telegram #1169

Merged
merged 4 commits into from Jul 12, 2020
Merged

fix MarkdownV2 support in Telegram #1169

merged 4 commits into from Jul 12, 2020

Conversation

greenx
Copy link
Contributor

@greenx greenx commented Jul 2, 2020

Without this, MarkdownM2 simply does not work.
Because only constant is taken from tgbotapi, here I just assigned the desired value.
Although in tgbotapi I also sent MR.

@z3bra
Copy link
Contributor

z3bra commented Jul 9, 2020

I gave it a go, and it works. However, this triggered a few issues for me when using MarkdownV2, and some messages were not relayed because the parsing failed:

time="2020-07-08T16:53:55+02:00" level=error msg="SendMessage failed: Bad Request: can't parse entities: Character '.' is reserved and must be escaped with the preceding '\'" func=handleMessage file="gateway/handlers.go:228" prefix=gateway
time="2020-07-08T16:56:18+02:00" level=error msg="SendMessage failed: Bad Request: can't parse entities: Character '(' is reserved and must be escaped with the preceding '\'" func=handleMessage file="gateway/handlers.go:228" prefix=gateway
time="2020-07-08T16:56:34+02:00" level=error msg="SendMessage failed: Bad Request: can't parse entities: Character ')' is reserved and must be escaped with the preceding '\'" func=handleMessage file="gateway/handlers.go:228" prefix=gateway
time="2020-07-08T17:04:51+02:00" level=error msg="SendMessage failed: Bad Request: can't parse entities: Character '!' is reserved and must be escaped with the preceding '\'" func=handleMessage file="gateway/handlers.go:228" prefix=gateway

This is probably expected though. It's just really annoying to loose messages because the "parsing failed".
The best solution to this would be to escape characters from the raw message before formatting it. But I'm not sure that'd fit every workflow…

@42wim
Copy link
Owner

42wim commented Jul 12, 2020

Yes, they should be escaped like mentioned in https://core.telegram.org/bots/api#markdownv2-style
But it's fine to keep this for another PR.

@42wim 42wim added this to the 1.18.0 milestone Jul 12, 2020
@42wim 42wim merged commit a94fe55 into 42wim:master Jul 12, 2020
@haykam821
Copy link
Contributor

Relates to #1203 and #1225.

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

Successfully merging this pull request may close these issues.

None yet

4 participants