mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
Merge branch 'master' into patch-1
This commit is contained in:
@ -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)
|
||||
|
||||
|
@ -45,7 +45,7 @@ def _make_request(token, method_name, method='get', params=None, files=None):
|
||||
request_url = "https://api.telegram.org/bot{0}/{1}".format(token, method_name)
|
||||
else:
|
||||
request_url = API_URL.format(token, method_name)
|
||||
|
||||
|
||||
logger.debug("Request: method={0} url={1} params={2} files={3}".format(method, request_url, params, files))
|
||||
read_timeout = READ_TIMEOUT
|
||||
connect_timeout = CONNECT_TIMEOUT
|
||||
@ -124,7 +124,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:
|
||||
@ -149,6 +149,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')
|
||||
|
||||
|
||||
|
@ -404,6 +404,7 @@ class Message(JsonDeserializable):
|
||||
self.date = date
|
||||
self.chat = chat
|
||||
self.forward_from_chat = None
|
||||
self.forward_from_message_id = None
|
||||
self.forward_from = None
|
||||
self.forward_date = None
|
||||
self.reply_to_message = None
|
||||
@ -483,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
|
||||
@ -1932,6 +1933,7 @@ class ShippingOption(JsonSerializable):
|
||||
"""
|
||||
for price in args:
|
||||
self.prices.append(price)
|
||||
return self
|
||||
|
||||
def to_json(self):
|
||||
price_list = []
|
||||
|
Reference in New Issue
Block a user