Skip to main content

messages.setInlineBotResults

Answer an inline query, for bots only

func (c *Client) MessagesSetInlineBotResults(ctx context.Context, request *MessagesSetInlineBotResultsRequest) (bool, error)

Calling this method

client.Run(ctx, func(ctx context.Context) error {
api := client.API()

res, err := api.MessagesSetInlineBotResults(ctx, &tg.MessagesSetInlineBotResultsRequest{
// see Parameters
})
if err != nil {
return err
}
_ = res // bool
return nil
})

Parameters

NameTypeRequiredDescription
GalleryboolSet this flag if the results are composed of media files
PrivateboolSet this flag 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
QueryIDint64yesUnique identifier for the answered query
Results[]InputBotInlineResultClassyesVector of results for the inline query
CacheTimeintyesThe maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300.
NextOffsetstringPass 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.
SwitchPmInlineBotSwitchPMIf passed, clients will display a button on top of the remaining inline result list with the specified text, that switches the user to a private chat with the bot and sends the bot a start message with a certain parameter.
SwitchWebviewInlineBotWebViewIf passed, clients will display a button on top of the remaining inline result list with the specified text, that switches the user to the specified inline mode mini app.

Returns

bool

Possible errors

CodeTypeDescription
400ARTICLE_TITLE_EMPTYThe title of the article is empty.
400AUDIO_CONTENT_URL_EMPTYThe remote URL specified in the content field is empty.
400AUDIO_TITLE_EMPTYAn empty audio title was provided.
400BUTTON_DATA_INVALIDThe data of one or more of the buttons you provided is invalid.
400BUTTON_TYPE_INVALIDThe type of one or more of the buttons you provided is invalid.
400BUTTON_URL_INVALIDButton URL invalid.
400DOCUMENT_INVALIDThe specified document is invalid.
400FILE_CONTENT_TYPE_INVALIDFile content-type is invalid.
400FILE_TITLE_EMPTYAn empty file title was specified.
400GIF_CONTENT_TYPE_INVALIDGIF content-type invalid.
400MEDIA_CAPTION_TOO_LONGThe caption is too long.
400MESSAGE_EMPTYThe provided message is empty.
400MESSAGE_TOO_LONGThe provided message is too long.
400NEXT_OFFSET_INVALIDThe specified offset is longer than 64 bytes.
400PEER_TYPES_INVALIDThe passed keyboardButtonSwitchInline.peer_types field is invalid.
400PHOTO_CONTENT_TYPE_INVALIDPhoto mime-type invalid.
400PHOTO_CONTENT_URL_EMPTYPhoto URL invalid.
400PHOTO_INVALIDPhoto invalid.
400PHOTO_THUMB_URL_EMPTYPhoto thumbnail URL is empty.
400QUERY_ID_INVALIDThe query ID is invalid.
400REPLY_MARKUP_INVALIDThe provided reply markup is invalid.
400RESULTS_TOO_MUCHToo many results were provided.
400RESULT_ID_DUPLICATEYou provided a duplicate result ID.
400RESULT_ID_INVALIDOne of the specified result IDs is invalid.
400RESULT_TYPE_INVALIDResult type invalid.
400SEND_MESSAGE_MEDIA_INVALIDInvalid media provided.
400SEND_MESSAGE_TYPE_INVALIDThe message type is invalid.
400START_PARAM_EMPTYThe start parameter is empty.
400START_PARAM_INVALIDStart parameter invalid.
400STICKER_DOCUMENT_INVALIDThe specified sticker document is invalid.
400SWITCH_PM_TEXT_EMPTYThe switch_pm.text field was empty.
400SWITCH_WEBVIEW_URL_INVALIDThe URL specified in switch_webview.url is invalid!
400URL_INVALIDInvalid URL provided.
400USER_BOT_REQUIREDThis method can only be called by a bot.
400VIDEO_CONTENT_TYPE_INVALIDThe video's content type is invalid.
400VIDEO_TITLE_EMPTYThe specified video title is empty.
400WEBDOCUMENT_INVALIDInvalid webdocument URL provided.
400WEBDOCUMENT_MIME_INVALIDInvalid webdocument mime type provided.
400WEBDOCUMENT_SIZE_TOO_BIGWebdocument is too big!
400WEBDOCUMENT_URL_EMPTYThe passed web document URL is empty.
400WEBDOCUMENT_URL_INVALIDThe specified webdocument URL is invalid.

References