search_global()¶
-
Client.search_global()¶ Search messages globally from all of your chats.
Note
Due to server-side limitations, you can only get up to around ~10,000 messages and each message retrieved will not have any reply_to_message field.
- Parameters
query (
str) – Text query string.limit (
int, optional) – Limits the number of messages to be retrieved. By default, no limit is applied and all messages are returned.
- Returns
Generator– A generator yieldingMessageobjects.
Example
# Search for "pyrogram". Get the first 420 results for message in app.search_global("pyrogram", limit=420): print(message.text)