Adding switch_pm_text and switch_pm_parameter to answerInlineQuery #232

This commit is contained in:
Leandro Toledo 2016-04-14 02:34:29 -03:00
parent e1de7220df
commit c411ef7822

View file

@ -648,7 +648,9 @@ class Bot(TelegramObject):
results, results,
cache_time=None, cache_time=None,
is_personal=None, is_personal=None,
next_offset=None): next_offset=None,
switch_pm_text=None,
switch_pm_parameter=None):
"""Use this method to reply to an inline query. """Use this method to reply to an inline query.
Args: Args:
@ -658,17 +660,27 @@ class Bot(TelegramObject):
A list of results for the inline query A list of results for the inline query
Keyword Args: Keyword Args:
cache_time (Optional[int]): The maximum amount of time the result cache_time (Optional[int]):
of the inline query may be cached on the server The maximum amount of time the result of the inline query
is_personal (Optional[bool]): Pass True, if results may be cached may be cached on the server
on the server side only for the user that sent the query. By is_personal (Optional[bool]):
default, results may be returned to any user who sends the same Pass True, if results may be cached on the server side only
query for the user that sent the query. By default, results may be
next_offset (Optional[str]): Pass the offset that a client should returned to any user who sends the same query.
send in the next query with the same text to receive more next_offset (Optional[str]):
results. Pass an empty string if there are no more results or Pass the offset that a client should send in the next query
if you don't support pagination. Offset length can't exceed 64 with the same text to receive more results. Pass an empty
bytes. string if there are no more results or if you don't support
pagination. Offset length can't exceed 64 bytes.
switch_pm_text (Optional[str]):
If passed, clients will display a button with specified text
that switches the user to a private chat with the bot and
sends the bot a start message with the parameter
switch_pm_parameter.
switch_pm_parameter (Optional[str]):
Parameter for the start message sent to the bot when user
presses the switch button.
Returns: Returns:
A boolean if answering was successful A boolean if answering was successful
@ -690,6 +702,10 @@ class Bot(TelegramObject):
data['is_personal'] = bool(is_personal) data['is_personal'] = bool(is_personal)
if next_offset is not None: if next_offset is not None:
data['next_offset'] = next_offset data['next_offset'] = next_offset
if switch_pm_text:
data['switch_pm_text'] = switch_pm_text
if switch_pm_parameter:
data['switch_pm_parameter'] = switch_pm_parameter
result = request.post(url, data) result = request.post(url, data)