mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Add get_url method for Downloadable
This commit is contained in:
parent
13e64d6394
commit
71466c4960
2 changed files with 17 additions and 1 deletions
|
|
@ -185,7 +185,7 @@ class BaseBot:
|
|||
if destination is None:
|
||||
destination = io.BytesIO()
|
||||
|
||||
url = api.Methods.file_url(token=self.__token, path=file_path)
|
||||
url = self.get_file_url(file_path)
|
||||
|
||||
dest = destination if isinstance(destination, io.IOBase) else open(destination, 'wb')
|
||||
async with self.session.get(url, timeout=timeout, proxy=self.proxy, proxy_auth=self.proxy_auth) as response:
|
||||
|
|
@ -199,6 +199,9 @@ class BaseBot:
|
|||
dest.seek(0)
|
||||
return dest
|
||||
|
||||
def get_file_url(self, file_path):
|
||||
return api.Methods.file_url(token=self.__token, path=file_path)
|
||||
|
||||
async def send_file(self, file_type, method, file, payload) -> Union[Dict, base.Boolean]:
|
||||
"""
|
||||
Send file
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue