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

Symbols not escaped (Markdown/MarkdownV2) #149

Open
Geparder opened this issue May 25, 2023 · 3 comments
Open

Symbols not escaped (Markdown/MarkdownV2) #149

Geparder opened this issue May 25, 2023 · 3 comments
Labels

Comments

@Geparder
Copy link

"Thu May 25 2023 11:16:53 GMT+0000 (Coordinated Universal Time): GrammyError: Call to 'sendMessage' failed! (400: Bad Request: can't parse entities: Character '(' is reserved and must be escaped with the preceding '\')\n" +
2023-05-25T11:16:53.434547877Z ' at toGrammyError (/bot/node_modules/grammy/out/core/error.js:35:12)\n' +
2023-05-25T11:16:53.434553744Z ' at ApiClient.callApi (/bot/node_modules/grammy/out/core/client.js:86:48)'

@Geparder Geparder added the bug label May 25, 2023
@github-actions
Copy link

Hello there! As you are a first time Issuer please check whether your issue description is reasonable and complete. If you are having an issue always include the versions you are using (NodeJs, Typescript, ...) as well as a way to reproduce it. Thank you for reading! Now continue :)

@gituser
Copy link

gituser commented Jun 16, 2023

ping @bostrot

@gituser
Copy link

gituser commented Oct 16, 2023

There is an issue with escaping, e.g. if you try to send this text with MarkdownV2 syntax it will fail:

Test (
'elem1' => 'test123',
'elem2' => 'test345',
'elem3' => 'test444',
)

This is because of the escape rules defined here for urls - https://github.com/bostrot/telegram-support-bot/blob/master/src/middleware.ts#L41

The error in the log will look like this:

GrammyError: Call to 'sendMessage' failed! (400: Bad Request: can't parse entities: Character '=' is reserved and must be escaped with the preceding '\')

Easiest fix is to comment this block of code, but then again for URL markdown won't work.

Also noticed that MarkdownV2 strips all tags like code tags ``` and send to the user as a plaintext message.

Maybe you could take a look at this issue @bostrot.

It seems forwarding messages with MarkDownV2 e.g. with code blocks or using some other elements will not work for your users, guess it's something that should be added as a feature.

Thanks.

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

No branches or pull requests

2 participants