rockneurotiko / ex_gram

Telegram Bot API low level API and framework
182 stars 26 forks source link

Enable sending file contents in editMessageMedia #99

Open versilov opened 1 year ago

versilov commented 1 year ago

Like this: ExGram.editMessageMedia(%InputMedia{type: "photo", media: "attach://file"}, file: {:file_contents, <<>>, "img.gif"}, ...)

This is a quick fix. It would be nice to be able to do ExGram.editMessageMedia(%InputMedia{type: "photo", media: {:file_contents, <<>>, "img.gif"}}, ...) finally

rockneurotiko commented 1 year ago

I think that it's better to use the media field as a File, and change the code here to change the field accordingly and maybe add the new one for multipart upload (https://core.telegram.org/bots/api#inputmediaphoto)

This change would need changes on the API parser + code generator (https://github.com/rockneurotiko/telegram_api_json) in order to change the type on the auto generated models, and changes in this project to understand the media field and change it accordingly

But I think it's needed, I will take a look for sure