Killer Bean
Killer Bean

Reputation: 31

how to search for links using telethon

Is there any way I can filter the messages I get from:

client.get_messages()

to a spasific pattern? (in this case links)

I can filter it after I get all the messages but if there is a way to do it earlier that would be better.

Upvotes: 0

Views: 536

Answers (1)

MustA
MustA

Reputation: 1148

get_messages (or iter_messages) supports filter argument that takes any of MessagesFilter constructors.

so in your case, use:

await client.get_messages(chat,
    filter=telethon.types.InputMessagesFilterUrl()
)

Upvotes: 3

Related Questions