mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
Add new param for anser inline query.
This commit is contained in:
parent
4fe4061a0f
commit
228683aeda
|
@ -482,7 +482,8 @@ class TeleBot:
|
||||||
"""
|
"""
|
||||||
return self.send_message(message.chat.id, text, reply_to_message_id=message.message_id, **kwargs)
|
return self.send_message(message.chat.id, text, reply_to_message_id=message.message_id, **kwargs)
|
||||||
|
|
||||||
def answer_inline_query(self, inline_query_id, results, cache_time=None, is_personal=None, next_offset=None):
|
def answer_inline_query(self, inline_query_id, results, cache_time=None, is_personal=None, next_offset=None,
|
||||||
|
switch_pm_text=None, switch_pm_parameter=None):
|
||||||
"""
|
"""
|
||||||
Use this method to send answers to an inline query. On success, True is returned.
|
Use this method to send answers to an inline query. On success, True is returned.
|
||||||
No more than 50 results per query are allowed.
|
No more than 50 results per query are allowed.
|
||||||
|
@ -491,9 +492,13 @@ class TeleBot:
|
||||||
:param cache_time: The maximum amount of time in seconds that the result of the inline query may be cached on the server.
|
:param cache_time: The maximum amount of time in seconds that the result of the inline query may be cached on the server.
|
||||||
:param is_personal: Pass True, if results may be cached on the server side only for the user that sent the query.
|
:param is_personal: Pass True, if results may be cached on the server side only for the user that sent the query.
|
||||||
:param next_offset: Pass the offset that a client should send in the next query with the same text to receive more results.
|
:param next_offset: Pass the offset that a client should send in the next query with the same text to receive more results.
|
||||||
|
:param switch_pm_parameter: 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
|
||||||
|
:param switch_pm_text: Parameter for the start message sent to the bot when user presses the switch button
|
||||||
:return: True means success.
|
:return: True means success.
|
||||||
"""
|
"""
|
||||||
return apihelper.answer_inline_query(self.token, inline_query_id, results, cache_time, is_personal, next_offset)
|
return apihelper.answer_inline_query(self.token, inline_query_id, results, cache_time, is_personal, next_offset,
|
||||||
|
switch_pm_text, switch_pm_parameter)
|
||||||
|
|
||||||
def register_for_reply(self, message, callback):
|
def register_for_reply(self, message, callback):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -372,7 +372,8 @@ def answer_callback_query(token, callback_query_id, text=None, show_alert=None):
|
||||||
return _make_request(token, method_url, params=payload, method='post')
|
return _make_request(token, method_url, params=payload, method='post')
|
||||||
|
|
||||||
|
|
||||||
def answer_inline_query(token, inline_query_id, results, cache_time=None, is_personal=None, next_offset=None):
|
def answer_inline_query(token, inline_query_id, results, cache_time=None, is_personal=None, next_offset=None,
|
||||||
|
switch_pm_text=None, switch_pm_parameter=None):
|
||||||
method_url = 'answerInlineQuery'
|
method_url = 'answerInlineQuery'
|
||||||
payload = {'inline_query_id': inline_query_id, 'results': _convert_inline_results(results)}
|
payload = {'inline_query_id': inline_query_id, 'results': _convert_inline_results(results)}
|
||||||
if cache_time:
|
if cache_time:
|
||||||
|
@ -381,6 +382,10 @@ def answer_inline_query(token, inline_query_id, results, cache_time=None, is_per
|
||||||
payload['is_personal'] = is_personal
|
payload['is_personal'] = is_personal
|
||||||
if next_offset:
|
if next_offset:
|
||||||
payload['next_offset'] = next_offset
|
payload['next_offset'] = next_offset
|
||||||
|
if switch_pm_text:
|
||||||
|
payload['switch_pm_text'] = switch_pm_text
|
||||||
|
if switch_pm_parameter:
|
||||||
|
payload['switch_pm_parameter'] = switch_pm_parameter
|
||||||
return _make_request(token, method_url, params=payload, method='post')
|
return _make_request(token, method_url, params=payload, method='post')
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user