Improved entities handling
This commit is contained in:
parent
7218d580bb
commit
177d456e79
@ -66,8 +66,16 @@ async def msg_destination_group(app: Client, msg: Message):
|
||||
for entity in entities:
|
||||
if entity.type == MessageEntityType.TEXT_LINK:
|
||||
analytics_entry["entities"]["links"].append(entity.url)
|
||||
elif entity.type == MessageEntityType.URL:
|
||||
analytics_entry["entities"]["links"].append(
|
||||
text[entity.offset : entity.offset + entity.length]
|
||||
)
|
||||
elif entity.type == MessageEntityType.TEXT_MENTION:
|
||||
analytics_entry["entities"]["mentions"].append(entity.user.id)
|
||||
elif entity.type == MessageEntityType.MENTION:
|
||||
analytics_entry["entities"]["mentions"].append(
|
||||
text[entity.offset : entity.offset + entity.length]
|
||||
)
|
||||
|
||||
lang = Detector(text, quiet=True).language
|
||||
|
||||
|
Reference in New Issue
Block a user