telegram.InlineQuery¶
-
class
telegram.
InlineQuery
(id, from_user, query, offset, location=None, bot=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, usefrom_user
instead.
- Parameters
id (
str
) – Unique identifier for this query.from_user (
telegram.User
) – Sender.location (
telegram.Location
, optional) – Sender location, only for bots that request user location.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.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
-
location
¶ Optional. Sender location, only for bots that request user location.
- Type
-
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
-
MAX_RESULTS
: ClassVar[int] = 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 toTrue
,offset
will be passed ascurrent_offset
totelegram.Bot.answer_inline_query()
. Defaults toFalse
.- Raises
TypeError – If both
current_offset
andauto_pagination
are supplied.