KurimuzonAkuma / pyrogram

Elegant, modern and asynchronous Telegram MTProto API framework in Python for users and bots
https://pyrogram.org
GNU Lesser General Public License v3.0
267 stars 72 forks source link

Add fallback parameter to set_profile_photo and minor fixes #35

Closed ALiwoto closed 3 months ago

ALiwoto commented 4 months ago

This pull request applies following patches to the code:

  1. The method get_forum_topics_by_id was giving me attribute errors for some time, so instead of accessing attributes directly, I made it use getattr (e.g. getattr(r, "messages", [])); so it doesn't raise attribute errors anymore. Been testing this on my own fork and been working fine for a while. Also ForumTopic._parse does indeed need messages parameters to get passed to it (so it can later on use top_message (int32) from its raw type to fetch the top message from the messages we have provided it)... (previously we were passing messages parameter to this method as well, but in a recent commit, this got removed).

  2. The promote_chat_member method was using edit_stories=privileges.can_post_stories, which is wrong.

  3. inline_query_result_animation is using input_message_content.write method (which is an async method) without using await keyword. (For proof you can check other inline query result types, such as audio; all of them are using await for .write method.

  4. Official clients have the ability to upload something called "Public Profile Photo": image

In MTProto, that's literally possible by passing a bool parameter called fallback to set_profile_photo.

  1. There is a bug in download_media that is caused by recent commits; whereas the method does not check for file_id field (e.g. when message.document is passed to the method) and hence will raise exception. This was working fine in previous versions.