FILE / ScuroNeko/Laniakea

tgapi/inline_methods.go

Исходный файл и его история в репозитории.
FILE d3e4276b970e8eeb383355cb38c553deda190acf
Files
Laniakea/tgapi/inline_methods.go
T
ScuroNeko 29b208eeec
Golang lint / lint (push) Successful in 11m32s
(new): v1.2 release
2026-08-19 14:58:25 +03:00

134 lines
6.6 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 Required. Unique identifier for the answered query
InlineQueryID string `json:"inline_query_id"`
// Results Required. A JSON-serialized Array of results for the inline query
Results []InlineQueryResult `json:"results"`
// CacheTime Optional. The maximum amount of time in seconds that the result of the inline query may be
// cached on the server. Defaults to 300.
CacheTime int `json:"cache_time,omitempty"`
// IsPersonal Optional. Pass True if results may be cached on the server side only for the user that sent
// the query. By default, results may be returned to any user who sends the same query.
IsPersonal bool `json:"is_personal,omitempty"`
// NextOffset Optional. Pass the offset that a client should send in the next query with the same text to
// receive more results. Pass an empty string if there are no more results or if you don't support
// pagination. Offset length can't exceed 64 bytes.
NextOffset string `json:"next_offset,omitempty"`
// Button Optional. A JSON-serialized object describing a button to be shown above inline query results
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 Required. Unique identifier for the query to be answered
WebAppQueryID string `json:"web_app_query_id"`
// Result Required. A JSON-serialized object describing the message to be sent
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 Required. Unique identifier of the target user that can use the prepared message
UserID int64 `json:"user_id"`
// Result Required. A JSON-serialized object describing the message to be sent
Result InlineQueryResult `json:"result"`
// AllowUserChats Optional. Pass True if the message can be sent to private chats with users
AllowUserChats bool `json:"allow_user_chats,omitempty"`
// AllowBotChats Optional. Pass True if the message can be sent to private chats with bots
AllowBotChats bool `json:"allow_bot_chats,omitempty"`
// AllowGroupChats Optional. Pass True if the message can be sent to group and supergroup chats
AllowGroupChats bool `json:"allow_group_chats,omitempty"`
// AllowChannelChats Optional. Pass True if the message can be sent to channel chats
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 Required. Unique identifier of the target user that can use the button
UserID int64 `json:"user_id"`
// Button Required. A JSON-serialized object describing the button to be saved. The button must be of the
// type request_users, request_chat, or request_managed_bot.
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)
}