1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

timeout for send_message

Add optional "timeout" parameter to send_message (the same as exists in all other send_*).

Equal rights for all send functions! :)
This commit is contained in:
Badiboy 2018-07-24 00:33:13 +03:00
parent 8bc5b74495
commit 27d442fabf
2 changed files with 5 additions and 3 deletions

View File

@ -459,7 +459,7 @@ class TeleBot:
return types.ChatMember.de_json(result)
def send_message(self, chat_id, text, disable_web_page_preview=None, reply_to_message_id=None, reply_markup=None,
parse_mode=None, disable_notification=None):
parse_mode=None, disable_notification=None, timeout=None):
"""
Use this method to send text messages.
@ -477,7 +477,7 @@ class TeleBot:
"""
return types.Message.de_json(
apihelper.send_message(self.token, chat_id, text, disable_web_page_preview, reply_to_message_id,
reply_markup, parse_mode, disable_notification))
reply_markup, parse_mode, disable_notification, timeout))
def forward_message(self, chat_id, from_chat_id, message_id, disable_notification=None):
"""

View File

@ -114,7 +114,7 @@ def download_file(token, file_path):
def send_message(token, chat_id, text, disable_web_page_preview=None, reply_to_message_id=None, reply_markup=None,
parse_mode=None, disable_notification=None):
parse_mode=None, disable_notification=None, timeout=None):
"""
Use this method to send text messages. On success, the sent Message is returned.
:param token:
@ -137,6 +137,8 @@ def send_message(token, chat_id, text, disable_web_page_preview=None, reply_to_m
payload['parse_mode'] = parse_mode
if disable_notification:
payload['disable_notification'] = disable_notification
if timeout:
payload['connect-timeout'] = timeout
return _make_request(token, method_url, params=payload, method='post')