Replies: 7 comments 1 reply
Wat about passing chat_id?... |
|
My working code: |
|
Thank you for the quick response, chat_id is passed in kwargs, everything is fine there. The problem seems to be only in the asynchronous version of the bot. python3.12/site-packages/aiohttp/formdata.py", line 159, in _gen_form_data My test code: |
|
For me, probably the most expected behavior is the correct handling of the file name in BytesIO. For now, I have made a patch on the class InputFile and send it without the visible_file_name parameter, and it works well. As soon as I add visible_file_name, it still has the problems described above. Most likely, aiohttp receives InputFile in the payload, but expects some kind of byte object, and since it does not know how to process InputFile, it fails. types.py |
|
I have received your bug report and will investigate this issue soon |
|
Can confirm that using InputFile for BytesIO files causes a random file name to be generated. file_input = InputFile(io.BytesIO(downloaded_file))
file_input.file_name = 'new_file_name.png'
await bot.send_document(message.chat.id, file_input) |
|
Also, sync seems to be handling this differently: file name is totally ignored |
Uh oh!
There was an error while loading. Please reload this page.
Please answer these questions before submitting your issue. Thanks!
4.20.0
Ubuntu
python3.12
I am trying to send files and specify the file name, here is my attempt:
All reactions