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

Fixing url detection error #193

Closed vlab97 closed 9 months ago

vlab97 commented 9 months ago

Fixed definition of numeric value format 9.00, 09.00, 12.30, etc. Previously it was mistakenly considered a link

J-Rios commented 9 months ago

Hello, thanks for the contribution.

However, instead of adding more code to exclude this specific case, the correct way to solve this issue is to fix the URL Regex in order to avoid detection of that kind of time formats as URLs...

So the issue is related to detection of some of the next strings formats as URLs:

N.N
N.NN
NN.N
NN.NN

Where N is a number from 0-9.

Due an URL TLD cannot be a number, it can be solve by the URL regex itself. The problem is that the Regex used for detecting an URL is not working properly with the TLDs...

Info regarding current Bot code for URL detection:

I will take a look why the Regex is not working as expected...

J-Rios commented 9 months ago

The problem seems to be due an extra '|' character after the last TLD:

imagen

J-Rios commented 9 months ago

The next commit should fix the issue:

Fix URL Regex detection ignoring TLDs

Closing this Pull Request.

This change will be tested, merged and Bot accounts will be update with it in next Bot version update (maybe at the end of this year).

Best Regards :)