Searching messages - LonamiWebs/Telethon GitHub Wiki
Use the search
, filter
or from_id
parameters in client.get_messages
:
# 10 messages containing "hello"
hello = client.get_messages(chat, 10, search='hello')
# 10 messages containing photos
from telethon.tl.types import InputMessagesFilterPhotos
photo = client.get_messages(chat, 10, filter=InputMessagesFilterPhotos)
# What's the total count of photos shared in this chat?
print(photo.total)