Telethon
Telethon copied to clipboard
send_file with list of links
Code that causes the issue
await bot.send_file(user_id, file=[image_url])
Expected behavior
I was expecting that this will send file normal as
await bot.send_file(user_id, file=image_url)
But it also doesn't work with multiple links
Actual behavior
Throws exception
Traceback
File "/usr/local/lib/python3.11/site-packages/telethon/client/uploads.py", line 389, in send_file
result += await self._send_album(
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/telethon/client/uploads.py", line 504, in _send_album
result = await self(request)
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/telethon/client/users.py", line 30, in __call__
return await self._call(self._sender, request, ordered=ordered)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/telethon/client/users.py", line 87, in _call
result = await future
^^^^^^^^^^^^
telethon.errors.rpcerrorlist.MediaInvalidError: Media invalid (caused by SendMultiMediaRequest)
Telethon version
1.33.0, 1.32.1
Python version
3.11.0
Operating system (including distribution name and version)
Ubuntu 22.04
Other details
No response
Checklist
- [X] The error is in the library's code, and not in my own.
- [X] I have searched for this issue before posting it and there isn't an open duplicate.
- [X] I ran
pip install -U https://github.com/LonamiWebs/Telethon/archive/v1.zip
and triggered the bug in the latest version.
I encountered same issue. However, I found that sometimes it works.
Doesn't work:
- list of video url
- list of
telethon.tl.types.InputMediaPhotoExternal
Works:
- list of image url
- list of
telethon.tl.types.InputMediaDocumentExternal