Use this file to discover all available pages before exploring further.
Inline mode lets users invoke your bot from any chat by typing @botname query. Your bot receives the query, builds a list of results, and Telegram displays them as a gallery above the input field.
type Query struct { ID string // Unique query ID — pass to Answer() Sender *User // The user who sent the query Location *Location // Present if bot requested user location Text string // The query text (up to 512 characters) Offset string // Pagination offset controlled by your bot ChatType string // Type of chat the query was sent from}
Results are collected in a tele.Results slice. Every result embeds ResultBase which provides SetResultID(), SetParseMode(), SetContent(), and SetReplyMarkup().
result := &tele.ArticleResult{ Title: "Hello World", Text: "This is the message that will be sent.", Description: "A short description shown in the list", ThumbURL: "https://example.com/thumb.jpg",}result.SetResultID("article-1")
result := &tele.PhotoResult{ URL: "https://example.com/photo.jpg", ThumbURL: "https://example.com/photo_thumb.jpg", Title: "My Photo", Caption: "Look at this!",}
type QueryResponse struct { QueryID string // set automatically by Telebot Results Results CacheTime int IsPersonal bool NextOffset string // pagination: pass to get more results SwitchPMText string // button to open private chat SwitchPMParameter string // /start payload sent with the PM button Button *QueryResponseButton}
Telegram can notify your bot when the user picks a result. Enable Inline Feedback in @BotFather, then handle tele.OnInlineResult:
b.Handle(tele.OnInlineResult, func(c tele.Context) error { result := c.InlineResult() log.Printf("User %d chose result %s for query %q", result.Sender.ID, result.ResultID, result.Query) // result.MessageID is the inline_message_id — use it with b.Edit() return nil})