mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-25 19:03:46 +03:00
parent
7cac3668d6
commit
363c2604df
|
@ -90,7 +90,12 @@ class MessageParseMethods:
|
||||||
|
|
||||||
for i in reversed(range(len(msg_entities))):
|
for i in reversed(range(len(msg_entities))):
|
||||||
e = msg_entities[i]
|
e = msg_entities[i]
|
||||||
if isinstance(e, types.MessageEntityTextUrl):
|
if not e.length:
|
||||||
|
# 0-length MessageEntity is no longer valid #3884.
|
||||||
|
# Because the user can provide their own parser (with reasonable 0-length
|
||||||
|
# entities), strip them here rather than fixing the built-in parsers.
|
||||||
|
del msg_entities[i]
|
||||||
|
elif isinstance(e, types.MessageEntityTextUrl):
|
||||||
m = re.match(r'^@|\+|tg://user\?id=(\d+)', e.url)
|
m = re.match(r'^@|\+|tg://user\?id=(\d+)', e.url)
|
||||||
if m:
|
if m:
|
||||||
user = int(m.group(1)) if m.group(1) else e.url
|
user = int(m.group(1)) if m.group(1) else e.url
|
||||||
|
|
Loading…
Reference in New Issue
Block a user