mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
Merge pull request #539 from Badiboy/master
"timeout" parameter for send_message Fix kick_chat_member return type HTML symbols not replaced
This commit is contained in:
commit
86644c05f7
@ -579,7 +579,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.
|
||||
|
||||
@ -597,7 +597,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):
|
||||
"""
|
||||
@ -843,7 +843,7 @@ class TeleBot:
|
||||
:param user_id: Int : Unique identifier of the target user
|
||||
:param until_date: Date when the user will be unbanned, unix time. If user is banned for more than 366 days or
|
||||
less than 30 seconds from the current time they are considered to be banned forever
|
||||
:return: types.Message
|
||||
:return: boolean
|
||||
"""
|
||||
return apihelper.kick_chat_member(self.token, chat_id, user_id, until_date)
|
||||
|
||||
|
@ -121,7 +121,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:
|
||||
@ -146,6 +146,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')
|
||||
|
||||
|
||||
|
@ -484,10 +484,10 @@ class Message(JsonDeserializable):
|
||||
url = "tg://user?id={0}".format(user.id)
|
||||
elif type == "mention":
|
||||
url = "https://t.me/{0}".format(text[1:])
|
||||
text = text.replace("&", "&").replace("<", "<").replace(">", ">")
|
||||
if not type or not _subs.get(type):
|
||||
return text
|
||||
subs = _subs.get(type)
|
||||
text = text.replace("&", "&").replace("<", "<").replace(">", ">")
|
||||
return subs.format(text=text, url=url)
|
||||
|
||||
offset = 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user