LonamiWebs / Telethon

Pure Python 3 MTProto API Telegram client library, for bots too!

Home Page:https://docs.telethon.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Self destructing photo, dont download.

vanylav opened this issue · comments

Code that causes the issue

...
if message.media:
                path = ""
                try:
                    print(message)
                    save = await self.client.get_entity(-4222209239)
                    path = await self.client.download_media(message)
                    await self.client.send_file(save, path, caption=f"Save: {user.first_name}")
                    os.remove(path)
                except Exception as er:
                    await self.client.send_message('me', 'Error: '+str(er))
                    try:
                        await self.client.send_file('me', path, caption=f"Save: {user.first_name}")
                        os.remove(path)
                    except:
                        pass
...

Expected behavior

A self-destructing photo arrives (to be viewed once), the code downloads the image and sends it to another channel.

Actual behavior

A self-destructing photo arrives (to be viewed once), the code gives an error that the media type is not supported.

Traceback

Message(id=1541508, peer_id=PeerUser(user_id=6758782663), date=datetime.datetime(2024, 6, 16, 8, 34, 40, tzinfo=datetime.timezone.utc), message='', out=False, mentioned=False, media_unread=True, silent=False, post=False, from_scheduled=False, legacy=False, edit_hide=False, pinned=False, noforwards=False, from_id=None, fwd_from=None, via_bot_id=None, reply_to=None, media=MessageMediaUnsupported(), reply_markup=None, entities=[], views=None, forwards=None, replies=None, edit_date=None, post_author=None, grouped_id=None, reactions=None, restriction_reason=[], ttl_period=None)

Telethon version

1.27.0

Python version

3.10.12

Operating system (including distribution name and version)

Ubuntu 22.04

Other details

No response

Checklist

  • The error is in the library's code, and not in my own.
  • I have searched for this issue before posting it and there isn't an open duplicate.
  • I ran pip install -U https://github.com/LonamiWebs/Telethon/archive/v1.zip and triggered the bug in the latest version.

Forgot to add, the code works fine for self-destructing photos with a 3s, 10s, 30s delay.

Telethon version
1.27.0

Only the latest version is supported.

I also tried it on 1.36.0.
UPD:
Should I create a new issue?

Stil unlikely there's anything the library can do for media unsupported until an update.