From 2826c942c06be8dff40f30eb1d5534c13f1d971b Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Fri, 9 Jun 2023 17:41:35 +0200 Subject: [PATCH] Support most usernames in VALID_USERNAME_RE See #4128. --- telethon/utils.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/telethon/utils.py b/telethon/utils.py index f7b830e7..f47912e1 100644 --- a/telethon/utils.py +++ b/telethon/utils.py @@ -60,14 +60,8 @@ TG_JOIN_RE = re.compile( r'tg://(join)\?invite=' ) -# The only shorter-than-five-characters usernames are those used for some -# special, very well known bots. This list may be incomplete though: -# "[...] @gif, @vid, @pic, @bing, @wiki, @imdb and @bold [...]" -# -# See https://telegram.org/blog/inline-bots#how-does-it-work VALID_USERNAME_RE = re.compile( - r'^([a-z](?:(?!__)\w){3,30}[a-z\d]' - r'|gif|vid|pic|bing|wiki|imdb|bold|vote|like|coub)$', + r'^[a-z](?:(?!__)\w){1,30}[a-z\d]$', re.IGNORECASE )