J-Rios / TLG_JoinCaptchaBot

Telegram Bot to verify if users joining a group are human. The Bot sends an image captcha for each new user and kicks any of them who can't solve the captcha in a specified time.
GNU General Public License v3.0
532 stars 218 forks source link

[Bug] Welcome Message User Name Markdown Parse Fail #164

Closed J-Rios closed 2 years ago

J-Rios commented 2 years ago

Description

image

Sometimes, a welcome message is not sent on a group when a new user solves the captcha, but for other users it works. In the past was working ok.

Reason

The code escape user names to markdown when it is added to the welcome message, however by default it is escaped for markdown v1 and now python-telegram-bot framework request to send the message as markdown v2, so some characters like dots are not escaped as expected and the message can't be send.

Problem located at:

https://github.com/J-Rios/TLG_JoinCaptchaBot/blob/40c35c89d1373bec4225d247e5e2fb6138384ff3/sources/join_captcha_bot.py#L1156

J-Rios commented 2 years ago

Explicit escape markdown to v2 when using escape_markdown helper function of PTB framework should fix the issue:

https://github.com/J-Rios/TLG_JoinCaptchaBot/commit/2a1b10050bad2eda11f765998931af5fd16a24f4