Ahhh, okay, awesome! Thanks for clarifying, and sorry for not understanding that the first time I gave this a test, and works fine: resp = await event.reply("File from URL", file=url) is_photo: bool = isinstance(resp.file.media, telethon.tl.types.Photo) media_id: int = resp.file.media.id access_hash: int = resp.file.media.access_hash input_media = (InputPhoto if is_photo else InputDocument)(media_id, access_hash, b"") await event.reply("Sending as input media", file=input_media) perfect
btw, about serializing, you can use media._bytes() (or InputPhoto/InputDocument._bytes() you create, to avoid useless data) and unpack without doing type check telethon.extensions.BinaryReader(bytes).tgread_object() it should be safe enough, constructor id won't change, ig, for main types. or just do it manually
Обсуждают сегодня