Update to Telethon 1.22

This commit is contained in:
Tulir Asokan
2021-06-22 19:42:26 +03:00
parent f923552f86
commit 730f6bab6f
4 changed files with 9 additions and 10 deletions
+4 -6
View File
@@ -747,15 +747,13 @@ class PortalMetadata(BasePortal, ABC):
if isinstance(photo, (ChatPhoto, UserProfilePhoto)):
loc = InputPeerPhotoFileLocation(
peer=await self.get_input_entity(user),
local_id=photo.photo_big.local_id,
volume_id=photo.photo_big.volume_id,
photo_id=photo.photo_id,
big=True
)
photo_id = (f"{loc.volume_id}-{loc.local_id}" if isinstance(photo, ChatPhoto)
else photo.photo_id)
photo_id = str(photo.photo_id)
elif isinstance(photo, Photo):
loc, largest = self._get_largest_photo_size(photo)
photo_id = f"{largest.location.volume_id}-{largest.location.local_id}"
loc, _ = self._get_largest_photo_size(photo)
photo_id = str(loc.id)
elif isinstance(photo, (UserProfilePhotoEmpty, ChatPhotoEmpty, PhotoEmpty, type(None))):
photo_id = ""
loc = None
+1 -2
View File
@@ -344,8 +344,7 @@ class Puppet(BasePuppet):
loc = InputPeerPhotoFileLocation(
peer=await self.get_input_entity(source),
local_id=photo.photo_big.local_id,
volume_id=photo.photo_big.volume_id,
photo_id=photo.photo_id,
big=True
)
file = await util.transfer_file_to_matrix(source.client, self.default_mxid_intent, loc)
+3 -1
View File
@@ -102,8 +102,10 @@ def _location_to_id(location: TypeLocation) -> str:
return f"{location.id}-{location.access_hash}"
elif isinstance(location, (InputDocumentFileLocation, InputPhotoFileLocation)):
return f"{location.id}-{location.access_hash}-{location.thumb_size}"
elif isinstance(location, (InputFileLocation, InputPeerPhotoFileLocation)):
elif isinstance(location, InputFileLocation):
return f"{location.volume_id}-{location.local_id}"
elif isinstance(location, InputPeerPhotoFileLocation):
return str(location.photo_id)
async def transfer_thumbnail_to_matrix(client: MautrixTelegramClient, intent: IntentAPI,
+1 -1
View File
@@ -6,5 +6,5 @@ commonmark>=0.8,<0.10
aiohttp>=3,<4
yarl>=1,<2
mautrix>=0.9.7,<0.10
telethon>=1.20,<1.22
telethon>=1.22,<1.23
telethon-session-sqlalchemy>=0.2.14,<0.3