X Tutup
Skip to content

Commit c411ef7

Browse files
committed
Adding switch_pm_text and switch_pm_parameter to answerInlineQuery python-telegram-bot#232
1 parent e1de722 commit c411ef7

File tree

1 file changed

+28
-12
lines changed

1 file changed

+28
-12
lines changed

telegram/bot.py

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,9 @@ def answerInlineQuery(self,
648648
results,
649649
cache_time=None,
650650
is_personal=None,
651-
next_offset=None):
651+
next_offset=None,
652+
switch_pm_text=None,
653+
switch_pm_parameter=None):
652654
"""Use this method to reply to an inline query.
653655
654656
Args:
@@ -658,17 +660,27 @@ def answerInlineQuery(self,
658660
A list of results for the inline query
659661
660662
Keyword Args:
661-
cache_time (Optional[int]): The maximum amount of time the result
662-
of the inline query may be cached on the server
663-
is_personal (Optional[bool]): Pass True, if results may be cached
664-
on the server side only for the user that sent the query. By
665-
default, results may be returned to any user who sends the same
666-
query
667-
next_offset (Optional[str]): Pass the offset that a client should
668-
send in the next query with the same text to receive more
669-
results. Pass an empty string if there are no more results or
670-
if you don't support pagination. Offset length can't exceed 64
671-
bytes.
663+
cache_time (Optional[int]):
664+
The maximum amount of time the result of the inline query
665+
may be cached on the server
666+
is_personal (Optional[bool]):
667+
Pass True, if results may be cached on the server side only
668+
for the user that sent the query. By default, results may be
669+
returned to any user who sends the same query.
670+
next_offset (Optional[str]):
671+
Pass the offset that a client should send in the next query
672+
with the same text to receive more results. Pass an empty
673+
string if there are no more results or if you don't support
674+
pagination. Offset length can't exceed 64 bytes.
675+
switch_pm_text (Optional[str]):
676+
If passed, clients will display a button with specified text
677+
that switches the user to a private chat with the bot and
678+
sends the bot a start message with the parameter
679+
switch_pm_parameter.
680+
switch_pm_parameter (Optional[str]):
681+
Parameter for the start message sent to the bot when user
682+
presses the switch button.
683+
672684
673685
Returns:
674686
A boolean if answering was successful
@@ -690,6 +702,10 @@ def answerInlineQuery(self,
690702
data['is_personal'] = bool(is_personal)
691703
if next_offset is not None:
692704
data['next_offset'] = next_offset
705+
if switch_pm_text:
706+
data['switch_pm_text'] = switch_pm_text
707+
if switch_pm_parameter:
708+
data['switch_pm_parameter'] = switch_pm_parameter
693709

694710
result = request.post(url, data)
695711

0 commit comments

Comments
 (0)
X Tutup