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. Exactly one of query and hashtag must be set.
func (c *Client) ChannelsSearchPosts(ctx context.Context, request *ChannelsSearchPostsRequest) (MessagesMessagesClass, error)
Calling this method
client.Run(ctx, func(ctx context.Context) error {
api := client.API()
res, err := api.ChannelsSearchPosts(ctx, &tg.ChannelsSearchPostsRequest{
// see Parameters
})
if err != nil {
return err
}
_ = res // MessagesMessagesClass
return nil
})
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
Hashtag | string | — | The hashtag to search, without the # character. |
Query | string | — | 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. |
OffsetRate | int | yes | Initially 0, then set to the next_rate parameter of messages.messagesSlice, or if that is absent, the date of the last returned message. |
OffsetPeer | InputPeerClass | yes | Offsets for pagination, for more info click here |
OffsetID | int | yes | Offsets for pagination, for more info click here |
Limit | int | yes | Maximum number of results to return, see pagination |
AllowPaidStars | int64 | — | 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
Possible errors
| Code | Type | Description |
|---|---|---|
| 420 | FROZEN_METHOD_INVALID | The current account is frozen, and thus cannot execute the specified action. |
| 403 | PREMIUM_ACCOUNT_REQUIRED | A premium account is required to execute this action. |
References
- Official documentation
- Generated Go reference
- TL definition:
channels.searchPosts#f2c4f24d