mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-08 12:59:46 +00:00
Revert async sessions from 3dd8b7c
(breaks sync properties)
Such as ChatGetter.input_chat and SenderGetter.input_sender which rely on the fact that access to the session file will be synchronous.
This commit is contained in:
@@ -213,7 +213,7 @@ class UploadMethods(ButtonMethods, MessageParseMethods, UserMethods):
|
||||
entity, media=types.InputMediaUploadedPhoto(fh)
|
||||
))
|
||||
input_photo = utils.get_input_photo(r.photo)
|
||||
await self.session.cache_file(fh.md5, fh.size, input_photo)
|
||||
self.session.cache_file(fh.md5, fh.size, input_photo)
|
||||
fh = input_photo
|
||||
|
||||
if captions:
|
||||
@@ -328,7 +328,7 @@ class UploadMethods(ButtonMethods, MessageParseMethods, UserMethods):
|
||||
file = stream.read()
|
||||
hash_md5.update(file)
|
||||
if use_cache:
|
||||
cached = await self.session.get_file(
|
||||
cached = self.session.get_file(
|
||||
hash_md5.digest(), file_size, cls=use_cache
|
||||
)
|
||||
if cached:
|
||||
@@ -459,6 +459,6 @@ class UploadMethods(ButtonMethods, MessageParseMethods, UserMethods):
|
||||
to_cache = utils.get_input_photo(msg.media.photo)
|
||||
else:
|
||||
to_cache = utils.get_input_document(msg.media.document)
|
||||
await self.session.cache_file(md5, size, to_cache)
|
||||
self.session.cache_file(md5, size, to_cache)
|
||||
|
||||
# endregion
|
||||
|
Reference in New Issue
Block a user