MCPcopy Index your code
hub / github.com/python-telegram-bot/python-telegram-bot / InlineQuery

Class InlineQuery

src/telegram/_inline/inlinequery.py:38–220  ·  view source on GitHub ↗

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 :attr:`id` is equal.

Source from the content-addressed store, hash-verified

36
37
38class InlineQuery(TelegramObject):
39 """
40 This object represents an incoming inline query. When the user sends an empty query, your bot
41 could return some default or trending results.
42
43 Objects of this class are comparable in terms of equality. Two objects of this class are
44 considered equal, if their :attr:`id` is equal.
45
46 .. figure:: https://core.telegram.org/file/464001466/10e4a/r4FKyQ7gw5g.134366/f2\
47 606a53d683374703
48 :align: center
49
50 Inline queries on Telegram
51
52 .. seealso::
53 The :class:`telegram.InlineQueryResult` classes represent the media the user can choose
54 from (see above figure).
55
56 Note:
57 In Python :keyword:`from` is a reserved word. Use :paramref:`from_user` instead.
58
59 .. versionchanged:: 20.0
60 The following are now keyword-only arguments in Bot methods:
61 ``{read, write, connect, pool}_timeout``, :paramref:`answer.api_kwargs`,
62 ``auto_pagination``. Use a named argument for those,
63 and notice that some positional arguments changed position as a result.
64
65 .. versionchanged:: 22.0
66 Removed constants ``MIN_START_PARAMETER_LENGTH`` and ``MAX_START_PARAMETER_LENGTH``.
67 Use :attr:`telegram.constants.InlineQueryResultsButtonLimit.MIN_START_PARAMETER_LENGTH` and
68 :attr:`telegram.constants.InlineQueryResultsButtonLimit.MAX_START_PARAMETER_LENGTH`
69 instead.
70
71 Args:
72 id (:obj:`str`): Unique identifier for this query.
73 from_user (:class:`telegram.User`): Sender.
74 query (:obj:`str`): Text of the query (up to
75 :tg-const:`telegram.InlineQuery.MAX_QUERY_LENGTH` characters).
76 offset (:obj:`str`): Offset of the results to be returned, can be controlled by the bot.
77 chat_type (:obj:`str`, optional): Type of the chat, from which the inline query was sent.
78 Can be either :tg-const:`telegram.Chat.SENDER` for a private chat with the inline query
79 sender, :tg-const:`telegram.Chat.PRIVATE`, :tg-const:`telegram.Chat.GROUP`,
80 :tg-const:`telegram.Chat.SUPERGROUP` or :tg-const:`telegram.Chat.CHANNEL`. The chat
81 type should be always known for requests sent from official clients and most
82 third-party clients, unless the request was sent from a secret chat.
83
84 .. versionadded:: 13.5
85 location (:class:`telegram.Location`, optional): Sender location, only for bots that
86 request user location.
87
88 Attributes:
89 id (:obj:`str`): Unique identifier for this query.
90 from_user (:class:`telegram.User`): Sender.
91 query (:obj:`str`): Text of the query (up to
92 :tg-const:`telegram.InlineQuery.MAX_QUERY_LENGTH` characters).
93 offset (:obj:`str`): Offset of the results to be returned, can be controlled by the bot.
94 chat_type (:obj:`str`): Optional. Type of the chat, from which the inline query was sent.
95 Can be either :tg-const:`telegram.Chat.SENDER` for a private chat with the inline query

Calls

no outgoing calls

Tested by 7

test_all_update_typesMethod · 0.72
inline_queryFunction · 0.72
test_context_patternMethod · 0.72
inline_queryFunction · 0.72
test_equalityMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…