FILE / ScuroNeko/Laniakea

tgapi/inline_methods.go

Исходный файл и его история в репозитории.
FILE 38309e74f6fe08ab127c796e8b01a56c95943744
Files
Laniakea/tgapi/inline_methods.go
T
ScuroNeko 1e26d871b5
Golang lint / lint (push) Successful in 2m53s
Golang lint / lint (pull_request) Successful in 2m54s
(new): Bot API 10.0
(doc): Since: Bot API X.Y annotations across all tgapi types and methods
2026-05-19 13:42:10 +03:00

113 lines
5.1 KiB
Go

package tgapi
import "context"
// AnswerInlineQuery holds parameters for the answerInlineQuery method.
// Since: Bot API 1.7
// See https://core.telegram.org/bots/api#answerinlinequery
type AnswerInlineQuery struct {
InlineQueryID string `json:"inline_query_id"`
Results []InlineQueryResult `json:"results"`
CacheTime int `json:"cache_time,omitempty"`
IsPersonal bool `json:"is_personal,omitempty"`
NextOffset string `json:"next_offset,omitempty"`
Button *InlineQueryResultsButton `json:"button,omitempty"`
}
// AnswerInlineQuery sends answers to an inline query.
// Since: Bot API 1.7
// Returns true on success.
// See https://core.telegram.org/bots/api#answerinlinequery
func (api *API) AnswerInlineQuery(params AnswerInlineQuery) (bool, error) {
req := NewRequest[bool]("answerInlineQuery", params)
return req.Do(api)
}
// AnswerInlineQueryWithContext is the context-aware variant of AnswerInlineQuery.
// Since: Bot API 1.7
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#answerinlinequery
func (api *API) AnswerInlineQueryWithContext(ctx context.Context, params AnswerInlineQuery) (bool, error) {
req := NewRequest[bool]("answerInlineQuery", params)
return req.DoWithContext(ctx, api)
}
// AnswerWebAppQuery holds parameters for the answerWebAppQuery method.
// Since: Bot API 8.0
// See https://core.telegram.org/bots/api#answerwebappquery
type AnswerWebAppQuery struct {
WebAppQueryID string `json:"web_app_query_id"`
Result InlineQueryResult `json:"result"`
}
// AnswerWebAppQuery sets the result of a Web App interaction.
// Since: Bot API 8.0
// See https://core.telegram.org/bots/api#answerwebappquery
func (api *API) AnswerWebAppQuery(params AnswerWebAppQuery) (SentWebAppMessage, error) {
req := NewRequest[SentWebAppMessage]("answerWebAppQuery", params)
return req.Do(api)
}
// AnswerWebAppQueryWithContext is the context-aware variant of AnswerWebAppQuery.
// Since: Bot API 8.0
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#answerwebappquery
func (api *API) AnswerWebAppQueryWithContext(ctx context.Context, params AnswerWebAppQuery) (SentWebAppMessage, error) {
req := NewRequest[SentWebAppMessage]("answerWebAppQuery", params)
return req.DoWithContext(ctx, api)
}
// SavePreparedInlineMessage holds parameters for the savePreparedInlineMessage method.
// Since: Bot API 8.0
// See https://core.telegram.org/bots/api#savepreparedinlinemessage
type SavePreparedInlineMessage struct {
UserID int64 `json:"user_id"`
Result InlineQueryResult `json:"result"`
AllowUserChats bool `json:"allow_user_chats,omitempty"`
AllowBotChats bool `json:"allow_bot_chats,omitempty"`
AllowGroupChats bool `json:"allow_group_chats,omitempty"`
AllowChannelChats bool `json:"allow_channel_chats,omitempty"`
}
// SavePreparedInlineMessage stores a prepared message for Mini App users.
// Since: Bot API 8.0
// See https://core.telegram.org/bots/api#savepreparedinlinemessage
func (api *API) SavePreparedInlineMessage(params SavePreparedInlineMessage) (PreparedInlineMessage, error) {
req := NewRequest[PreparedInlineMessage]("savePreparedInlineMessage", params)
return req.Do(api)
}
// SavePreparedInlineMessageWithContext is the context-aware variant of SavePreparedInlineMessage.
// Since: Bot API 8.0
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#savepreparedinlinemessage
func (api *API) SavePreparedInlineMessageWithContext(ctx context.Context, params SavePreparedInlineMessage) (PreparedInlineMessage, error) {
req := NewRequest[PreparedInlineMessage]("savePreparedInlineMessage", params)
return req.DoWithContext(ctx, api)
}
// SavePreparedKeyboardButton holds parameters for the savePreparedKeyboardButton method.
// Since: Bot API 8.0
// See https://core.telegram.org/bots/api#savepreparedkeyboardbutton
type SavePreparedKeyboardButton struct {
UserID int64 `json:"user_id"`
Button KeyboardButton `json:"button"`
}
// SavePreparedKeyboardButton stores a prepared keyboard button for Mini App users.
// Since: Bot API 8.0
// See https://core.telegram.org/bots/api#savepreparedkeyboardbutton
func (api *API) SavePreparedKeyboardButton(params SavePreparedKeyboardButton) (PreparedKeyboardButton, error) {
req := NewRequest[PreparedKeyboardButton]("savePreparedKeyboardButton", params)
return req.Do(api)
}
// SavePreparedKeyboardButtonWithContext is the context-aware variant of SavePreparedKeyboardButton.
// Since: Bot API 8.0
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#savepreparedkeyboardbutton
func (api *API) SavePreparedKeyboardButtonWithContext(ctx context.Context, params SavePreparedKeyboardButton) (PreparedKeyboardButton, error) {
req := NewRequest[PreparedKeyboardButton]("savePreparedKeyboardButton", params)
return req.DoWithContext(ctx, api)
}