# telegram.InlineQuery

class telegram.InlineQuery(id, from_user, query, offset, location=None, bot=None, chat_type=None, **_kwargs)

  Bases: `telegram.base.TelegramObject`

  This object represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results.

  Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their `id` is equal.

  Note

  In Python `from` is a reserved word, use `from_user` instead.

  Parameters

    - id (`str`) – Unique identifier for this query.

    - from_user (`telegram.User`) – Sender.

    - query (`str`) – Text of the query (up to 256 characters).

    - offset (`str`) – Offset of the results to be returned, can be controlled by the bot.

    - chat_type (`str`, optional) –

      Type of the chat, from which the inline query was sent. Can be either `telegram.Chat.SENDER` for a private chat with the inline query sender, `telegram.Chat.PRIVATE`, `telegram.Chat.GROUP`, `telegram.Chat.SUPERGROUP` or `telegram.Chat.CHANNEL`. The chat type should be always known for requests sent from official clients and most third-party clients, unless the request was sent from a secret chat.

      New in version 13.5.

    - location (`telegram.Location`, optional) – Sender location, only for bots that request user location.

    - bot (`telegram.Bot`, optional) – The Bot to use for instance methods.

    - **kwargs (`dict`) – Arbitrary keyword arguments.

  id

    Unique identifier for this query.

    Type

      `str`

  from_user

    Sender.

    Type

      `telegram.User`

  query

    Text of the query (up to 256 characters).

    Type

      `str`

  offset

    Offset of the results to be returned, can be controlled by the bot.

    Type

      `str`

  location

    Optional. Sender location, only for bots that request user location.

    Type

      `telegram.Location`

  chat_type

    Type of the chat, from which the inline query was sent.

    New in version 13.5.

    Type

      `str`, optional

  MAX_RESULTS = 50

    `telegram.constants.MAX_INLINE_QUERY_RESULTS`

    New in version 13.2.

  answer(results, cache_time=300, is_personal=None, next_offset=None, switch_pm_text=None, switch_pm_parameter=None, timeout=None, current_offset=None, api_kwargs=None, auto_pagination=False)

    Shortcut for:

        bot.answer_inline_query(update.inline_query.id,
                                *args,
                                current_offset=self.offset if auto_pagination else None,
                                **kwargs)

    For the documentation of the arguments, please see `telegram.Bot.answer_inline_query()`.

    Parameters

      auto_pagination (`bool`, optional) – If set to `True`, `offset` will be passed as `current_offset` to `telegram.Bot.answer_inline_query()`. Defaults to `False`.

    Raises

      TypeError – If both `current_offset` and `auto_pagination` are supplied.

  classmethod de_json(data, bot)

    See `telegram.TelegramObject.de_json()`.