Closed agoukuaile closed 1 year ago
Please include the traceback. As it stands, the error may be legit.
@xxxx is a channel Now telegram allows 4 character usernames,in https://fragment.com/ we can buy 4 character username
in \telethon\utils.py file
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)$',
re.IGNORECASE
)
change To
VALID_USERNAME_RE = re.compile(
r'^([a-z](?:(?!__)\w){2,30}[a-z\d]'
r'|gif|vid|pic)$',
re.IGNORECASE
)
The above commit should allow any username between 3 and 32 characters now (as long as there is no trailing underscore or two underscores together).
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)$',
re.IGNORECASE
)
def main(username):
if VALID_USERNAME_RE.match(username):
print ('match')
else:
print ('not match')
main('didi')
The content of the print of the above code is not match
, I think this regularization is not correct
You are likely not using the latest version. The above commit may not be in PyPi yet.
Code that causes the issue
client.get_entity('xxxx')
Now telegram allows four-character usernames, but this method fails to get any four-character usernames
Expected behavior
a channel info
Actual behavior
Cannot find any entity corresponding to “xxxx”
Traceback
No response
Telethon version
1.28.5
Python version
3.9.13
Operating system (including distribution name and version)
Windows 11
Other details
No response
Checklist
pip install -U https://github.com/LonamiWebs/Telethon/archive/v1.zip
and triggered the bug in the latest version.