mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-10 19:46:36 +03:00
Fix short special usernames not being valid (like vote)
This commit is contained in:
parent
ee51aa7073
commit
e3c6676795
|
@ -34,7 +34,16 @@ USERNAME_RE = re.compile(
|
|||
r'@|(?:https?://)?(?:www\.)?(?:telegram\.(?:me|dog)|t\.me)/(joinchat/)?'
|
||||
)
|
||||
|
||||
VALID_USERNAME_RE = re.compile(r'^[a-zA-Z][\w\d]{3,30}[a-zA-Z\d]$')
|
||||
# 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\d]{3,30}[a-z\d]'
|
||||
r'|gif|vid|pic|bing|wiki|imdb|bold|vote|like|coub)$',
|
||||
re.IGNORECASE
|
||||
)
|
||||
|
||||
|
||||
def get_display_name(entity):
|
||||
|
|
Loading…
Reference in New Issue
Block a user