mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
commit
9ae20b4815
@ -356,6 +356,9 @@ class TeleBot:
|
||||
def get_file(self, file_id):
|
||||
return types.File.de_json(apihelper.get_file(self.token, file_id))
|
||||
|
||||
def get_file_url(self, file_id):
|
||||
return apihelper.get_file_url(self.token, file_id)
|
||||
|
||||
def download_file(self, file_path):
|
||||
return apihelper.download_file(self.token, file_path)
|
||||
|
||||
|
@ -98,6 +98,11 @@ def get_file(token, file_id):
|
||||
return _make_request(token, method_url, params={'file_id': file_id})
|
||||
|
||||
|
||||
def get_file_url(token, file_id):
|
||||
method_url = r'getFile'
|
||||
return FILE_URL.format(token, get_file(token, file_id).file_path)
|
||||
|
||||
|
||||
def download_file(token, file_path):
|
||||
url = FILE_URL.format(token, file_path)
|
||||
result = _get_req_session().get(url)
|
||||
|
@ -369,7 +369,7 @@ class Message(JsonDeserializable):
|
||||
if 'connected_website' in obj:
|
||||
opts['connected_website'] = obj['connected_website']
|
||||
content_type = 'connected_website'
|
||||
return cls(message_id, from_user, date, chat, content_type, opts)
|
||||
return cls(message_id, from_user, date, chat, content_type, opts, json_string)
|
||||
|
||||
@classmethod
|
||||
def parse_chat(cls, chat):
|
||||
@ -392,7 +392,7 @@ class Message(JsonDeserializable):
|
||||
ret.append(MessageEntity.de_json(me))
|
||||
return ret
|
||||
|
||||
def __init__(self, message_id, from_user, date, chat, content_type, options):
|
||||
def __init__(self, message_id, from_user, date, chat, content_type, options, json_string):
|
||||
self.content_type = content_type
|
||||
self.message_id = message_id
|
||||
self.from_user = from_user
|
||||
@ -436,6 +436,7 @@ class Message(JsonDeserializable):
|
||||
self.connected_website = None
|
||||
for key in options:
|
||||
setattr(self, key, options[key])
|
||||
self.json = json_string
|
||||
|
||||
|
||||
class MessageEntity(JsonDeserializable):
|
||||
|
Loading…
x
Reference in New Issue
Block a user