Revert "Get rid of now broken cache"

This reverts commit f73ae42a03.
This commit is contained in:
Lonami Exo
2018-12-25 16:50:11 +01:00
parent 100cd807f6
commit b66c1e6084
4 changed files with 75 additions and 13 deletions

View File

@@ -113,7 +113,7 @@ class InlineBuilder:
Same as ``file`` for `client.send_file
<telethon.client.uploads.UploadMethods.send_file>`.
"""
fh = await self._client.upload_file(file)
fh = await self._client.upload_file(file, use_cache=types.InputPhoto)
if not isinstance(fh, types.InputPhoto):
r = await self._client(functions.messages.UploadMediaRequest(
types.InputPeerSelf(), media=types.InputMediaUploadedPhoto(fh)
@@ -140,14 +140,14 @@ class InlineBuilder:
async def document(
self, file, title=None, *, description=None, type=None,
mime_type=None, attributes=None, force_document=False,
voice_note=False, video_note=False, id=None,
voice_note=False, video_note=False, use_cache=True, id=None,
text=None, parse_mode=(), link_preview=True,
geo=None, period=60, contact=None, game=False, buttons=None
):
"""
Creates a new inline result of document type.
`mime_type`, `attributes`, `force_document`,
`use_cache`, `mime_type`, `attributes`, `force_document`,
`voice_note` and `video_note` are described in `client.send_file
<telethon.client.uploads.UploadMethods.send_file>`.
@@ -174,7 +174,8 @@ class InlineBuilder:
else:
type = 'document'
fh = await self._client.upload_file(file)
use_cache = types.InputDocument if use_cache else None
fh = await self._client.upload_file(file, use_cache=use_cache)
if not isinstance(fh, types.InputDocument):
attributes, mime_type = utils.get_attributes(
file,