channels.SearchPosts

class pyrogram.raw.functions.channels.SearchPosts

Globally search for posts from public channels » (including those we aren’t a member of) containing either a specific hashtag, or a full text query.

Details:
  • Layer: 223

  • ID: F2C4F24D

Parameters:
  • offset_rate (int 32-bit) – Initially 0, then set to the next_rate parameter of messages.messagesSlice, or if that is absent, the date of the last returned message.

  • offset_peer (InputPeer) – Offsets for pagination, for more info click here

  • offset_id (int 32-bit) – Offsets for pagination, for more info click here

  • limit (int 32-bit) – Maximum number of results to return, see pagination

  • hashtag (str, optional) – The hashtag to search, without the # character.

  • query (str, optional) – The full text query: each user has a limited amount of free full text search slots, after which payment is required, see here » for more info on the full flow.

  • allow_paid_stars (int 64-bit, optional) – For full text post searches (query), allows payment of the specified amount of Stars for the search, see here » for more info on the full flow.

Returns:

messages.Messages

TL Schema

channels.searchPosts#f2c4f24d
flags:#
hashtag:flags.0?string
query:flags.1?string
offset_rate:int
offset_peer:InputPeer
offset_id:int
limit:int
allow_paid_stars:flags.2?long

= messages.Messages

Parameter Tree

SearchPosts
├── hashtagstring (optional)
├── querystring (optional)
├── offset_rateint
├── offset_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
├── offset_idint
├── limitint
└── allow_paid_starslong (optional)

Example

await app.invoke(
    SearchPosts(
        hashtag="text",
        query="text",
        offset_rate=0,
        offset_peer=await app.resolve_peer(chat_id),
        offset_id=0,
        limit=0,
        allow_paid_stars=0,
    )
)