messages.Search

class pyrogram.raw.functions.messages.Search

Search for messages.

Details:
  • Layer: 223

  • ID: 29EE847A

Parameters:
  • peer (InputPeer) – User or chat, histories with which are searched, or (inputPeerEmpty) constructor to search in all private chats and normal groups (not channels) ». Use messages.searchGlobal to search globally in all chats, groups, supergroups and channels.

  • q (str) – Text search request

  • filter (MessagesFilter) – Filter to return only specified message types

  • min_date (int 32-bit) – If a positive value was transferred, only messages with a sending date bigger than the transferred one will be returned

  • max_date (int 32-bit) – If a positive value was transferred, only messages with a sending date smaller than the transferred one will be returned

  • offset_id (int 32-bit) – Only return messages starting from the specified message ID

  • add_offset (int 32-bit) – Additional offset

  • limit (int 32-bit) – Number of results to return, can be 0 to only return the message counter.

  • max_id (int 32-bit) – Maximum message ID to return

  • min_id (int 32-bit) – Minimum message ID to return

  • hash (int 64-bit) – Hash

  • from_id (InputPeer, optional) – Only return messages sent by the specified user ID

  • saved_peer_id (InputPeer, optional) – Search within the saved message dialog » with this ID.

  • saved_reaction (List of Reaction, optional) – You may search for saved messages tagged » with one or more reactions using this flag.

  • top_msg_id (int 32-bit, optional) – Thread ID

Returns:

messages.Messages

TL Schema

messages.search#29ee847a
flags:#
peer:InputPeer
q:string
from_id:flags.0?InputPeer
saved_peer_id:flags.2?InputPeer
saved_reaction:flags.3?Vector<Reaction>
top_msg_id:flags.1?int
filter:MessagesFilter
min_date:int
max_date:int
offset_id:int
add_offset:int
limit:int
max_id:int
min_id:int
hash:long

= messages.Messages

Parameter Tree

Search
├── peerInputPeer
│ ├── InputPeerEmpty
│ ├── InputPeerSelf
│ ├── InputPeerChat
│ │ └── chat_idlong
│ ├── InputPeerUser
│ │ ├── user_idlong
│ │ └── access_hashlong
│ ├── InputPeerChannel
│ │ ├── channel_idlong
│ │ └── access_hashlong
│ │ ├── peerInputPeer
│ │ │ ├── InputPeerEmpty
│ │ │ ├── InputPeerSelf
│ │ │ ├── InputPeerChat
│ │ │ ├── InputPeerUser
│ │ │ ├── InputPeerChannel
│ │ │ ├── InputPeerUserFromMessage
│ │ │ └── InputPeerChannelFromMessage
│ │ ├── msg_idint
│ │ └── user_idlong
│ ├── peerInputPeer
│ │ ├── InputPeerEmpty
│ │ ├── InputPeerSelf
│ │ ├── InputPeerChat
│ │ ├── InputPeerUser
│ │ ├── InputPeerChannel
│ │ ├── InputPeerUserFromMessage
│ │ └── InputPeerChannelFromMessage
│ ├── msg_idint
│ └── channel_idlong
├── qstring
├── from_idInputPeer (optional)
│ ├── InputPeerEmpty
│ ├── InputPeerSelf
│ ├── InputPeerChat
│ │ └── chat_idlong
│ ├── InputPeerUser
│ │ ├── user_idlong
│ │ └── access_hashlong
│ ├── InputPeerChannel
│ │ ├── channel_idlong
│ │ └── access_hashlong
│ │ ├── peerInputPeer
│ │ │ ├── InputPeerEmpty
│ │ │ ├── InputPeerSelf
│ │ │ ├── InputPeerChat
│ │ │ ├── InputPeerUser
│ │ │ ├── InputPeerChannel
│ │ │ ├── InputPeerUserFromMessage
│ │ │ └── InputPeerChannelFromMessage
│ │ ├── msg_idint
│ │ └── user_idlong
│ ├── peerInputPeer
│ │ ├── InputPeerEmpty
│ │ ├── InputPeerSelf
│ │ ├── InputPeerChat
│ │ ├── InputPeerUser
│ │ ├── InputPeerChannel
│ │ ├── InputPeerUserFromMessage
│ │ └── InputPeerChannelFromMessage
│ ├── msg_idint
│ └── channel_idlong
├── saved_peer_idInputPeer (optional)
│ ├── InputPeerEmpty
│ ├── InputPeerSelf
│ ├── InputPeerChat
│ │ └── chat_idlong
│ ├── InputPeerUser
│ │ ├── user_idlong
│ │ └── access_hashlong
│ ├── InputPeerChannel
│ │ ├── channel_idlong
│ │ └── access_hashlong
│ │ ├── peerInputPeer
│ │ │ ├── InputPeerEmpty
│ │ │ ├── InputPeerSelf
│ │ │ ├── InputPeerChat
│ │ │ ├── InputPeerUser
│ │ │ ├── InputPeerChannel
│ │ │ ├── InputPeerUserFromMessage
│ │ │ └── InputPeerChannelFromMessage
│ │ ├── msg_idint
│ │ └── user_idlong
│ ├── peerInputPeer
│ │ ├── InputPeerEmpty
│ │ ├── InputPeerSelf
│ │ ├── InputPeerChat
│ │ ├── InputPeerUser
│ │ ├── InputPeerChannel
│ │ ├── InputPeerUserFromMessage
│ │ └── InputPeerChannelFromMessage
│ ├── msg_idint
│ └── channel_idlong
├── saved_reactionVector < Reaction > (optional)
│ ├── ReactionEmpty
│ ├── ReactionEmoji
│ │ └── emoticonstring
│ ├── ReactionCustomEmoji
│ │ └── document_idlong
│ └── ReactionPaid
├── top_msg_idint (optional)
├── filterMessagesFilter
│ │ └── missedtrue (optional)
├── min_dateint
├── max_dateint
├── offset_idint
├── add_offsetint
├── limitint
├── max_idint
├── min_idint
└── hashlong

Example

await app.invoke(
    Search(
        peer=await app.resolve_peer(chat_id),
        q="text",
        from_id=await app.resolve_peer(chat_id),
        saved_peer_id=await app.resolve_peer(chat_id),
        saved_reaction=[
                ReactionEmpty()
            ],
        top_msg_id=0,
        filter=InputMessagesFilterEmpty(),
        min_date=0,
        max_date=0,
        offset_id=0,
        add_offset=0,
        limit=0,
        max_id=0,
        min_id=0,
        hash=0,
    )
)