SetInlineBotResultsRequest

Only bots can use this method. See code examples.

---functions---
messages.setInlineBotResults#eb5ea206 flags:# gallery:flags.0?true private:flags.1?true query_id:long results:Vector<InputBotInlineResult> cache_time:int next_offset:flags.2?string switch_pm:flags.3?InlineBotSwitchPM = Bool

Returns

Bool

This type has no instances available.

Parameters

query_idlong
resultsInputBotInlineResultA list must be supplied.
cache_timeint
galleryflagThis argument defaults to None and can be omitted.
privateflagThis argument defaults to None and can be omitted.
next_offsetstringThis argument defaults to None and can be omitted.
switch_pmInlineBotSwitchPMThis argument defaults to None and can be omitted.

Known RPC errors

This request can cause 26 known errors:

ArticleTitleEmptyErrorThe title of the article is empty.
AudioContentUrlEmptyError.
AudioTitleEmptyErrorThe title attribute of the audio must be non-empty.
ButtonDataInvalidErrorThe provided button data is invalid.
ButtonTypeInvalidErrorThe type of one of the buttons you provided is invalid.
ButtonUrlInvalidErrorButton URL invalid.
DocumentInvalidErrorThe document file was invalid and can't be used in inline mode.
FileContentTypeInvalidError.
FileTitleEmptyError.
GifContentTypeInvalidError.
MessageEmptyErrorEmpty or invalid UTF-8 message was sent.
NextOffsetInvalidErrorThe value for next_offset is invalid. Check that it has normal characters and is not too long.
PhotoContentTypeInvalidError.
PhotoContentUrlEmptyErrorThe content from the URL used as a photo appears to be empty or has caused another HTTP error.
PhotoThumbUrlEmptyErrorThe URL used as a thumbnail appears to be empty or has caused another HTTP error.
QueryIdInvalidErrorThe query ID is invalid.
ReplyMarkupInvalidErrorThe provided reply markup is invalid.
ResultTypeInvalidErrorResult type invalid.
SendMessageMediaInvalidErrorThe message media was invalid or not specified.
SendMessageTypeInvalidErrorThe message type is invalid.
StartParamInvalidErrorStart parameter invalid.
StickerDocumentInvalidErrorThe sticker file was invalid (this file has failed Telegram internal checks, make sure to use the correct format and comply with https://core.telegram.org/animated_stickers).
UserBotInvalidErrorThis method can only be called by a bot.
VideoTitleEmptyError.
WebdocumentMimeInvalidError.
WebdocumentUrlInvalidErrorThe given URL cannot be used.

You can import these from telethon.errors.

Example

from telethon.sync import TelegramClient
from telethon import functions, types

with TelegramClient(name, api_id, api_hash) as client:
    result = client(functions.messages.SetInlineBotResultsRequest(
        query_id=-12398745604826,
        results=[types.InputBotInlineResult(
            id='some string here',
            type='some string here',
            send_message=types.InputBotInlineMessageMediaAuto(
                message='Hello there!'
            ),
            title='My awesome title',
            description='some string here',
            url='some string here',
            thumb=types.InputWebDocument(
                url='some string here',
                size=42,
                mime_type='some string here',
                attributes=[types.DocumentAttributeImageSize(
                    w=42,
                    h=42
                )]
            ),
            content=types.InputWebDocument(
                url='some string here',
                size=42,
                mime_type='some string here',
                attributes=[types.DocumentAttributeImageSize(
                    w=42,
                    h=42
                )]
            )
        )],
        cache_time=42,
        gallery=True,
        private=True,
        next_offset='some string here',
        switch_pm=types.InlineBotSwitchPM(
            text='some string here',
            start_param='some string here'
        )
    ))
    print(result)