Fixed and improved edit_inline_media once again by DavideGalilei · Pull Request #1052 · pyrogram/pyrogram · GitHub
Skip to content
This repository was archived by the owner on Dec 23, 2024. It is now read-only.

Fixed and improved edit_inline_media once again - #1052

Merged
delivrance merged 2 commits into
pyrogram:masterfrom
DavideGalilei:patch-inline-2
Aug 11, 2022
Merged

delivrance merged 2 commits into
pyrogram:masterfrom
DavideGalilei:patch-inline-2

Conversation

@DavideGalilei

Copy link
Copy Markdown
Contributor

⚠️ Followup for #1036

There was an issue with the previous Pull Request, which led to the method breaking with InputMediaPhoto.

Fixes 🩹

  • Usage with InputMediaPhoto
  • Usage with BytesIO (anonymous BytesIO without a .name property is accepted as well)
  • Use uploadMedia only for newly uploaded documents/photos (files or BytesIO)

Improvements ✨

  • Refactoring
  • Removed duplicated code
  • Add BytesIO name in DocumentAttributeFilename, fallbacks to "media" if a .name property is not set

What I tested 🧪

  • Every InputMedia* with a local file
  • Every InputMedia* with a external url
  • Every InputMedia* with a named BytesIO media
  • Every InputMedia* with an anonymous (without .name) BytesIO media
  • Editing inline media in chats which DC is different by the bot's data center

I consider this a definitive fix for the method, as I couldn't reproduce any related issue anymore.

@delivrance
delivrance merged commit e192350 into pyrogram:master Aug 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants