From ee8b8d5e2ff36f35f41ec46353d9ab5fcf359231 Mon Sep 17 00:00:00 2001 From: eyMarv Date: Wed, 7 Feb 2024 20:03:25 +0100 Subject: [PATCH] black code format --- compiler/api/compiler.py | 170 ++- compiler/errors/compiler.py | 41 +- pyrogram/__init__.py | 4 +- pyrogram/client.py | 375 +++--- pyrogram/connection/connection.py | 22 +- pyrogram/connection/transport/tcp/tcp.py | 15 +- .../connection/transport/tcp/tcp_abridged.py | 8 +- .../transport/tcp/tcp_abridged_o.py | 20 +- .../transport/tcp/tcp_intermediate_o.py | 13 +- pyrogram/crypto/aes.py | 31 +- pyrogram/crypto/mtproto.py | 45 +- pyrogram/crypto/prime.py | 3 +- pyrogram/crypto/rsa.py | 75 +- pyrogram/dispatcher.py | 125 +- pyrogram/emoji.py | 1029 ++++++++++++----- pyrogram/enums/__init__.py | 36 +- pyrogram/enums/profile_color.py | 2 +- pyrogram/enums/reaction_type.py | 1 + pyrogram/enums/reply_color.py | 2 +- pyrogram/errors/__init__.py | 12 +- pyrogram/errors/pyromod/__init__.py | 2 +- pyrogram/errors/pyromod/listener_stopped.py | 2 +- pyrogram/errors/pyromod/listener_timeout.py | 2 +- pyrogram/errors/rpc_error.py | 41 +- pyrogram/file_id.py | 139 ++- pyrogram/filters.py | 147 ++- pyrogram/handlers/__init__.py | 2 +- pyrogram/handlers/conversation_handler.py | 31 +- pyrogram/handlers/handler.py | 4 +- pyrogram/handlers/message_handler.py | 14 +- .../message_reaction_count_updated_handler.py | 2 +- .../message_reaction_updated_handler.py | 2 +- pyrogram/helpers/__init__.py | 2 +- pyrogram/helpers/helpers.py | 2 +- pyrogram/methods/advanced/__init__.py | 6 +- pyrogram/methods/advanced/invoke.py | 14 +- pyrogram/methods/advanced/resolve_peer.py | 23 +- pyrogram/methods/advanced/save_file.py | 36 +- pyrogram/methods/auth/__init__.py | 2 +- .../methods/auth/accept_terms_of_service.py | 7 +- pyrogram/methods/auth/check_password.py | 8 +- pyrogram/methods/auth/connect.py | 6 +- pyrogram/methods/auth/recover_password.py | 9 +- pyrogram/methods/auth/resend_code.py | 7 +- pyrogram/methods/auth/send_code.py | 16 +- pyrogram/methods/auth/send_recovery_code.py | 6 +- pyrogram/methods/auth/sign_in.py | 4 +- pyrogram/methods/auth/sign_in_bot.py | 16 +- pyrogram/methods/auth/sign_up.py | 4 +- pyrogram/methods/bots/__init__.py | 2 +- .../methods/bots/answer_callback_query.py | 4 +- pyrogram/methods/bots/answer_inline_query.py | 9 +- pyrogram/methods/bots/answer_web_app_query.py | 5 +- .../bots/get_bot_default_privileges.py | 11 +- pyrogram/methods/bots/get_bot_info.py | 8 +- pyrogram/methods/bots/get_chat_menu_button.py | 13 +- pyrogram/methods/bots/get_game_high_scores.py | 8 +- .../methods/bots/get_inline_bot_results.py | 9 +- .../methods/bots/request_callback_answer.py | 14 +- pyrogram/methods/bots/send_game.py | 20 +- .../methods/bots/send_inline_bot_result.py | 8 +- .../bots/set_bot_default_privileges.py | 32 +- pyrogram/methods/bots/set_bot_info.py | 14 +- pyrogram/methods/bots/set_chat_menu_button.py | 7 +- pyrogram/methods/bots/set_game_score.py | 14 +- pyrogram/methods/chats/__init__.py | 2 +- pyrogram/methods/chats/add_chat_members.py | 9 +- pyrogram/methods/chats/archive_chats.py | 7 +- pyrogram/methods/chats/ban_chat_member.py | 16 +- pyrogram/methods/chats/close_forum_topic.py | 8 +- pyrogram/methods/chats/close_general_topic.py | 7 +- pyrogram/methods/chats/create_channel.py | 8 +- pyrogram/methods/chats/create_forum_topic.py | 4 +- pyrogram/methods/chats/create_group.py | 5 +- pyrogram/methods/chats/create_supergroup.py | 8 +- pyrogram/methods/chats/delete_channel.py | 5 +- pyrogram/methods/chats/delete_chat_photo.py | 9 +- pyrogram/methods/chats/delete_forum_topic.py | 7 +- pyrogram/methods/chats/delete_supergroup.py | 3 +- pyrogram/methods/chats/delete_user_history.py | 2 +- pyrogram/methods/chats/edit_forum_topic.py | 4 +- pyrogram/methods/chats/edit_general_topic.py | 8 +- pyrogram/methods/chats/get_chat.py | 11 +- pyrogram/methods/chats/get_chat_event_log.py | 4 +- pyrogram/methods/chats/get_chat_member.py | 13 +- pyrogram/methods/chats/get_chat_members.py | 20 +- .../methods/chats/get_chat_members_count.py | 15 +- .../methods/chats/get_chat_online_count.py | 11 +- pyrogram/methods/chats/get_dialogs.py | 15 +- pyrogram/methods/chats/get_dialogs_count.py | 13 +- pyrogram/methods/chats/get_forum_topics.py | 8 +- .../methods/chats/get_forum_topics_by_id.py | 7 +- pyrogram/methods/chats/get_nearby_chats.py | 9 +- pyrogram/methods/chats/get_send_as_chats.py | 7 +- pyrogram/methods/chats/hide_general_topic.py | 7 +- pyrogram/methods/chats/join_chat.py | 7 +- pyrogram/methods/chats/leave_chat.py | 12 +- pyrogram/methods/chats/mark_chat_unread.py | 3 +- pyrogram/methods/chats/pin_chat_message.py | 7 +- pyrogram/methods/chats/promote_chat_member.py | 15 +- pyrogram/methods/chats/reopen_forum_topic.py | 6 +- .../methods/chats/reopen_general_topic.py | 7 +- .../methods/chats/restrict_chat_member.py | 168 ++- .../methods/chats/set_administrator_title.py | 20 +- .../methods/chats/set_chat_description.py | 9 +- .../methods/chats/set_chat_permissions.py | 166 ++- pyrogram/methods/chats/set_chat_photo.py | 5 +- .../chats/set_chat_protected_content.py | 7 +- pyrogram/methods/chats/set_chat_title.py | 14 +- pyrogram/methods/chats/set_chat_username.py | 7 +- pyrogram/methods/chats/set_send_as_chat.py | 4 +- pyrogram/methods/chats/set_slow_mode.py | 7 +- pyrogram/methods/chats/unarchive_chats.py | 7 +- pyrogram/methods/chats/unban_chat_member.py | 8 +- .../methods/chats/unhide_general_topic.py | 7 +- pyrogram/methods/chats/unpin_chat_message.py | 8 +- pyrogram/methods/chats/update_color.py | 9 +- pyrogram/methods/contacts/__init__.py | 6 +- pyrogram/methods/contacts/add_contact.py | 4 +- pyrogram/methods/contacts/delete_contacts.py | 3 +- pyrogram/methods/contacts/get_contacts.py | 4 +- .../methods/contacts/get_contacts_count.py | 8 +- pyrogram/methods/contacts/import_contacts.py | 7 +- pyrogram/methods/decorators/__init__.py | 2 +- .../methods/decorators/on_callback_query.py | 12 +- .../decorators/on_chat_join_request.py | 12 +- .../decorators/on_chat_member_updated.py | 12 +- .../decorators/on_chosen_inline_result.py | 12 +- .../methods/decorators/on_deleted_messages.py | 12 +- .../methods/decorators/on_edited_message.py | 12 +- .../methods/decorators/on_inline_query.py | 12 +- pyrogram/methods/decorators/on_message.py | 8 +- .../on_message_reaction_count_updated.py | 17 +- .../decorators/on_message_reaction_updated.py | 13 +- pyrogram/methods/decorators/on_poll.py | 8 +- pyrogram/methods/decorators/on_raw_update.py | 12 +- pyrogram/methods/decorators/on_story.py | 8 +- pyrogram/methods/decorators/on_user_status.py | 12 +- pyrogram/methods/invite_links/__init__.py | 2 +- .../approve_all_chat_join_requests.py | 8 +- .../invite_links/approve_chat_join_request.py | 2 +- .../invite_links/create_chat_invite_link.py | 4 +- .../decline_all_chat_join_requests.py | 8 +- .../invite_links/decline_chat_join_request.py | 2 +- .../invite_links/edit_chat_invite_link.py | 4 +- .../invite_links/export_chat_invite_link.py | 3 +- .../get_chat_admin_invite_links.py | 2 +- .../get_chat_admin_invite_links_count.py | 2 +- .../invite_links/get_chat_invite_link.py | 3 +- .../get_chat_invite_link_joiners.py | 4 +- .../get_chat_invite_link_joiners_count.py | 6 +- .../invite_links/get_chat_join_requests.py | 4 +- .../invite_links/revoke_chat_invite_link.py | 4 +- pyrogram/methods/messages/__init__.py | 2 +- pyrogram/methods/messages/copy_media_group.py | 51 +- pyrogram/methods/messages/copy_message.py | 6 +- pyrogram/methods/messages/delete_messages.py | 16 +- pyrogram/methods/messages/download_media.py | 27 +- .../methods/messages/edit_inline_caption.py | 4 +- .../methods/messages/edit_inline_media.py | 144 ++- .../messages/edit_inline_reply_markup.py | 4 +- pyrogram/methods/messages/edit_inline_text.py | 4 +- .../methods/messages/edit_message_caption.py | 4 +- .../methods/messages/edit_message_media.py | 89 +- .../messages/edit_message_reply_markup.py | 9 +- .../methods/messages/edit_message_text.py | 11 +- pyrogram/methods/messages/forward_messages.py | 20 +- pyrogram/methods/messages/get_chat_history.py | 8 +- .../messages/get_chat_history_count.py | 5 +- .../messages/get_custom_emoji_stickers.py | 4 +- .../messages/get_discussion_message.py | 3 +- .../messages/get_discussion_replies.py | 2 +- .../messages/get_discussion_replies_count.py | 2 +- pyrogram/methods/messages/get_media_group.py | 24 +- pyrogram/methods/messages/get_messages.py | 12 +- pyrogram/methods/messages/inline_session.py | 13 +- .../methods/messages/read_chat_history.py | 14 +- pyrogram/methods/messages/retract_vote.py | 8 +- pyrogram/methods/messages/search_global.py | 8 +- .../methods/messages/search_global_count.py | 2 +- pyrogram/methods/messages/search_messages.py | 16 +- .../methods/messages/search_messages_count.py | 10 +- pyrogram/methods/messages/send_animation.py | 75 +- pyrogram/methods/messages/send_audio.py | 69 +- .../methods/messages/send_cached_media.py | 30 +- pyrogram/methods/messages/send_chat_action.py | 4 +- pyrogram/methods/messages/send_contact.py | 26 +- pyrogram/methods/messages/send_dice.py | 26 +- pyrogram/methods/messages/send_document.py | 65 +- pyrogram/methods/messages/send_location.py | 29 +- pyrogram/methods/messages/send_media_group.py | 228 ++-- pyrogram/methods/messages/send_message.py | 45 +- pyrogram/methods/messages/send_photo.py | 54 +- pyrogram/methods/messages/send_poll.py | 40 +- pyrogram/methods/messages/send_reaction.py | 20 +- pyrogram/methods/messages/send_sticker.py | 56 +- pyrogram/methods/messages/send_venue.py | 31 +- pyrogram/methods/messages/send_video.py | 69 +- pyrogram/methods/messages/send_video_note.py | 55 +- pyrogram/methods/messages/send_voice.py | 60 +- pyrogram/methods/messages/send_web_page.py | 50 +- pyrogram/methods/messages/stop_poll.py | 9 +- pyrogram/methods/messages/stream_media.py | 19 +- pyrogram/methods/messages/vote_poll.py | 4 +- pyrogram/methods/password/__init__.py | 6 +- .../methods/password/change_cloud_password.py | 8 +- .../methods/password/enable_cloud_password.py | 9 +- .../methods/password/remove_cloud_password.py | 9 +- pyrogram/methods/pyromod/__init__.py | 11 +- pyrogram/methods/pyromod/ask.py | 1 + .../get_listener_matching_with_data.py | 3 +- ...stener_matching_with_identifier_pattern.py | 3 +- .../get_many_listeners_matching_with_data.py | 1 + ...teners_matching_with_identifier_pattern.py | 1 + pyrogram/methods/pyromod/listen.py | 1 + .../pyromod/register_next_step_handler.py | 1 + pyrogram/methods/pyromod/remove_listerner.py | 6 +- pyrogram/methods/pyromod/stop_listener.py | 6 +- pyrogram/methods/pyromod/stop_listening.py | 1 + .../pyromod/wait_for_callback_query.py | 9 +- pyrogram/methods/pyromod/wait_for_message.py | 12 +- pyrogram/methods/stickers/__init__.py | 7 +- .../methods/stickers/add_sticker_to_set.py | 14 +- .../methods/stickers/create_sticker_set.py | 13 +- pyrogram/methods/stickers/get_sticker_set.py | 9 +- pyrogram/methods/users/__init__.py | 2 +- pyrogram/methods/users/block_user.py | 9 +- .../methods/users/delete_profile_photos.py | 15 +- pyrogram/methods/users/delete_stories.py | 9 +- pyrogram/methods/users/edit_story.py | 80 +- pyrogram/methods/users/export_story_link.py | 1 + pyrogram/methods/users/forward_story.py | 11 +- pyrogram/methods/users/get_all_stories.py | 3 +- pyrogram/methods/users/get_chat_photos.py | 19 +- .../methods/users/get_chat_photos_count.py | 8 +- pyrogram/methods/users/get_common_chats.py | 3 +- .../users/get_default_emoji_statuses.py | 4 +- pyrogram/methods/users/get_me.py | 8 +- pyrogram/methods/users/get_peer_stories.py | 5 +- pyrogram/methods/users/get_stories.py | 5 +- pyrogram/methods/users/get_stories_history.py | 12 +- pyrogram/methods/users/get_users.py | 9 +- pyrogram/methods/users/send_story.py | 88 +- pyrogram/methods/users/set_emoji_status.py | 3 +- pyrogram/methods/users/set_profile_photo.py | 3 +- pyrogram/methods/users/set_username.py | 9 +- pyrogram/methods/users/unblock_user.py | 9 +- pyrogram/methods/users/update_profile.py | 6 +- pyrogram/methods/utilities/__init__.py | 2 +- pyrogram/methods/utilities/add_handler.py | 6 +- pyrogram/methods/utilities/compose.py | 5 +- .../utilities/export_session_string.py | 4 +- pyrogram/methods/utilities/idle.py | 3 +- pyrogram/methods/utilities/remove_handler.py | 6 +- pyrogram/methods/utilities/restart.py | 5 +- pyrogram/methods/utilities/run.py | 5 +- pyrogram/methods/utilities/run_sync.py | 5 +- pyrogram/methods/utilities/start.py | 8 +- pyrogram/methods/utilities/stop.py | 5 +- pyrogram/nav/__init__.py | 2 +- pyrogram/nav/pagination.py | 3 +- pyrogram/parser/html.py | 13 +- pyrogram/parser/markdown.py | 102 +- pyrogram/parser/utils.py | 7 +- pyrogram/raw/core/gzip_packed.py | 16 +- pyrogram/raw/core/list.py | 4 +- pyrogram/raw/core/primitives/bytes.py | 11 +- pyrogram/raw/core/primitives/vector.py | 9 +- pyrogram/raw/core/tl_object.py | 8 +- pyrogram/session/auth.py | 89 +- pyrogram/session/internals/data_center.py | 15 +- pyrogram/session/internals/msg_factory.py | 2 +- pyrogram/session/internals/msg_id.py | 2 +- pyrogram/session/internals/seq_no.py | 4 +- pyrogram/session/session.py | 128 +- pyrogram/storage/__init__.py | 1 + pyrogram/storage/dummy_client.py | 7 +- pyrogram/storage/memory_storage.py | 25 +- pyrogram/storage/mongo_storage.py | 138 +-- pyrogram/storage/sqlite_storage.py | 59 +- pyrogram/storage/storage.py | 3 +- pyrogram/sync.py | 22 +- pyrogram/types/authorization/sent_code.py | 9 +- .../types/authorization/terms_of_service.py | 4 +- pyrogram/types/bots_and_keyboards/__init__.py | 6 +- .../types/bots_and_keyboards/bot_command.py | 5 +- ...t_command_scope_all_chat_administrators.py | 3 +- .../bot_command_scope_all_group_chats.py | 3 +- .../bot_command_scope_all_private_chats.py | 3 +- .../bot_command_scope_chat_member.py | 2 +- pyrogram/types/bots_and_keyboards/bot_info.py | 9 +- .../bots_and_keyboards/callback_query.py | 42 +- .../types/bots_and_keyboards/force_reply.py | 13 +- .../bots_and_keyboards/game_high_score.py | 12 +- .../inline_keyboard_button.py | 75 +- .../inline_keyboard_markup.py | 4 +- .../bots_and_keyboards/keyboard_button.py | 55 +- .../types/bots_and_keyboards/login_url.py | 11 +- .../menu_button_commands.py | 7 +- .../bots_and_keyboards/menu_button_default.py | 7 +- .../bots_and_keyboards/menu_button_web_app.py | 11 +- .../reply_keyboard_markup.py | 24 +- .../reply_keyboard_remove.py | 13 +- .../request_peer_type_channel.py | 9 +- .../request_peer_type_chat.py | 12 +- .../request_peer_type_user.py | 7 +- .../sent_web_app_message.py | 7 +- .../types/bots_and_keyboards/web_app_info.py | 3 +- pyrogram/types/inline_mode/__init__.py | 26 +- .../types/inline_mode/chosen_inline_result.py | 34 +- pyrogram/types/inline_mode/inline_query.py | 16 +- .../types/inline_mode/inline_query_result.py | 2 +- .../inline_query_result_animation.py | 24 +- .../inline_query_result_article.py | 15 +- .../inline_mode/inline_query_result_audio.py | 57 +- .../inline_query_result_cached_animation.py | 18 +- .../inline_query_result_cached_audio.py | 18 +- .../inline_query_result_cached_document.py | 18 +- .../inline_query_result_cached_photo.py | 18 +- .../inline_query_result_cached_sticker.py | 8 +- .../inline_query_result_cached_video.py | 18 +- .../inline_query_result_cached_voice.py | 18 +- .../inline_query_result_contact.py | 21 +- .../inline_query_result_document.py | 48 +- .../inline_query_result_location.py | 11 +- .../inline_mode/inline_query_result_photo.py | 28 +- .../inline_mode/inline_query_result_venue.py | 17 +- .../inline_mode/inline_query_result_video.py | 35 +- .../inline_mode/inline_query_result_voice.py | 44 +- pyrogram/types/input_media/__init__.py | 11 +- pyrogram/types/input_media/input_media.py | 2 +- .../input_media/input_media_animation.py | 2 +- .../types/input_media/input_media_area.py | 5 +- .../input_media_area_channel_post.py | 5 +- .../types/input_media/input_media_audio.py | 2 +- .../types/input_media/input_media_document.py | 2 +- .../types/input_media/input_media_photo.py | 2 +- .../types/input_media/input_phone_contact.py | 7 +- .../types/input_message_content/__init__.py | 5 +- .../input_reply_to_message.py | 8 +- .../input_reply_to_story.py | 9 +- .../input_text_message_content.py | 12 +- pyrogram/types/messages_and_media/__init__.py | 47 +- .../types/messages_and_media/animation.py | 9 +- pyrogram/types/messages_and_media/audio.py | 9 +- pyrogram/types/messages_and_media/contact.py | 6 +- pyrogram/types/messages_and_media/dice.py | 6 +- pyrogram/types/messages_and_media/document.py | 7 +- .../messages_and_media/exported_story_link.py | 10 +- pyrogram/types/messages_and_media/game.py | 10 +- pyrogram/types/messages_and_media/giveaway.py | 8 +- .../messages_and_media/giveaway_launched.py | 1 + .../messages_and_media/giveaway_result.py | 12 +- pyrogram/types/messages_and_media/location.py | 10 +- .../types/messages_and_media/media_area.py | 8 +- .../media_area_channel_post.py | 10 +- .../media_area_coordinates.py | 16 +- pyrogram/types/messages_and_media/message.py | 522 +++++---- .../messages_and_media/message_entity.py | 8 +- .../message_reaction_count_updated.py | 8 +- .../message_reaction_updated.py | 22 +- .../messages_and_media/message_reactions.py | 4 +- .../types/messages_and_media/message_story.py | 9 +- pyrogram/types/messages_and_media/photo.py | 20 +- pyrogram/types/messages_and_media/poll.py | 24 +- pyrogram/types/messages_and_media/reaction.py | 18 +- .../messages_and_media/reaction_count.py | 15 +- .../types/messages_and_media/reaction_type.py | 18 +- pyrogram/types/messages_and_media/sticker.py | 46 +- .../types/messages_and_media/stickerset.py | 24 +- .../stories_privacy_rules.py | 6 +- pyrogram/types/messages_and_media/story.py | 205 ++-- .../types/messages_and_media/story_deleted.py | 10 +- .../story_forward_header.py | 16 +- .../types/messages_and_media/story_skipped.py | 7 +- .../types/messages_and_media/story_views.py | 11 +- .../messages_and_media/stripped_thumbnail.py | 16 +- .../types/messages_and_media/thumbnail.py | 19 +- pyrogram/types/messages_and_media/venue.py | 2 +- pyrogram/types/messages_and_media/video.py | 9 +- .../types/messages_and_media/video_note.py | 9 +- pyrogram/types/messages_and_media/voice.py | 13 +- .../types/messages_and_media/web_app_data.py | 5 +- pyrogram/types/messages_and_media/web_page.py | 16 +- .../messages_and_media/web_page_empty.py | 12 +- .../messages_and_media/web_page_preview.py | 8 +- pyrogram/types/object.py | 9 +- pyrogram/types/pyromod/__init__.py | 2 +- pyrogram/types/pyromod/identifier.py | 4 +- pyrogram/types/pyromod/listener.py | 2 + pyrogram/types/user_and_chats/__init__.py | 2 +- pyrogram/types/user_and_chats/chat.py | 202 ++-- .../chat_admin_with_invite_links.py | 7 +- pyrogram/types/user_and_chats/chat_color.py | 18 +- pyrogram/types/user_and_chats/chat_event.py | 139 +-- .../types/user_and_chats/chat_event_filter.py | 5 +- .../types/user_and_chats/chat_invite_link.py | 7 +- .../types/user_and_chats/chat_join_request.py | 30 +- pyrogram/types/user_and_chats/chat_joiner.py | 2 +- pyrogram/types/user_and_chats/chat_member.py | 38 +- .../user_and_chats/chat_member_updated.py | 16 +- .../types/user_and_chats/chat_permissions.py | 6 +- pyrogram/types/user_and_chats/chat_photo.py | 27 +- pyrogram/types/user_and_chats/chat_preview.py | 17 +- .../types/user_and_chats/chat_privileges.py | 10 +- .../types/user_and_chats/chat_reactions.py | 10 +- pyrogram/types/user_and_chats/dialog.py | 2 +- pyrogram/types/user_and_chats/emoji_status.py | 13 +- pyrogram/types/user_and_chats/forum_topic.py | 42 +- .../user_and_chats/forum_topic_created.py | 13 +- .../user_and_chats/forum_topic_edited.py | 12 +- .../user_and_chats/invite_link_importer.py | 8 +- pyrogram/types/user_and_chats/peer_channel.py | 10 +- pyrogram/types/user_and_chats/peer_user.py | 10 +- pyrogram/types/user_and_chats/restriction.py | 2 +- pyrogram/types/user_and_chats/user.py | 23 +- pyrogram/types/user_and_chats/username.py | 14 +- .../types/user_and_chats/video_chat_ended.py | 5 +- .../video_chat_members_invited.py | 7 +- .../user_and_chats/video_chat_scheduled.py | 13 +- pyrogram/utils.py | 115 +- tests/filters/__init__.py | 1 + tests/filters/test_command.py | 2 +- tests/parser/test_html.py | 142 ++- tests/test_file_id.py | 44 +- 425 files changed, 5503 insertions(+), 4255 deletions(-) diff --git a/compiler/api/compiler.py b/compiler/api/compiler.py index 07435778e..39579d7f2 100644 --- a/compiler/api/compiler.py +++ b/compiler/api/compiler.py @@ -34,14 +34,26 @@ SECTION_RE = re.compile(r"---(\w+)---") LAYER_RE = re.compile(r"//\sLAYER\s(\d+)") -COMBINATOR_RE = re.compile(r"^([\w.]+)#([0-9a-f]+)\s(?:.*)=\s([\w<>.]+);$", re.MULTILINE) +COMBINATOR_RE = re.compile( + r"^([\w.]+)#([0-9a-f]+)\s(?:.*)=\s([\w<>.]+);$", re.MULTILINE +) ARGS_RE = re.compile(r"[^{](\w+):([\w?!.<>#]+)") FLAGS_RE = re.compile(r"flags(\d?)\.(\d+)\?") FLAGS_RE_2 = re.compile(r"flags(\d?)\.(\d+)\?([\w<>.]+)") FLAGS_RE_3 = re.compile(r"flags(\d?):#") INT_RE = re.compile(r"int(\d+)") -CORE_TYPES = ["int", "long", "int128", "int256", "double", "bytes", "string", "Bool", "true"] +CORE_TYPES = [ + "int", + "long", + "int128", + "int256", + "double", + "bytes", + "string", + "Bool", + "true", +] WARNING = """ # # # # # # # # # # # # # # # # # # # # # # # # @@ -65,11 +77,7 @@ with open("docs.json") as f: docs = json.load(f) except FileNotFoundError: - docs = { - "type": {}, - "constructor": {}, - "method": {} - } + docs = {"type": {}, "constructor": {}, "method": {}} class Combinator(NamedTuple): @@ -206,13 +214,14 @@ def start(format: bool = False): shutil.rmtree(DESTINATION_PATH / "functions", ignore_errors=True) shutil.rmtree(DESTINATION_PATH / "base", ignore_errors=True) - with open(HOME_PATH / "source/auth_key.tl") as f1, \ - open(HOME_PATH / "source/sys_msgs.tl") as f2, \ - open(HOME_PATH / "source/main_api.tl") as f3: + with open(HOME_PATH / "source/auth_key.tl") as f1, open( + HOME_PATH / "source/sys_msgs.tl" + ) as f2, open(HOME_PATH / "source/main_api.tl") as f3: schema = (f1.read() + f2.read() + f3.read()).splitlines() - with open(HOME_PATH / "template/type.txt") as f1, \ - open(HOME_PATH / "template/combinator.txt") as f2: + with open(HOME_PATH / "template/type.txt") as f1, open( + HOME_PATH / "template/combinator.txt" + ) as f2: type_tmpl = f1.read() combinator_tmpl = f2.read() @@ -277,7 +286,7 @@ def start(format: bool = False): args=args, qualtype=qualtype, typespace=typespace, - type=type + type=type, ) combinators.append(combinator) @@ -338,22 +347,26 @@ def start(format: bool = False): docstring = type_docs - docstring += f"\n\n Constructors:\n" \ - f" This base type has {constr_count} constructor{'s' if constr_count > 1 else ''} available.\n\n" \ - f" .. currentmodule:: pyrogram.raw.types\n\n" \ - f" .. autosummary::\n" \ - f" :nosignatures:\n\n" \ - f" {items}" + docstring += ( + f"\n\n Constructors:\n" + f" This base type has {constr_count} constructor{'s' if constr_count > 1 else ''} available.\n\n" + f" .. currentmodule:: pyrogram.raw.types\n\n" + f" .. autosummary::\n" + f" :nosignatures:\n\n" + f" {items}" + ) references, ref_count = get_references(qualtype, "types") if references: - docstring += f"\n\n Functions:\n This object can be returned by " \ - f"{ref_count} function{'s' if ref_count > 1 else ''}.\n\n" \ - f" .. currentmodule:: pyrogram.raw.functions\n\n" \ - f" .. autosummary::\n" \ - f" :nosignatures:\n\n" \ - f" " + references + docstring += ( + f"\n\n Functions:\n This object can be returned by " + f"{ref_count} function{'s' if ref_count > 1 else ''}.\n\n" + f" .. currentmodule:: pyrogram.raw.functions\n\n" + f" .. autosummary::\n" + f" :nosignatures:\n\n" + f" " + references + ) with open(dir_path / f"{snake(module)}.py", "w") as f: f.write( @@ -364,25 +377,24 @@ def start(format: bool = False): name=type, qualname=qualtype, types=", ".join([f"raw.types.{c}" for c in constructors]), - doc_name=snake(type).replace("_", "-") + doc_name=snake(type).replace("_", "-"), ) ) for c in combinators: sorted_args = sort_args(c.args) - arguments = ( - (", *, " if c.args else "") + - (", ".join( - [f"{i[0]}: {get_type_hint(i[1])}" - for i in sorted_args] - ) if sorted_args else "") + arguments = (", *, " if c.args else "") + ( + ", ".join([f"{i[0]}: {get_type_hint(i[1])}" for i in sorted_args]) + if sorted_args + else "" ) - fields = "\n ".join( - [f"self.{i[0]} = {i[0]} # {i[1]}" - for i in sorted_args] - ) if sorted_args else "pass" + fields = ( + "\n ".join([f"self.{i[0]} = {i[0]} # {i[1]}" for i in sorted_args]) + if sorted_args + else "pass" + ) docstring = "" docstring_args = [] @@ -410,7 +422,7 @@ def start(format: bool = False): arg_name, get_docstring_arg_type(arg_type), ", *optional*".format(flag_number) if is_optional else "", - arg_docs + arg_docs, ) ) @@ -433,8 +445,11 @@ def start(format: bool = False): docstring += f"Telegram API function." docstring += f"\n\n Details:\n - Layer: ``{layer}``\n - ID: ``{c.id[2:].upper()}``\n\n" - docstring += f" Parameters:\n " + \ - (f"\n ".join(docstring_args) if docstring_args else "No parameters required.\n") + docstring += f" Parameters:\n " + ( + f"\n ".join(docstring_args) + if docstring_args + else "No parameters required.\n" + ) if c.section == "functions": docstring += "\n Returns:\n " + get_docstring_arg_type(c.qualtype) @@ -442,12 +457,14 @@ def start(format: bool = False): references, count = get_references(c.qualname, "constructors") if references: - docstring += f"\n Functions:\n This object can be returned by " \ - f"{count} function{'s' if count > 1 else ''}.\n\n" \ - f" .. currentmodule:: pyrogram.raw.functions\n\n" \ - f" .. autosummary::\n" \ - f" :nosignatures:\n\n" \ - f" " + references + docstring += ( + f"\n Functions:\n This object can be returned by " + f"{count} function{'s' if count > 1 else ''}.\n\n" + f" .. currentmodule:: pyrogram.raw.functions\n\n" + f" .. autosummary::\n" + f" :nosignatures:\n\n" + f" " + references + ) write_types = read_types = "" if c.has_flags else "# No flags\n " @@ -464,17 +481,24 @@ def start(format: bool = False): if arg_name != f"flags{flag.group(1)}": continue - if flag.group(3) == "true" or flag.group(3).startswith("Vector"): - write_flags.append(f"{arg_name} |= (1 << {flag.group(2)}) if self.{i[0]} else 0") + if flag.group(3) == "true" or flag.group(3).startswith( + "Vector" + ): + write_flags.append( + f"{arg_name} |= (1 << {flag.group(2)}) if self.{i[0]} else 0" + ) else: write_flags.append( - f"{arg_name} |= (1 << {flag.group(2)}) if self.{i[0]} is not None else 0") - - write_flags = "\n ".join([ - f"{arg_name} = 0", - "\n ".join(write_flags), - f"b.write(Int({arg_name}))\n " - ]) + f"{arg_name} |= (1 << {flag.group(2)}) if self.{i[0]} is not None else 0" + ) + + write_flags = "\n ".join( + [ + f"{arg_name} = 0", + "\n ".join(write_flags), + f"b.write(Int({arg_name}))\n ", + ] + ) write_types += write_flags read_types += f"\n {arg_name} = Int.read(b)\n " @@ -490,7 +514,9 @@ def start(format: bool = False): elif flag_type in CORE_TYPES: write_types += "\n " write_types += f"if self.{arg_name} is not None:\n " - write_types += f"b.write({flag_type.title()}(self.{arg_name}))\n " + write_types += ( + f"b.write({flag_type.title()}(self.{arg_name}))\n " + ) read_types += "\n " read_types += f"{arg_name} = {flag_type.title()}.read(b) if flags{number} & (1 << {index}) else None" @@ -500,12 +526,16 @@ def start(format: bool = False): write_types += "\n " write_types += f"if self.{arg_name} is not None:\n " write_types += "b.write(Vector(self.{}{}))\n ".format( - arg_name, f", {sub_type.title()}" if sub_type in CORE_TYPES else "" + arg_name, + f", {sub_type.title()}" if sub_type in CORE_TYPES else "", ) read_types += "\n " read_types += "{} = TLObject.read(b{}) if flags{} & (1 << {}) else []\n ".format( - arg_name, f", {sub_type.title()}" if sub_type in CORE_TYPES else "", number, index + arg_name, + f", {sub_type.title()}" if sub_type in CORE_TYPES else "", + number, + index, ) else: write_types += "\n " @@ -517,7 +547,9 @@ def start(format: bool = False): else: if arg_type in CORE_TYPES: write_types += "\n " - write_types += f"b.write({arg_type.title()}(self.{arg_name}))\n " + write_types += ( + f"b.write({arg_type.title()}(self.{arg_name}))\n " + ) read_types += "\n " read_types += f"{arg_name} = {arg_type.title()}.read(b)\n " @@ -526,12 +558,14 @@ def start(format: bool = False): write_types += "\n " write_types += "b.write(Vector(self.{}{}))\n ".format( - arg_name, f", {sub_type.title()}" if sub_type in CORE_TYPES else "" + arg_name, + f", {sub_type.title()}" if sub_type in CORE_TYPES else "", ) read_types += "\n " read_types += "{} = TLObject.read(b{})\n ".format( - arg_name, f", {sub_type.title()}" if sub_type in CORE_TYPES else "" + arg_name, + f", {sub_type.title()}" if sub_type in CORE_TYPES else "", ) else: write_types += "\n " @@ -555,7 +589,7 @@ def start(format: bool = False): fields=fields, read_types=read_types, write_types=write_types, - return_arguments=return_arguments + return_arguments=return_arguments, ) directory = "types" if c.section == "types" else c.section @@ -572,7 +606,11 @@ def start(format: bool = False): with open(dir_path / f"{snake(module)}.py", "w") as f: f.write(compiled_combinator) - d = namespaces_to_constructors if c.section == "types" else namespaces_to_functions + d = ( + namespaces_to_constructors + if c.section == "types" + else namespaces_to_functions + ) if c.namespace not in d: d[c.namespace] = [] @@ -609,7 +647,9 @@ def start(format: bool = False): f.write(f"from .{snake(module)} import {t}\n") if not namespace: - f.write(f"from . import {', '.join(filter(bool, namespaces_to_constructors))}\n") + f.write( + f"from . import {', '.join(filter(bool, namespaces_to_constructors))}\n" + ) for namespace, types in namespaces_to_functions.items(): with open(DESTINATION_PATH / "functions" / namespace / "__init__.py", "w") as f: @@ -625,7 +665,9 @@ def start(format: bool = False): f.write(f"from .{snake(module)} import {t}\n") if not namespace: - f.write(f"from . import {', '.join(filter(bool, namespaces_to_functions))}") + f.write( + f"from . import {', '.join(filter(bool, namespaces_to_functions))}" + ) with open(DESTINATION_PATH / "all.py", "w", encoding="utf-8") as f: f.write(notice + "\n\n") diff --git a/compiler/errors/compiler.py b/compiler/errors/compiler.py index 383ae06fa..fbf4f344a 100644 --- a/compiler/errors/compiler.py +++ b/compiler/errors/compiler.py @@ -73,16 +73,22 @@ def start(): with open(init, "a", encoding="utf-8") as f_init: f_init.write("from .{}_{} import *\n".format(name.lower(), code)) - with open("{}/source/{}".format(HOME, i), encoding="utf-8") as f_csv, \ - open("{}/{}_{}.py".format(DEST, name.lower(), code), "w", encoding="utf-8") as f_class: + with open("{}/source/{}".format(HOME, i), encoding="utf-8") as f_csv, open( + "{}/{}_{}.py".format(DEST, name.lower(), code), "w", encoding="utf-8" + ) as f_class: reader = csv.reader(f_csv, delimiter="\t") super_class = caml(name) - name = " ".join([str(i.capitalize()) for i in re.sub(r"_", " ", name).lower().split(" ")]) + name = " ".join( + [ + str(i.capitalize()) + for i in re.sub(r"_", " ", name).lower().split(" ") + ] + ) sub_classes = [] - f_all.write(" \"_\": \"{}\",\n".format(super_class)) + f_all.write(' "_": "{}",\n'.format(super_class)) for j, row in enumerate(reader): if j == 0: @@ -99,14 +105,18 @@ def start(): sub_class = re.sub(r"^2", "Two", sub_class) sub_class = re.sub(r" ", "", sub_class) - f_all.write(" \"{}\": \"{}\",\n".format(error_id, sub_class)) + f_all.write(' "{}": "{}",\n'.format(error_id, sub_class)) sub_classes.append((sub_class, error_id, error_message)) - with open("{}/template/class.txt".format(HOME), "r", encoding="utf-8") as f_class_template: + with open( + "{}/template/class.txt".format(HOME), "r", encoding="utf-8" + ) as f_class_template: class_template = f_class_template.read() - with open("{}/template/sub_class.txt".format(HOME), "r", encoding="utf-8") as f_sub_class_template: + with open( + "{}/template/sub_class.txt".format(HOME), "r", encoding="utf-8" + ) as f_sub_class_template: sub_class_template = f_sub_class_template.read() class_template = class_template.format( @@ -114,12 +124,17 @@ def start(): super_class=super_class, code=code, docstring='"""{}"""'.format(name), - sub_classes="".join([sub_class_template.format( - sub_class=k[0], - super_class=super_class, - id="\"{}\"".format(k[1]), - docstring='"""{}"""'.format(k[2]) - ) for k in sub_classes]) + sub_classes="".join( + [ + sub_class_template.format( + sub_class=k[0], + super_class=super_class, + id='"{}"'.format(k[1]), + docstring='"""{}"""'.format(k[2]), + ) + for k in sub_classes + ] + ), ) f_class.write(class_template) diff --git a/pyrogram/__init__.py b/pyrogram/__init__.py index 5adc4e9c0..48ef12696 100644 --- a/pyrogram/__init__.py +++ b/pyrogram/__init__.py @@ -20,7 +20,9 @@ __fork_name__ = "PyroFork" __version__ = "2.3.23" __license__ = "GNU Lesser General Public License v3.0 (LGPL-3.0)" -__copyright__ = "Copyright (C) 2022-present Mayuri-Chan " +__copyright__ = ( + "Copyright (C) 2022-present Mayuri-Chan " +) from concurrent.futures.thread import ThreadPoolExecutor diff --git a/pyrogram/client.py b/pyrogram/client.py index d6d57ae77..088568c8e 100644 --- a/pyrogram/client.py +++ b/pyrogram/client.py @@ -44,13 +44,15 @@ from pyrogram.errors import CDNFileHashMismatch from pyrogram.errors import ( SessionPasswordNeeded, - VolumeLocNotFound, ChannelPrivate, - BadRequest + VolumeLocNotFound, + ChannelPrivate, + BadRequest, ) from pyrogram.handlers.handler import Handler from pyrogram.methods import Methods from pyrogram.session import Auth, Session from pyrogram.storage import FileStorage, MemoryStorage, Storage + try: import pymongo except Exception: @@ -211,7 +213,9 @@ class Client(Methods): PARENT_DIR = Path(sys.argv[0]).parent - INVITE_LINK_RE = re.compile(r"^(?:https?://)?(?:www\.)?(?:t(?:elegram)?\.(?:org|me|dog)/(?:joinchat/|\+))([\w-]+)$") + INVITE_LINK_RE = re.compile( + r"^(?:https?://)?(?:www\.)?(?:t(?:elegram)?\.(?:org|me|dog)/(?:joinchat/|\+))([\w-]+)$" + ) WORKERS = min(32, (os.cpu_count() or 0) + 4) # os.cpu_count() can be None WORKDIR = PARENT_DIR @@ -253,7 +257,7 @@ def __init__( takeout: bool = None, sleep_threshold: int = Session.SLEEP_THRESHOLD, hide_password: bool = False, - max_concurrent_transmissions: int = MAX_CONCURRENT_TRANSMISSIONS + max_concurrent_transmissions: int = MAX_CONCURRENT_TRANSMISSIONS, ): super().__init__() @@ -299,8 +303,7 @@ def __init__( import pymongo except Exception: log.warning( - "pymongo is missing! " - "Using MemoryStorage as session storage" + "pymongo is missing! " "Using MemoryStorage as session storage" ) self.storage = MemoryStorage(self.name) else: @@ -340,7 +343,9 @@ def __init__( self.updates_watchdog_event = asyncio.Event() self.updates_invoke_error = None self.last_update_time = datetime.now() - self.listeners = {listener_type: [] for listener_type in pyrogram.enums.ListenerTypes} + self.listeners = { + listener_type: [] for listener_type in pyrogram.enums.ListenerTypes + } self.loop = asyncio.get_event_loop() def __enter__(self): @@ -364,13 +369,17 @@ async def __aexit__(self, *args): async def updates_watchdog(self): while True: try: - await asyncio.wait_for(self.updates_watchdog_event.wait(), self.UPDATES_WATCHDOG_INTERVAL) + await asyncio.wait_for( + self.updates_watchdog_event.wait(), self.UPDATES_WATCHDOG_INTERVAL + ) except asyncio.TimeoutError: pass else: break - if datetime.now() - self.last_update_time > timedelta(seconds=self.UPDATES_WATCHDOG_INTERVAL): + if datetime.now() - self.last_update_time > timedelta( + seconds=self.UPDATES_WATCHDOG_INTERVAL + ): await self.invoke(raw.functions.updates.GetState()) async def authorize(self) -> User: @@ -378,8 +387,10 @@ async def authorize(self) -> User: return await self.sign_in_bot(self.bot_token) print(f"Welcome to Pyrogram (version {__version__})") - print(f"Pyrogram is free software and comes with ABSOLUTELY NO WARRANTY. Licensed\n" - f"under the terms of the {__license__}.\n") + print( + f"Pyrogram is free software and comes with ABSOLUTELY NO WARRANTY. Licensed\n" + f"under the terms of the {__license__}.\n" + ) while True: try: @@ -390,7 +401,9 @@ async def authorize(self) -> User: if not value: continue - confirm = (await ainput(f'Is "{value}" correct? (y/N): ')).lower() + confirm = ( + await ainput(f'Is "{value}" correct? (y/N): ') + ).lower() if confirm == "y": break @@ -415,17 +428,21 @@ async def authorize(self) -> User: enums.SentCodeType.CALL: "phone call", enums.SentCodeType.FLASH_CALL: "phone flash call", enums.SentCodeType.FRAGMENT_SMS: "Fragment SMS", - enums.SentCodeType.EMAIL_CODE: "email code" + enums.SentCodeType.EMAIL_CODE: "email code", } - print(f"The confirmation code has been sent via {sent_code_descriptions[sent_code.type]}") + print( + f"The confirmation code has been sent via {sent_code_descriptions[sent_code.type]}" + ) while True: if not self.phone_code: self.phone_code = await ainput("Enter confirmation code: ") try: - signed_in = await self.sign_in(self.phone_number, sent_code.phone_code_hash, self.phone_code) + signed_in = await self.sign_in( + self.phone_number, sent_code.phone_code_hash, self.phone_code + ) except BadRequest as e: print(e.MESSAGE) self.phone_code = None @@ -436,7 +453,10 @@ async def authorize(self) -> User: print("Password hint: {}".format(await self.get_password_hint())) if not self.password: - self.password = await ainput("Enter password (empty to recover): ", hide=self.hide_password) + self.password = await ainput( + "Enter password (empty to recover): ", + hide=self.hide_password, + ) try: if not self.password: @@ -444,13 +464,19 @@ async def authorize(self) -> User: if confirm == "y": email_pattern = await self.send_recovery_code() - print(f"The recovery code has been sent to {email_pattern}") + print( + f"The recovery code has been sent to {email_pattern}" + ) while True: - recovery_code = await ainput("Enter recovery code: ") + recovery_code = await ainput( + "Enter recovery code: " + ) try: - return await self.recover_password(recovery_code) + return await self.recover_password( + recovery_code + ) except BadRequest as e: print(e.MESSAGE) except Exception as e: @@ -475,10 +501,7 @@ async def authorize(self) -> User: try: signed_up = await self.sign_up( - self.phone_number, - sent_code.phone_code_hash, - first_name, - last_name + self.phone_number, sent_code.phone_code_hash, first_name, last_name ) except BadRequest as e: print(e.MESSAGE) @@ -529,7 +552,9 @@ def set_parse_mode(self, parse_mode: Optional["enums.ParseMode"]): self.parse_mode = parse_mode - async def fetch_peers(self, peers: List[Union[raw.types.User, raw.types.Chat, raw.types.Channel]]) -> bool: + async def fetch_peers( + self, peers: List[Union[raw.types.User, raw.types.Chat, raw.types.Channel]] + ) -> bool: is_min = False parsed_peers = [] usernames = [] @@ -546,8 +571,10 @@ async def fetch_peers(self, peers: List[Union[raw.types.User, raw.types.Chat, ra peer_id = peer.id access_hash = peer.access_hash username = ( - peer.username.lower() if peer.username - else peer.usernames[0].username.lower() if peer.usernames + peer.username.lower() + if peer.username + else peer.usernames[0].username.lower() + if peer.usernames else None ) if peer.usernames is not None and len(peer.usernames) > 1: @@ -563,8 +590,10 @@ async def fetch_peers(self, peers: List[Union[raw.types.User, raw.types.Chat, ra peer_id = utils.get_channel_id(peer.id) access_hash = peer.access_hash username = ( - peer.username.lower() if peer.username - else peer.usernames[0].username.lower() if peer.usernames + peer.username.lower() + if peer.username + else peer.usernames[0].username.lower() + if peer.usernames else None ) if peer.usernames is not None and len(peer.usernames) > 1: @@ -578,7 +607,9 @@ async def fetch_peers(self, peers: List[Union[raw.types.User, raw.types.Chat, ra else: continue - parsed_peers.append((peer_id, access_hash, peer_type, username, phone_number)) + parsed_peers.append( + (peer_id, access_hash, peer_type, username, phone_number) + ) await self.storage.update_peers(parsed_peers) await self.storage.update_usernames(usernames) @@ -589,21 +620,21 @@ async def handle_updates(self, updates): self.last_update_time = datetime.now() if isinstance(updates, (raw.types.Updates, raw.types.UpdatesCombined)): - is_min = any(( - await self.fetch_peers(updates.users), - await self.fetch_peers(updates.chats), - )) + is_min = any( + ( + await self.fetch_peers(updates.users), + await self.fetch_peers(updates.chats), + ) + ) users = {u.id: u for u in updates.users} chats = {c.id: c for c in updates.chats} for update in updates.updates: channel_id = getattr( - getattr( - getattr( - update, "message", None - ), "peer_id", None - ), "channel_id", None + getattr(getattr(update, "message", None), "peer_id", None), + "channel_id", + None, ) or getattr(update, "channel_id", None) pts = getattr(update, "pts", None) @@ -619,47 +650,57 @@ async def handle_updates(self, updates): try: diff = await self.invoke( raw.functions.updates.GetChannelDifference( - channel=await self.resolve_peer(utils.get_channel_id(channel_id)), + channel=await self.resolve_peer( + utils.get_channel_id(channel_id) + ), filter=raw.types.ChannelMessagesFilter( - ranges=[raw.types.MessageRange( - min_id=update.message.id, - max_id=update.message.id - )] + ranges=[ + raw.types.MessageRange( + min_id=update.message.id, + max_id=update.message.id, + ) + ] ), pts=pts - pts_count, - limit=pts + limit=pts, ) ) except ChannelPrivate: pass else: - if not isinstance(diff, raw.types.updates.ChannelDifferenceEmpty): + if not isinstance( + diff, raw.types.updates.ChannelDifferenceEmpty + ): users.update({u.id: u for u in diff.users}) chats.update({c.id: c for c in diff.chats}) self.dispatcher.updates_queue.put_nowait((update, users, chats)) - elif isinstance(updates, (raw.types.UpdateShortMessage, raw.types.UpdateShortChatMessage)): + elif isinstance( + updates, (raw.types.UpdateShortMessage, raw.types.UpdateShortChatMessage) + ): diff = await self.invoke( raw.functions.updates.GetDifference( - pts=updates.pts - updates.pts_count, - date=updates.date, - qts=-1 + pts=updates.pts - updates.pts_count, date=updates.date, qts=-1 ) ) if diff.new_messages: - self.dispatcher.updates_queue.put_nowait(( - raw.types.UpdateNewMessage( - message=diff.new_messages[0], - pts=updates.pts, - pts_count=updates.pts_count - ), - {u.id: u for u in diff.users}, - {c.id: c for c in diff.chats} - )) + self.dispatcher.updates_queue.put_nowait( + ( + raw.types.UpdateNewMessage( + message=diff.new_messages[0], + pts=updates.pts, + pts_count=updates.pts_count, + ), + {u.id: u for u in diff.users}, + {c.id: c for c in diff.chats}, + ) + ) else: if diff.other_updates: # The other_updates list can be empty - self.dispatcher.updates_queue.put_nowait((diff.other_updates[0], {}, {})) + self.dispatcher.updates_queue.put_nowait( + (diff.other_updates[0], {}, {}) + ) elif isinstance(updates, raw.types.UpdateShort): self.dispatcher.updates_queue.put_nowait((updates.update, {}, {})) elif isinstance(updates, raw.types.UpdatesTooLong): @@ -668,17 +709,21 @@ async def handle_updates(self, updates): async def load_session(self): await self.storage.open() - session_empty = any([ - await self.storage.test_mode() is None, - await self.storage.auth_key() is None, - await self.storage.user_id() is None, - await self.storage.is_bot() is None - ]) + session_empty = any( + [ + await self.storage.test_mode() is None, + await self.storage.auth_key() is None, + await self.storage.user_id() is None, + await self.storage.is_bot() is None, + ] + ) if session_empty: if not self.api_id or not self.api_hash: - raise AttributeError("The API key is required for new authorizations. " - "More info: https://eyMarv.github.io/pyrofork-docs/start/auth") + raise AttributeError( + "The API key is required for new authorizations. " + "More info: https://eyMarv.github.io/pyrofork-docs/start/auth" + ) await self.storage.api_id(self.api_id) @@ -688,8 +733,7 @@ async def load_session(self): await self.storage.test_mode(self.test_mode) await self.storage.auth_key( await Auth( - self, await self.storage.dc_id(), - await self.storage.test_mode() + self, await self.storage.dc_id(), await self.storage.test_mode() ).create() ) await self.storage.user_id(None) @@ -702,13 +746,17 @@ async def load_session(self): else: while True: try: - value = int(await ainput("Enter the api_id part of the API key: ")) + value = int( + await ainput("Enter the api_id part of the API key: ") + ) if value <= 0: print("Invalid value") continue - confirm = (await ainput(f'Is "{value}" correct? (y/N): ')).lower() + confirm = ( + await ainput(f'Is "{value}" correct? (y/N): ') + ).lower() if confirm == "y": await self.storage.api_id(value) @@ -738,18 +786,27 @@ def load_plugins(self): if not include: for path in sorted(Path(root.replace(".", "/")).rglob("*.py")): - module_path = '.'.join(path.parent.parts + (path.stem,)) + module_path = ".".join(path.parent.parts + (path.stem,)) module = import_module(module_path) for name in vars(module).keys(): # noinspection PyBroadException try: for handler, group in getattr(module, name).handlers: - if isinstance(handler, Handler) and isinstance(group, int): + if isinstance(handler, Handler) and isinstance( + group, int + ): self.add_handler(handler, group) - log.info('[{}] [LOAD] {}("{}") in group {} from "{}"'.format( - self.name, type(handler).__name__, name, group, module_path)) + log.info( + '[{}] [LOAD] {}("{}") in group {} from "{}"'.format( + self.name, + type(handler).__name__, + name, + group, + module_path, + ) + ) count += 1 except Exception: @@ -762,11 +819,19 @@ def load_plugins(self): try: module = import_module(module_path) except ImportError: - log.warning('[%s] [LOAD] Ignoring non-existent module "%s"', self.name, module_path) + log.warning( + '[%s] [LOAD] Ignoring non-existent module "%s"', + self.name, + module_path, + ) continue if "__path__" in dir(module): - log.warning('[%s] [LOAD] Ignoring namespace "%s"', self.name, module_path) + log.warning( + '[%s] [LOAD] Ignoring namespace "%s"', + self.name, + module_path, + ) continue if handlers is None: @@ -777,17 +842,29 @@ def load_plugins(self): # noinspection PyBroadException try: for handler, group in getattr(module, name).handlers: - if isinstance(handler, Handler) and isinstance(group, int): + if isinstance(handler, Handler) and isinstance( + group, int + ): self.add_handler(handler, group) - log.info('[{}] [LOAD] {}("{}") in group {} from "{}"'.format( - self.name, type(handler).__name__, name, group, module_path)) + log.info( + '[{}] [LOAD] {}("{}") in group {} from "{}"'.format( + self.name, + type(handler).__name__, + name, + group, + module_path, + ) + ) count += 1 except Exception: if warn_non_existent_functions: - log.warning('[{}] [LOAD] Ignoring non-existent function "{}" from "{}"'.format( - self.name, name, module_path)) + log.warning( + '[{}] [LOAD] Ignoring non-existent function "{}" from "{}"'.format( + self.name, name, module_path + ) + ) if exclude: for path, handlers in exclude: @@ -797,11 +874,19 @@ def load_plugins(self): try: module = import_module(module_path) except ImportError: - log.warning('[%s] [UNLOAD] Ignoring non-existent module "%s"', self.name, module_path) + log.warning( + '[%s] [UNLOAD] Ignoring non-existent module "%s"', + self.name, + module_path, + ) continue if "__path__" in dir(module): - log.warning('[%s] [UNLOAD] Ignoring namespace "%s"', self.name, module_path) + log.warning( + '[%s] [UNLOAD] Ignoring namespace "%s"', + self.name, + module_path, + ) continue if handlers is None: @@ -812,33 +897,61 @@ def load_plugins(self): # noinspection PyBroadException try: for handler, group in getattr(module, name).handlers: - if isinstance(handler, Handler) and isinstance(group, int): + if isinstance(handler, Handler) and isinstance( + group, int + ): self.remove_handler(handler, group) - log.info('[{}] [UNLOAD] {}("{}") from group {} in "{}"'.format( - self.name, type(handler).__name__, name, group, module_path)) + log.info( + '[{}] [UNLOAD] {}("{}") from group {} in "{}"'.format( + self.name, + type(handler).__name__, + name, + group, + module_path, + ) + ) count -= 1 except Exception: if warn_non_existent_functions: - log.warning('[{}] [UNLOAD] Ignoring non-existent function "{}" from "{}"'.format( - self.name, name, module_path)) + log.warning( + '[{}] [UNLOAD] Ignoring non-existent function "{}" from "{}"'.format( + self.name, name, module_path + ) + ) if count > 0: - log.info('[{}] Successfully loaded {} plugin{} from "{}"'.format( - self.name, count, "s" if count > 1 else "", root)) + log.info( + '[{}] Successfully loaded {} plugin{} from "{}"'.format( + self.name, count, "s" if count > 1 else "", root + ) + ) else: log.warning('[%s] No plugin loaded from "%s"', self.name, root) async def handle_download(self, packet): - file_id, directory, file_name, in_memory, file_size, progress, progress_args = packet + ( + file_id, + directory, + file_name, + in_memory, + file_size, + progress, + progress_args, + ) = packet os.makedirs(directory, exist_ok=True) if not in_memory else None - temp_file_path = os.path.abspath(re.sub("\\\\", "/", os.path.join(directory, file_name))) + ".temp" + temp_file_path = ( + os.path.abspath(re.sub("\\\\", "/", os.path.join(directory, file_name))) + + ".temp" + ) file = BytesIO() if in_memory else open(temp_file_path, "wb") try: - async for chunk in self.get_file(file_id, file_size, 0, 0, progress, progress_args): + async for chunk in self.get_file( + file_id, file_size, 0, 0, progress, progress_args + ): file.write(chunk) except BaseException as e: if not in_memory: @@ -869,7 +982,7 @@ async def get_file( limit: int = 0, offset: int = 0, progress: Callable = None, - progress_args: tuple = () + progress_args: tuple = (), ) -> Optional[AsyncGenerator[bytes, None]]: async with self.get_file_semaphore: file_type = file_id.file_type @@ -877,38 +990,35 @@ async def get_file( if file_type == FileType.CHAT_PHOTO: if file_id.chat_id > 0: peer = raw.types.InputPeerUser( - user_id=file_id.chat_id, - access_hash=file_id.chat_access_hash + user_id=file_id.chat_id, access_hash=file_id.chat_access_hash ) else: if file_id.chat_access_hash == 0: - peer = raw.types.InputPeerChat( - chat_id=-file_id.chat_id - ) + peer = raw.types.InputPeerChat(chat_id=-file_id.chat_id) else: peer = raw.types.InputPeerChannel( channel_id=utils.get_channel_id(file_id.chat_id), - access_hash=file_id.chat_access_hash + access_hash=file_id.chat_access_hash, ) location = raw.types.InputPeerPhotoFileLocation( peer=peer, photo_id=file_id.media_id, - big=file_id.thumbnail_source == ThumbnailSource.CHAT_PHOTO_BIG + big=file_id.thumbnail_source == ThumbnailSource.CHAT_PHOTO_BIG, ) elif file_type == FileType.PHOTO: location = raw.types.InputPhotoFileLocation( id=file_id.media_id, access_hash=file_id.access_hash, file_reference=file_id.file_reference, - thumb_size=file_id.thumbnail_size + thumb_size=file_id.thumbnail_size, ) else: location = raw.types.InputDocumentFileLocation( id=file_id.media_id, access_hash=file_id.access_hash, file_reference=file_id.file_reference, - thumb_size=file_id.thumbnail_size + thumb_size=file_id.thumbnail_size, ) current = 0 @@ -919,12 +1029,13 @@ async def get_file( dc_id = file_id.dc_id session = Session( - self, dc_id, + self, + dc_id, await Auth(self, dc_id, await self.storage.test_mode()).create() if dc_id != await self.storage.dc_id() else await self.storage.auth_key(), await self.storage.test_mode(), - is_media=True + is_media=True, ) try: @@ -932,25 +1043,20 @@ async def get_file( if dc_id != await self.storage.dc_id(): exported_auth = await self.invoke( - raw.functions.auth.ExportAuthorization( - dc_id=dc_id - ) + raw.functions.auth.ExportAuthorization(dc_id=dc_id) ) await session.invoke( raw.functions.auth.ImportAuthorization( - id=exported_auth.id, - bytes=exported_auth.bytes + id=exported_auth.id, bytes=exported_auth.bytes ) ) r = await session.invoke( raw.functions.upload.GetFile( - location=location, - offset=offset_bytes, - limit=chunk_size + location=location, offset=offset_bytes, limit=chunk_size ), - sleep_threshold=30 + sleep_threshold=30, ) if isinstance(r, raw.types.upload.File): @@ -969,7 +1075,7 @@ async def get_file( if file_size != 0 else offset_bytes, file_size, - *progress_args + *progress_args, ) if inspect.iscoroutinefunction(progress): @@ -982,17 +1088,21 @@ async def get_file( r = await session.invoke( raw.functions.upload.GetFile( - location=location, - offset=offset_bytes, - limit=chunk_size + location=location, offset=offset_bytes, limit=chunk_size ), - sleep_threshold=30 + sleep_threshold=30, ) elif isinstance(r, raw.types.upload.FileCdnRedirect): cdn_session = Session( - self, r.dc_id, await Auth(self, r.dc_id, await self.storage.test_mode()).create(), - await self.storage.test_mode(), is_media=True, is_cdn=True + self, + r.dc_id, + await Auth( + self, r.dc_id, await self.storage.test_mode() + ).create(), + await self.storage.test_mode(), + is_media=True, + is_cdn=True, ) try: @@ -1003,7 +1113,7 @@ async def get_file( raw.functions.upload.GetCdnFile( file_token=r.file_token, offset=offset_bytes, - limit=chunk_size + limit=chunk_size, ) ) @@ -1012,7 +1122,7 @@ async def get_file( await session.invoke( raw.functions.upload.ReuploadCdnFile( file_token=r.file_token, - request_token=r2.request_token + request_token=r2.request_token, ) ) except VolumeLocNotFound: @@ -1029,22 +1139,23 @@ async def get_file( bytearray( r.encryption_iv[:-4] + (offset_bytes // 16).to_bytes(4, "big") - ) + ), ) hashes = await session.invoke( raw.functions.upload.GetCdnFileHashes( - file_token=r.file_token, - offset=offset_bytes + file_token=r.file_token, offset=offset_bytes ) ) # https://core.telegram.org/cdn#verifying-files for i, h in enumerate(hashes): - cdn_chunk = decrypted_chunk[h.limit * i: h.limit * (i + 1)] + cdn_chunk = decrypted_chunk[ + h.limit * i : h.limit * (i + 1) + ] CDNFileHashMismatch.check( h.hash == sha256(cdn_chunk).digest(), - "h.hash == sha256(cdn_chunk).digest()" + "h.hash == sha256(cdn_chunk).digest()", ) yield decrypted_chunk @@ -1055,9 +1166,11 @@ async def get_file( if progress: func = functools.partial( progress, - min(offset_bytes, file_size) if file_size != 0 else offset_bytes, + min(offset_bytes, file_size) + if file_size != 0 + else offset_bytes, file_size, - *progress_args + *progress_args, ) if inspect.iscoroutinefunction(progress): diff --git a/pyrogram/connection/connection.py b/pyrogram/connection/connection.py index 45282efff..37e1cefb1 100644 --- a/pyrogram/connection/connection.py +++ b/pyrogram/connection/connection.py @@ -30,7 +30,15 @@ class Connection: MAX_CONNECTION_ATTEMPTS = 3 - def __init__(self, dc_id: int, test_mode: bool, ipv6: bool, alt_port: bool, proxy: dict, media: bool = False): + def __init__( + self, + dc_id: int, + test_mode: bool, + ipv6: bool, + alt_port: bool, + proxy: dict, + media: bool = False, + ): self.dc_id = dc_id self.test_mode = test_mode self.ipv6 = ipv6 @@ -53,11 +61,13 @@ async def connect(self): await self.protocol.close() await asyncio.sleep(1) else: - log.info("Connected! %s DC%s%s - IPv%s", - "Test" if self.test_mode else "Production", - self.dc_id, - " (media)" if self.media else "", - "6" if self.ipv6 else "4") + log.info( + "Connected! %s DC%s%s - IPv%s", + "Test" if self.test_mode else "Production", + self.dc_id, + " (media)" if self.media else "", + "6" if self.ipv6 else "4", + ) break else: log.warning("Connection failed! Trying again...") diff --git a/pyrogram/connection/transport/tcp/tcp.py b/pyrogram/connection/transport/tcp/tcp.py index 82ef033be..871fdab88 100644 --- a/pyrogram/connection/transport/tcp/tcp.py +++ b/pyrogram/connection/transport/tcp/tcp.py @@ -59,17 +59,14 @@ def __init__(self, ipv6: bool, proxy: dict): addr=hostname, port=proxy.get("port", None), username=proxy.get("username", None), - password=proxy.get("password", None) + password=proxy.get("password", None), ) self.socket.settimeout(TCP.TIMEOUT) log.info("Using proxy %s", hostname) else: - self.socket = socket.socket( - socket.AF_INET6 if ipv6 - else socket.AF_INET - ) + self.socket = socket.socket(socket.AF_INET6 if ipv6 else socket.AF_INET) self.socket.setblocking(False) @@ -79,7 +76,10 @@ async def connect(self, address: tuple): await self.loop.run_in_executor(executor, self.socket.connect, address) else: try: - await asyncio.wait_for(asyncio.get_event_loop().sock_connect(self.socket, address), TCP.TIMEOUT) + await asyncio.wait_for( + asyncio.get_event_loop().sock_connect(self.socket, address), + TCP.TIMEOUT, + ) except asyncio.TimeoutError: # Re-raise as TimeoutError. asyncio.TimeoutError is deprecated in 3.11 raise TimeoutError("Connection timed out") @@ -109,8 +109,7 @@ async def recv(self, length: int = 0): while len(data) < length: try: chunk = await asyncio.wait_for( - self.reader.read(length - len(data)), - TCP.TIMEOUT + self.reader.read(length - len(data)), TCP.TIMEOUT ) except (OSError, asyncio.TimeoutError): return None diff --git a/pyrogram/connection/transport/tcp/tcp_abridged.py b/pyrogram/connection/transport/tcp/tcp_abridged.py index 77d44cf41..61d604d5e 100644 --- a/pyrogram/connection/transport/tcp/tcp_abridged.py +++ b/pyrogram/connection/transport/tcp/tcp_abridged.py @@ -36,9 +36,11 @@ async def send(self, data: bytes, *args): length = len(data) // 4 await super().send( - (bytes([length]) - if length <= 126 - else b"\x7f" + length.to_bytes(3, "little")) + ( + bytes([length]) + if length <= 126 + else b"\x7f" + length.to_bytes(3, "little") + ) + data ) diff --git a/pyrogram/connection/transport/tcp/tcp_abridged_o.py b/pyrogram/connection/transport/tcp/tcp_abridged_o.py index 6f57ab115..e7e7e80b9 100644 --- a/pyrogram/connection/transport/tcp/tcp_abridged_o.py +++ b/pyrogram/connection/transport/tcp/tcp_abridged_o.py @@ -42,8 +42,12 @@ async def connect(self, address: tuple): while True: nonce = bytearray(os.urandom(64)) - if bytes([nonce[0]]) != b"\xef" and nonce[:4] not in self.RESERVED and nonce[4:8] != b"\x00" * 4: - nonce[56] = nonce[57] = nonce[58] = nonce[59] = 0xef + if ( + bytes([nonce[0]]) != b"\xef" + and nonce[:4] not in self.RESERVED + and nonce[4:8] != b"\x00" * 4 + ): + nonce[56] = nonce[57] = nonce[58] = nonce[59] = 0xEF break temp = bytearray(nonce[55:7:-1]) @@ -57,8 +61,12 @@ async def connect(self, address: tuple): async def send(self, data: bytes, *args): length = len(data) // 4 - data = (bytes([length]) if length <= 126 else b"\x7f" + length.to_bytes(3, "little")) + data - payload = await self.loop.run_in_executor(pyrogram.crypto_executor, aes.ctr256_encrypt, data, *self.encrypt) + data = ( + bytes([length]) if length <= 126 else b"\x7f" + length.to_bytes(3, "little") + ) + data + payload = await self.loop.run_in_executor( + pyrogram.crypto_executor, aes.ctr256_encrypt, data, *self.encrypt + ) await super().send(payload) @@ -83,4 +91,6 @@ async def recv(self, length: int = 0) -> Optional[bytes]: if data is None: return None - return await self.loop.run_in_executor(pyrogram.crypto_executor, aes.ctr256_decrypt, data, *self.decrypt) + return await self.loop.run_in_executor( + pyrogram.crypto_executor, aes.ctr256_decrypt, data, *self.decrypt + ) diff --git a/pyrogram/connection/transport/tcp/tcp_intermediate_o.py b/pyrogram/connection/transport/tcp/tcp_intermediate_o.py index 48b2d4452..ce56e3c26 100644 --- a/pyrogram/connection/transport/tcp/tcp_intermediate_o.py +++ b/pyrogram/connection/transport/tcp/tcp_intermediate_o.py @@ -42,8 +42,12 @@ async def connect(self, address: tuple): while True: nonce = bytearray(os.urandom(64)) - if bytes([nonce[0]]) != b"\xef" and nonce[:4] not in self.RESERVED and nonce[4:8] != b"\x00" * 4: - nonce[56] = nonce[57] = nonce[58] = nonce[59] = 0xee + if ( + bytes([nonce[0]]) != b"\xef" + and nonce[:4] not in self.RESERVED + and nonce[4:8] != b"\x00" * 4 + ): + nonce[56] = nonce[57] = nonce[58] = nonce[59] = 0xEE break temp = bytearray(nonce[55:7:-1]) @@ -57,10 +61,7 @@ async def connect(self, address: tuple): async def send(self, data: bytes, *args): await super().send( - aes.ctr256_encrypt( - pack(" Optional[bytes]: diff --git a/pyrogram/crypto/aes.py b/pyrogram/crypto/aes.py index 25dddaf27..2e20dbb88 100644 --- a/pyrogram/crypto/aes.py +++ b/pyrogram/crypto/aes.py @@ -25,29 +25,29 @@ log.info("Using TgCrypto") - def ige256_encrypt(data: bytes, key: bytes, iv: bytes) -> bytes: return tgcrypto.ige256_encrypt(data, key, iv) - def ige256_decrypt(data: bytes, key: bytes, iv: bytes) -> bytes: return tgcrypto.ige256_decrypt(data, key, iv) - - def ctr256_encrypt(data: bytes, key: bytes, iv: bytearray, state: bytearray = None) -> bytes: + def ctr256_encrypt( + data: bytes, key: bytes, iv: bytearray, state: bytearray = None + ) -> bytes: return tgcrypto.ctr256_encrypt(data, key, iv, state or bytearray(1)) - - def ctr256_decrypt(data: bytes, key: bytes, iv: bytearray, state: bytearray = None) -> bytes: + def ctr256_decrypt( + data: bytes, key: bytes, iv: bytearray, state: bytearray = None + ) -> bytes: return tgcrypto.ctr256_decrypt(data, key, iv, state or bytearray(1)) - def xor(a: bytes, b: bytes) -> bytes: return int.to_bytes( int.from_bytes(a, "big") ^ int.from_bytes(b, "big"), len(a), "big", ) + except ImportError: import pyaes @@ -57,23 +57,22 @@ def xor(a: bytes, b: bytes) -> bytes: "More info: https://eyMarv.github.io/pyrofork-docs/topics/speedups" ) - def ige256_encrypt(data: bytes, key: bytes, iv: bytes) -> bytes: return ige(data, key, iv, True) - def ige256_decrypt(data: bytes, key: bytes, iv: bytes) -> bytes: return ige(data, key, iv, False) - - def ctr256_encrypt(data: bytes, key: bytes, iv: bytearray, state: bytearray = None) -> bytes: + def ctr256_encrypt( + data: bytes, key: bytes, iv: bytearray, state: bytearray = None + ) -> bytes: return ctr(data, key, iv, state or bytearray(1)) - - def ctr256_decrypt(data: bytes, key: bytes, iv: bytearray, state: bytearray = None) -> bytes: + def ctr256_decrypt( + data: bytes, key: bytes, iv: bytearray, state: bytearray = None + ) -> bytes: return ctr(data, key, iv, state or bytearray(1)) - def xor(a: bytes, b: bytes) -> bytes: return int.to_bytes( int.from_bytes(a, "big") ^ int.from_bytes(b, "big"), @@ -81,14 +80,13 @@ def xor(a: bytes, b: bytes) -> bytes: "big", ) - def ige(data: bytes, key: bytes, iv: bytes, encrypt: bool) -> bytes: cipher = pyaes.AES(key) iv_1 = iv[:16] iv_2 = iv[16:] - data = [data[i: i + 16] for i in range(0, len(data), 16)] + data = [data[i : i + 16] for i in range(0, len(data), 16)] if encrypt: for i, chunk in enumerate(data): @@ -101,7 +99,6 @@ def ige(data: bytes, key: bytes, iv: bytes, encrypt: bool) -> bytes: return b"".join(data) - def ctr(data: bytes, key: bytes, iv: bytearray, state: bytearray) -> bytes: cipher = pyaes.AES(key) diff --git a/pyrogram/crypto/mtproto.py b/pyrogram/crypto/mtproto.py index 6d1521a47..5f27b48aa 100644 --- a/pyrogram/crypto/mtproto.py +++ b/pyrogram/crypto/mtproto.py @@ -29,8 +29,8 @@ def kdf(auth_key: bytes, msg_key: bytes, outgoing: bool) -> tuple: # https://core.telegram.org/mtproto/description#defining-aes-key-and-initialization-vector x = 0 if outgoing else 8 - sha256_a = sha256(msg_key + auth_key[x: x + 36]).digest() - sha256_b = sha256(auth_key[x + 40:x + 76] + msg_key).digest() # 76 = 40 + 36 + sha256_a = sha256(msg_key + auth_key[x : x + 36]).digest() + sha256_b = sha256(auth_key[x + 40 : x + 76] + msg_key).digest() # 76 = 40 + 36 aes_key = sha256_a[:8] + sha256_b[8:24] + sha256_a[24:32] aes_iv = sha256_b[:8] + sha256_a[8:24] + sha256_b[24:32] @@ -38,12 +38,14 @@ def kdf(auth_key: bytes, msg_key: bytes, outgoing: bool) -> tuple: return aes_key, aes_iv -def pack(message: Message, salt: int, session_id: bytes, auth_key: bytes, auth_key_id: bytes) -> bytes: +def pack( + message: Message, salt: int, session_id: bytes, auth_key: bytes, auth_key_id: bytes +) -> bytes: data = Long(salt) + session_id + message.write() padding = urandom(-(len(data) + 12) % 16 + 12) # 88 = 88 + 0 (outgoing message) - msg_key_large = sha256(auth_key[88: 88 + 32] + data + padding).digest() + msg_key_large = sha256(auth_key[88 : 88 + 32] + data + padding).digest() msg_key = msg_key_large[8:24] aes_key, aes_iv = kdf(auth_key, msg_key, True) @@ -51,10 +53,7 @@ def pack(message: Message, salt: int, session_id: bytes, auth_key: bytes, auth_k def unpack( - b: BytesIO, - session_id: bytes, - auth_key: bytes, - auth_key_id: bytes + b: BytesIO, session_id: bytes, auth_key: bytes, auth_key_id: bytes ) -> Message: SecurityCheckMismatch.check(b.read(8) == auth_key_id, "b.read(8) == auth_key_id") @@ -64,34 +63,44 @@ def unpack( data.read(8) # Salt # https://core.telegram.org/mtproto/security_guidelines#checking-session-id - SecurityCheckMismatch.check(data.read(8) == session_id, "data.read(8) == session_id") + SecurityCheckMismatch.check( + data.read(8) == session_id, "data.read(8) == session_id" + ) try: message = Message.read(data) except KeyError as e: if e.args[0] == 0: - raise ConnectionError(f"Received empty data. Check your internet connection.") + raise ConnectionError( + f"Received empty data. Check your internet connection." + ) left = data.read().hex() - left = [left[i:i + 64] for i in range(0, len(left), 64)] - left = [[left[i:i + 8] for i in range(0, len(left), 8)] for left in left] + left = [left[i : i + 64] for i in range(0, len(left), 64)] + left = [[left[i : i + 8] for i in range(0, len(left), 8)] for left in left] left = "\n".join(" ".join(x for x in left) for left in left) - raise ValueError(f"The server sent an unknown constructor: {hex(e.args[0])}\n{left}") + raise ValueError( + f"The server sent an unknown constructor: {hex(e.args[0])}\n{left}" + ) # https://core.telegram.org/mtproto/security_guidelines#checking-sha256-hash-value-of-msg-key # 96 = 88 + 8 (incoming message) SecurityCheckMismatch.check( - msg_key == sha256(auth_key[96:96 + 32] + data.getvalue()).digest()[8:24], - "msg_key == sha256(auth_key[96:96 + 32] + data.getvalue()).digest()[8:24]" + msg_key == sha256(auth_key[96 : 96 + 32] + data.getvalue()).digest()[8:24], + "msg_key == sha256(auth_key[96:96 + 32] + data.getvalue()).digest()[8:24]", ) # https://core.telegram.org/mtproto/security_guidelines#checking-message-length - data.seek(32) # Get to the payload, skip salt (8) + session_id (8) + msg_id (8) + seq_no (4) + length (4) + data.seek( + 32 + ) # Get to the payload, skip salt (8) + session_id (8) + msg_id (8) + seq_no (4) + length (4) payload = data.read() - padding = payload[message.length:] - SecurityCheckMismatch.check(12 <= len(padding) <= 1024, "12 <= len(padding) <= 1024") + padding = payload[message.length :] + SecurityCheckMismatch.check( + 12 <= len(padding) <= 1024, "12 <= len(padding) <= 1024" + ) SecurityCheckMismatch.check(len(payload) % 4 == 0, "len(payload) % 4 == 0") # https://core.telegram.org/mtproto/security_guidelines#checking-msg-id diff --git a/pyrogram/crypto/prime.py b/pyrogram/crypto/prime.py index e919e22ce..c428c5882 100644 --- a/pyrogram/crypto/prime.py +++ b/pyrogram/crypto/prime.py @@ -27,7 +27,7 @@ "FD17ED950D5965B4B9DD46582DB1178D169C6BC465B0D6FF9CA3928FEF5B9AE4" "E418FC15E83EBEA0F87FA9FF5EED70050DED2849F47BF959D956850CE929851F" "0D8115F635B105EE2E4E15D04B2454BF6F4FADF034B10403119CD8E3B92FCC5B", - 16 + 16, ) @@ -35,6 +35,7 @@ # def gcd(cls, a: int, b: int) -> int: # return cls.gcd(b, a % b) if b else a + def gcd(a: int, b: int) -> int: while b: a, b = b, a % b diff --git a/pyrogram/crypto/rsa.py b/pyrogram/crypto/rsa.py index 25c232295..6c14910c1 100644 --- a/pyrogram/crypto/rsa.py +++ b/pyrogram/crypto/rsa.py @@ -30,7 +30,8 @@ server_public_keys = { # -4344800451088585951 - 0xc3b42b026ce86b21 - (1 << 64): PublicKey( # Telegram servers #1 + 0xC3B42B026CE86B21 + - (1 << 64): PublicKey( # Telegram servers #1 # -----BEGIN RSA PUBLIC KEY----- # MIIBCgKCAQEAwVACPi9w23mF3tBkdZz+zwrzKOaaQdr01vAbU4E1pvkfj4sqDsm6 # lyDONS789sVoD/xCS9Y0hkkC3gtL1tSfTlgCMOOul9lcixlEKzwKENj1Yz/s7daS @@ -48,13 +49,13 @@ "81104A305B6DD27665722C46B60E5DF680FB16B210607EF217652E60236C255F" "6A28315F4083A96791D7214BF64C1DF4FD0DB1944FB26A2A57031B32EEE64AD1" "5A8BA68885CDE74A5BFC920F6ABF59BA5C75506373E7130F9042DA922179251F", - 16 + 16, ), # Modulus - int("010001", 16) # Exponent + int("010001", 16), # Exponent ), - # 847625836280919973 - 0x10bc35f3509f7b7a5 - (1 << 64): PublicKey( # Telegram servers #2 + 0x10BC35F3509F7B7A5 + - (1 << 64): PublicKey( # Telegram servers #2 # -----BEGIN PUBLIC KEY----- # MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAruw2yP/BCcsJliRoW5eB # VBVle9dtjJw+OYED160Wybum9SXtBBLXriwt4rROd9csv0t0OHCaTmRqBcQ0J8fx @@ -73,13 +74,13 @@ "30B2E52ACA78BA023CF6CE806B1DC49C72CF928A7199D22E3D7AC84E47BC9427" "D0236945D10DBD15177BAB413FBF0EDFDA09F014C7A7DA088DDE9759702CA760" "AF2B8E4E97CC055C617BD74C3D97008635B98DC4D621B4891DA9FB0473047927", - 16 + 16, ), # Modulus - int("010001", 16) # Exponent + int("010001", 16), # Exponent ), - # 1562291298945373506 - 0x115ae5fa8b5529542 - (1 << 64): PublicKey( # Telegram servers #3 + 0x115AE5FA8B5529542 + - (1 << 64): PublicKey( # Telegram servers #3 # -----BEGIN PUBLIC KEY----- # MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvfLHfYH2r9R70w8prHbl # Wt/nDkh+XkgpflqQVcnAfSuTtO05lNPspQmL8Y2XjVT4t8cT6xAkdgfmmvnvRPOO @@ -98,13 +99,13 @@ "259D18AF806638012DA0CA4A70BAA83D9C158F3552BC9158E69BF332A45809E1" "C36905A5CAA12348DD57941A482131BE7B2355A5F4635374F3BD3DDF5FF925BF" "4809EE27C1E67D9120C5FE08A9DE458B1B4A3C5D0A428437F2BECA81F4E2D5FF", - 16 + 16, ), # Modulus - int("010001", 16) # Exponent + int("010001", 16), # Exponent ), - # -5859577972006586033 - 0xaeae98e13cd7f94f - (1 << 64): PublicKey( # Telegram servers #4 + 0xAEAE98E13CD7F94F + - (1 << 64): PublicKey( # Telegram servers #4 # -----BEGIN PUBLIC KEY----- # MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs/ditzm+mPND6xkhzwFI # z6J/968CtkcSE/7Z2qAJiXbmZ3UDJPGrzqTDHkO30R8VeRM/Kz2f4nR05GIFiITl @@ -123,13 +124,13 @@ "4D315B5E21B5C26B46BABE3D75D06D1CD33329EC782A0F22891ED1DB42A1D6C0" "DEA431428BC4D7AABDCF3E0EB6FDA4E23EB7733E7727E9A1915580796C55188D" "2596D2665AD1182BA7ABF15AAA5A8B779EA996317A20AE044B820BFF35B6E8A1", - 16 + 16, ), # Modulus - int("010001", 16) # Exponent + int("010001", 16), # Exponent ), - # 6491968696586960280 - 0x15a181b2235057d98 - (1 << 64): PublicKey( # Telegram servers #5 + 0x15A181B2235057D98 + - (1 << 64): PublicKey( # Telegram servers #5 # -----BEGIN PUBLIC KEY----- # MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvmpxVY7ld/8DAjz6F6q0 # 5shjg8/4p6047bn6/m8yPy1RBsvIyvuDuGnP/RzPEhzXQ9UJ5Ynmh2XJZgHoE9xb @@ -148,13 +149,13 @@ "6DE94F5DC0A7ABEE0BE990B893F2887BD2C6310A1E0A9E3E38BD34FDED254150" "8DC102A9C9B4C95EFFD9DD2DFE96C29BE647D6C69D66CA500843CFAED6E44019" "6F1DBE0E2E22163C61CA48C79116FA77216726749A976A1C4B0944B5121E8C01", - 16 + 16, ), # Modulus - int("010001", 16) # Exponent + int("010001", 16), # Exponent ), - # -7395192255793472640 - 0x995effd323b5db80 - (1 << 64): PublicKey( # CDN DC-121 + 0x995EFFD323B5DB80 + - (1 << 64): PublicKey( # CDN DC-121 # -----BEGIN RSA PUBLIC KEY----- # MIIBCgKCAQEA4tWHcGJlElkxuxKQJwFjJaulmVHgdxNA3wgI2E8XbNnA88y51Xog # V5m8BEYuTSP4llXZY4ZSJW5VlFXnmsJT/hmjyeFqqTajyAW6nb9vwZX291QvqD/1 @@ -172,13 +173,13 @@ "5101D4C0D7D7F8C857521011B2EF7411F8BEC55354475628797339C1734FDA97" "FE0F1789B08F8872C9BEA41BF215626EFB3D35A00DC8295C044B7798EB9C1B5F" "F8E8B8A591CFCA7789E509CA219348C81CDA7CB32994CCD5913D41A64ECDD23F", - 16 + 16, ), # Modulus - int("010001", 16) # Exponent + int("010001", 16), # Exponent ), - # 2685959930972952888 - 0x1254672538e935938 - (1 << 64): PublicKey( # CDN DC-140 + 0x1254672538E935938 + - (1 << 64): PublicKey( # CDN DC-140 # -----BEGIN RSA PUBLIC KEY----- # MIIBCgKCAQEAzuHVC7sE50Kho/yDVZtWnlmA5Bf/aM8KZY3WzS16w6w1sBqipj8o # gMGG7ULbGBtYmKEaI7IIJO6WM2m1MaXVnsqS8d7PaGAZiy8rSN3S7S2a8wp4RXZe @@ -196,13 +197,13 @@ "A067E9C079172CCCECC09C2B16C428EC776373149DB66AAB9A4DEBF7916B391E" "832AE5A7892E27DE0AB1B4451C55F90F1F2ECE3ACEF708BC2C5EE022066EE434" "4C7268D724AABAAC667667D727AC3F2956ED4BDAF7089DDE0AEB18A6652DA16F", - 16 + 16, ), # Modulus - int("010001", 16) # Exponent + int("010001", 16), # Exponent ), - # -3997872768018684475 - 0xc884b3e62d09e5c5 - (1 << 64): PublicKey( # CDN DC-201 + 0xC884B3E62D09E5C5 + - (1 << 64): PublicKey( # CDN DC-201 # -----BEGIN RSA PUBLIC KEY----- # MIIBCgKCAQEAug6fETVb7NkXYYu5ueZuM0pqw1heuqUrZNYomQN0lS0o7i6mAWwb # 1/FiscFK+y4LQSSEx+oUzXAhjmll9fmb4e7PbUiXo8MuXO0Rj3e5416DXfTiOYGW @@ -220,13 +221,13 @@ "AB859AF141851B0953E2CD436F9BB131F069F49F7D56256766E824E6E5BEA6D1" "59EE39DC2CECB1A496CB0197390996BD56C47BB17CAB5922FECED2F01C585AB8" "522C9E9BB2EF556569C81C3F6F077E1017C20004F444F779A108E1C1A89C5205", - 16 + 16, ), # Modulus - int("010001", 16) # Exponent + int("010001", 16), # Exponent ), - # -4960899639492471258 - 0xbb27580fd5b01626 - (1 << 64): PublicKey( # CDN DC-203 + 0xBB27580FD5B01626 + - (1 << 64): PublicKey( # CDN DC-203 # -----BEGIN RSA PUBLIC KEY----- # MIIBCgKCAQEAv/L6td+mj7Dl81NHfu+Xf1KNtvZPR1tS5xFqkiUson1u7D2ulK05 # jM8HKvpV1o+1HPPqhaXhasvsX90u3TIHRQ0zuJKJxKAiZo3GK7phHozjAJ9VUFbO @@ -244,10 +245,10 @@ "9C01079CAA4929B8198B56591EBB52322C5C177BED34697E82C6A5F39D507C41" "CF86528FC0FBEA6D73969203E49DA917A6C7E3E642CF4494A6FDE3EDB13C5859" "6F80C7F010F870C4C62275119ACAAF5894B9587780FE628AB453A8D2DCC59345", - 16 + 16, ), # Modulus - int("010001", 16) # Exponent - ) + int("010001", 16), # Exponent + ), } @@ -255,5 +256,5 @@ def encrypt(data: bytes, fingerprint: int) -> bytes: return pow( int.from_bytes(data, "big"), server_public_keys[fingerprint].e, - server_public_keys[fingerprint].m + server_public_keys[fingerprint].m, ).to_bytes(256, "big") diff --git a/pyrogram/dispatcher.py b/pyrogram/dispatcher.py index 701e5fcb2..b3441b0b1 100644 --- a/pyrogram/dispatcher.py +++ b/pyrogram/dispatcher.py @@ -25,25 +25,53 @@ import pyrogram from pyrogram import utils from pyrogram.handlers import ( - CallbackQueryHandler, MessageHandler, EditedMessageHandler, DeletedMessagesHandler, MessageReactionUpdatedHandler, MessageReactionCountUpdatedHandler, UserStatusHandler, RawUpdateHandler, InlineQueryHandler, PollHandler, ConversationHandler, ChosenInlineResultHandler, ChatMemberUpdatedHandler, ChatJoinRequestHandler, StoryHandler + CallbackQueryHandler, + MessageHandler, + EditedMessageHandler, + DeletedMessagesHandler, + MessageReactionUpdatedHandler, + MessageReactionCountUpdatedHandler, + UserStatusHandler, + RawUpdateHandler, + InlineQueryHandler, + PollHandler, + ConversationHandler, + ChosenInlineResultHandler, + ChatMemberUpdatedHandler, + ChatJoinRequestHandler, + StoryHandler, ) from pyrogram.raw.types import ( - UpdateNewMessage, UpdateNewChannelMessage, UpdateNewScheduledMessage, - UpdateEditMessage, UpdateEditChannelMessage, - UpdateDeleteMessages, UpdateDeleteChannelMessages, - UpdateBotCallbackQuery, UpdateInlineBotCallbackQuery, - UpdateUserStatus, UpdateBotInlineQuery, UpdateMessagePoll, - UpdateBotInlineSend, UpdateChatParticipant, UpdateChannelParticipant, - UpdateBotChatInviteRequester, UpdateStory, + UpdateNewMessage, + UpdateNewChannelMessage, + UpdateNewScheduledMessage, + UpdateEditMessage, + UpdateEditChannelMessage, + UpdateDeleteMessages, + UpdateDeleteChannelMessages, + UpdateBotCallbackQuery, + UpdateInlineBotCallbackQuery, + UpdateUserStatus, + UpdateBotInlineQuery, + UpdateMessagePoll, + UpdateBotInlineSend, + UpdateChatParticipant, + UpdateChannelParticipant, + UpdateBotChatInviteRequester, + UpdateStory, UpdateBotMessageReaction, - UpdateBotMessageReactions + UpdateBotMessageReactions, ) log = logging.getLogger(__name__) class Dispatcher: - NEW_MESSAGE_UPDATES = (UpdateNewMessage, UpdateNewChannelMessage, UpdateNewScheduledMessage) + NEW_MESSAGE_UPDATES = ( + UpdateNewMessage, + UpdateNewChannelMessage, + UpdateNewScheduledMessage, + ) EDIT_MESSAGE_UPDATES = (UpdateEditMessage, UpdateEditChannelMessage) DELETE_MESSAGES_UPDATES = (UpdateDeleteMessages, UpdateDeleteChannelMessages) CALLBACK_QUERY_UPDATES = (UpdateBotCallbackQuery, UpdateInlineBotCallbackQuery) @@ -72,84 +100,93 @@ def __init__(self, client: "pyrogram.Client"): async def message_parser(update, users, chats): return ( - await pyrogram.types.Message._parse(self.client, update.message, users, chats, - is_scheduled=isinstance(update, UpdateNewScheduledMessage)), - MessageHandler + await pyrogram.types.Message._parse( + self.client, + update.message, + users, + chats, + is_scheduled=isinstance(update, UpdateNewScheduledMessage), + ), + MessageHandler, ) async def edited_message_parser(update, users, chats): # Edited messages are parsed the same way as new messages, but the handler is different parsed, _ = await message_parser(update, users, chats) - return ( - parsed, - EditedMessageHandler - ) + return (parsed, EditedMessageHandler) async def deleted_messages_parser(update, users, chats): return ( utils.parse_deleted_messages(self.client, update), - DeletedMessagesHandler + DeletedMessagesHandler, ) async def callback_query_parser(update, users, chats): return ( await pyrogram.types.CallbackQuery._parse(self.client, update, users), - CallbackQueryHandler + CallbackQueryHandler, ) async def user_status_parser(update, users, chats): return ( pyrogram.types.User._parse_user_status(self.client, update), - UserStatusHandler + UserStatusHandler, ) async def inline_query_parser(update, users, chats): return ( pyrogram.types.InlineQuery._parse(self.client, update, users), - InlineQueryHandler + InlineQueryHandler, ) async def poll_parser(update, users, chats): - return ( - pyrogram.types.Poll._parse_update(self.client, update), - PollHandler - ) + return (pyrogram.types.Poll._parse_update(self.client, update), PollHandler) async def chosen_inline_result_parser(update, users, chats): return ( pyrogram.types.ChosenInlineResult._parse(self.client, update, users), - ChosenInlineResultHandler + ChosenInlineResultHandler, ) async def chat_member_updated_parser(update, users, chats): return ( - pyrogram.types.ChatMemberUpdated._parse(self.client, update, users, chats), - ChatMemberUpdatedHandler + pyrogram.types.ChatMemberUpdated._parse( + self.client, update, users, chats + ), + ChatMemberUpdatedHandler, ) async def chat_join_request_parser(update, users, chats): return ( - pyrogram.types.ChatJoinRequest._parse(self.client, update, users, chats), - ChatJoinRequestHandler + pyrogram.types.ChatJoinRequest._parse( + self.client, update, users, chats + ), + ChatJoinRequestHandler, ) async def story_parser(update, users, chats): return ( - await pyrogram.types.Story._parse(self.client, update.story, update.peer), - StoryHandler + await pyrogram.types.Story._parse( + self.client, update.story, update.peer + ), + StoryHandler, ) - + async def message_bot_na_reaction_parser(update, users, chats): return ( - pyrogram.types.MessageReactionUpdated._parse(self.client, update, users, chats), - MessageReactionUpdatedHandler + pyrogram.types.MessageReactionUpdated._parse( + self.client, update, users, chats + ), + MessageReactionUpdatedHandler, ) async def message_bot_a_reaction_parser(update, users, chats): return ( - pyrogram.types.MessageReactionCountUpdated._parse(self.client, update, users, chats), - MessageReactionCountUpdatedHandler + pyrogram.types.MessageReactionCountUpdated._parse( + self.client, update, users, chats + ), + MessageReactionCountUpdatedHandler, ) self.update_parsers = { @@ -165,10 +202,14 @@ async def message_bot_a_reaction_parser(update, users, chats): Dispatcher.CHAT_JOIN_REQUEST_UPDATES: chat_join_request_parser, Dispatcher.NEW_STORY_UPDATES: story_parser, Dispatcher.MESSAGE_BOT_NA_REACTION_UPDATES: message_bot_na_reaction_parser, - Dispatcher.MESSAGE_BOT_A_REACTION_UPDATES: message_bot_a_reaction_parser + Dispatcher.MESSAGE_BOT_A_REACTION_UPDATES: message_bot_a_reaction_parser, } - self.update_parsers = {key: value for key_tuple, value in self.update_parsers.items() for key in key_tuple} + self.update_parsers = { + key: value + for key_tuple, value in self.update_parsers.items() + for key in key_tuple + } async def start(self): if not self.client.no_updates: @@ -218,7 +259,9 @@ async def fn(): try: if group not in self.groups: - raise ValueError(f"Group {group} does not exist. Handler was not removed.") + raise ValueError( + f"Group {group} does not exist. Handler was not removed." + ) self.groups[group].remove(handler) finally: @@ -271,7 +314,7 @@ async def handler_worker(self, lock): self.client.executor, handler.callback, self.client, - *args + *args, ) except pyrogram.StopPropagation: raise diff --git a/pyrogram/emoji.py b/pyrogram/emoji.py index d135faf74..f929add3a 100644 --- a/pyrogram/emoji.py +++ b/pyrogram/emoji.py @@ -401,26 +401,66 @@ HANDSHAKE_MEDIUM_SKIN_TONE = "\U0001f91d\U0001f3fd" HANDSHAKE_MEDIUM_DARK_SKIN_TONE = "\U0001f91d\U0001f3fe" HANDSHAKE_DARK_SKIN_TONE = "\U0001f91d\U0001f3ff" -HANDSHAKE_LIGHT_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = "\U0001faf1\U0001f3fb\u200d\U0001faf2\U0001f3fc" -HANDSHAKE_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = "\U0001faf1\U0001f3fb\u200d\U0001faf2\U0001f3fd" -HANDSHAKE_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = "\U0001faf1\U0001f3fb\u200d\U0001faf2\U0001f3fe" -HANDSHAKE_LIGHT_SKIN_TONE_DARK_SKIN_TONE = "\U0001faf1\U0001f3fb\u200d\U0001faf2\U0001f3ff" -HANDSHAKE_MEDIUM_LIGHT_SKIN_TONE_LIGHT_SKIN_TONE = "\U0001faf1\U0001f3fc\u200d\U0001faf2\U0001f3fb" -HANDSHAKE_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = "\U0001faf1\U0001f3fc\u200d\U0001faf2\U0001f3fd" -HANDSHAKE_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = "\U0001faf1\U0001f3fc\u200d\U0001faf2\U0001f3fe" -HANDSHAKE_MEDIUM_LIGHT_SKIN_TONE_DARK_SKIN_TONE = "\U0001faf1\U0001f3fc\u200d\U0001faf2\U0001f3ff" -HANDSHAKE_MEDIUM_SKIN_TONE_LIGHT_SKIN_TONE = "\U0001faf1\U0001f3fd\u200d\U0001faf2\U0001f3fb" -HANDSHAKE_MEDIUM_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = "\U0001faf1\U0001f3fd\u200d\U0001faf2\U0001f3fc" -HANDSHAKE_MEDIUM_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = "\U0001faf1\U0001f3fd\u200d\U0001faf2\U0001f3fe" -HANDSHAKE_MEDIUM_SKIN_TONE_DARK_SKIN_TONE = "\U0001faf1\U0001f3fd\u200d\U0001faf2\U0001f3ff" -HANDSHAKE_MEDIUM_DARK_SKIN_TONE_LIGHT_SKIN_TONE = "\U0001faf1\U0001f3fe\u200d\U0001faf2\U0001f3fb" -HANDSHAKE_MEDIUM_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = "\U0001faf1\U0001f3fe\u200d\U0001faf2\U0001f3fc" -HANDSHAKE_MEDIUM_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = "\U0001faf1\U0001f3fe\u200d\U0001faf2\U0001f3fd" -HANDSHAKE_MEDIUM_DARK_SKIN_TONE_DARK_SKIN_TONE = "\U0001faf1\U0001f3fe\u200d\U0001faf2\U0001f3ff" -HANDSHAKE_DARK_SKIN_TONE_LIGHT_SKIN_TONE = "\U0001faf1\U0001f3ff\u200d\U0001faf2\U0001f3fb" -HANDSHAKE_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = "\U0001faf1\U0001f3ff\u200d\U0001faf2\U0001f3fc" -HANDSHAKE_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = "\U0001faf1\U0001f3ff\u200d\U0001faf2\U0001f3fd" -HANDSHAKE_DARK_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = "\U0001faf1\U0001f3ff\u200d\U0001faf2\U0001f3fe" +HANDSHAKE_LIGHT_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( + "\U0001faf1\U0001f3fb\u200d\U0001faf2\U0001f3fc" +) +HANDSHAKE_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = ( + "\U0001faf1\U0001f3fb\u200d\U0001faf2\U0001f3fd" +) +HANDSHAKE_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( + "\U0001faf1\U0001f3fb\u200d\U0001faf2\U0001f3fe" +) +HANDSHAKE_LIGHT_SKIN_TONE_DARK_SKIN_TONE = ( + "\U0001faf1\U0001f3fb\u200d\U0001faf2\U0001f3ff" +) +HANDSHAKE_MEDIUM_LIGHT_SKIN_TONE_LIGHT_SKIN_TONE = ( + "\U0001faf1\U0001f3fc\u200d\U0001faf2\U0001f3fb" +) +HANDSHAKE_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = ( + "\U0001faf1\U0001f3fc\u200d\U0001faf2\U0001f3fd" +) +HANDSHAKE_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( + "\U0001faf1\U0001f3fc\u200d\U0001faf2\U0001f3fe" +) +HANDSHAKE_MEDIUM_LIGHT_SKIN_TONE_DARK_SKIN_TONE = ( + "\U0001faf1\U0001f3fc\u200d\U0001faf2\U0001f3ff" +) +HANDSHAKE_MEDIUM_SKIN_TONE_LIGHT_SKIN_TONE = ( + "\U0001faf1\U0001f3fd\u200d\U0001faf2\U0001f3fb" +) +HANDSHAKE_MEDIUM_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( + "\U0001faf1\U0001f3fd\u200d\U0001faf2\U0001f3fc" +) +HANDSHAKE_MEDIUM_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( + "\U0001faf1\U0001f3fd\u200d\U0001faf2\U0001f3fe" +) +HANDSHAKE_MEDIUM_SKIN_TONE_DARK_SKIN_TONE = ( + "\U0001faf1\U0001f3fd\u200d\U0001faf2\U0001f3ff" +) +HANDSHAKE_MEDIUM_DARK_SKIN_TONE_LIGHT_SKIN_TONE = ( + "\U0001faf1\U0001f3fe\u200d\U0001faf2\U0001f3fb" +) +HANDSHAKE_MEDIUM_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( + "\U0001faf1\U0001f3fe\u200d\U0001faf2\U0001f3fc" +) +HANDSHAKE_MEDIUM_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = ( + "\U0001faf1\U0001f3fe\u200d\U0001faf2\U0001f3fd" +) +HANDSHAKE_MEDIUM_DARK_SKIN_TONE_DARK_SKIN_TONE = ( + "\U0001faf1\U0001f3fe\u200d\U0001faf2\U0001f3ff" +) +HANDSHAKE_DARK_SKIN_TONE_LIGHT_SKIN_TONE = ( + "\U0001faf1\U0001f3ff\u200d\U0001faf2\U0001f3fb" +) +HANDSHAKE_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( + "\U0001faf1\U0001f3ff\u200d\U0001faf2\U0001f3fc" +) +HANDSHAKE_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = ( + "\U0001faf1\U0001f3ff\u200d\U0001faf2\U0001f3fd" +) +HANDSHAKE_DARK_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( + "\U0001faf1\U0001f3ff\u200d\U0001faf2\U0001f3fe" +) FOLDED_HANDS = "\U0001f64f" FOLDED_HANDS_LIGHT_SKIN_TONE = "\U0001f64f\U0001f3fb" FOLDED_HANDS_MEDIUM_LIGHT_SKIN_TONE = "\U0001f64f\U0001f3fc" @@ -1197,15 +1237,21 @@ CONSTRUCTION_WORKER_DARK_SKIN_TONE = "\U0001f477\U0001f3ff" MAN_CONSTRUCTION_WORKER = "\U0001f477\u200d\u2642\ufe0f" MAN_CONSTRUCTION_WORKER_LIGHT_SKIN_TONE = "\U0001f477\U0001f3fb\u200d\u2642\ufe0f" -MAN_CONSTRUCTION_WORKER_MEDIUM_LIGHT_SKIN_TONE = "\U0001f477\U0001f3fc\u200d\u2642\ufe0f" +MAN_CONSTRUCTION_WORKER_MEDIUM_LIGHT_SKIN_TONE = ( + "\U0001f477\U0001f3fc\u200d\u2642\ufe0f" +) MAN_CONSTRUCTION_WORKER_MEDIUM_SKIN_TONE = "\U0001f477\U0001f3fd\u200d\u2642\ufe0f" MAN_CONSTRUCTION_WORKER_MEDIUM_DARK_SKIN_TONE = "\U0001f477\U0001f3fe\u200d\u2642\ufe0f" MAN_CONSTRUCTION_WORKER_DARK_SKIN_TONE = "\U0001f477\U0001f3ff\u200d\u2642\ufe0f" WOMAN_CONSTRUCTION_WORKER = "\U0001f477\u200d\u2640\ufe0f" WOMAN_CONSTRUCTION_WORKER_LIGHT_SKIN_TONE = "\U0001f477\U0001f3fb\u200d\u2640\ufe0f" -WOMAN_CONSTRUCTION_WORKER_MEDIUM_LIGHT_SKIN_TONE = "\U0001f477\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_CONSTRUCTION_WORKER_MEDIUM_LIGHT_SKIN_TONE = ( + "\U0001f477\U0001f3fc\u200d\u2640\ufe0f" +) WOMAN_CONSTRUCTION_WORKER_MEDIUM_SKIN_TONE = "\U0001f477\U0001f3fd\u200d\u2640\ufe0f" -WOMAN_CONSTRUCTION_WORKER_MEDIUM_DARK_SKIN_TONE = "\U0001f477\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_CONSTRUCTION_WORKER_MEDIUM_DARK_SKIN_TONE = ( + "\U0001f477\U0001f3fe\u200d\u2640\ufe0f" +) WOMAN_CONSTRUCTION_WORKER_DARK_SKIN_TONE = "\U0001f477\U0001f3ff\u200d\u2640\ufe0f" PERSON_WITH_CROWN = "\U0001fac5" PERSON_WITH_CROWN_LIGHT_SKIN_TONE = "\U0001fac5\U0001f3fb" @@ -1600,27 +1646,43 @@ WOMAN_WITH_WHITE_CANE_DARK_SKIN_TONE = "\U0001f469\U0001f3ff\u200d\U0001f9af" PERSON_IN_MOTORIZED_WHEELCHAIR = "\U0001f9d1\u200d\U0001f9bc" PERSON_IN_MOTORIZED_WHEELCHAIR_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fb\u200d\U0001f9bc" -PERSON_IN_MOTORIZED_WHEELCHAIR_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fc\u200d\U0001f9bc" +PERSON_IN_MOTORIZED_WHEELCHAIR_MEDIUM_LIGHT_SKIN_TONE = ( + "\U0001f9d1\U0001f3fc\u200d\U0001f9bc" +) PERSON_IN_MOTORIZED_WHEELCHAIR_MEDIUM_SKIN_TONE = "\U0001f9d1\U0001f3fd\u200d\U0001f9bc" -PERSON_IN_MOTORIZED_WHEELCHAIR_MEDIUM_DARK_SKIN_TONE = "\U0001f9d1\U0001f3fe\u200d\U0001f9bc" +PERSON_IN_MOTORIZED_WHEELCHAIR_MEDIUM_DARK_SKIN_TONE = ( + "\U0001f9d1\U0001f3fe\u200d\U0001f9bc" +) PERSON_IN_MOTORIZED_WHEELCHAIR_DARK_SKIN_TONE = "\U0001f9d1\U0001f3ff\u200d\U0001f9bc" MAN_IN_MOTORIZED_WHEELCHAIR = "\U0001f468\u200d\U0001f9bc" MAN_IN_MOTORIZED_WHEELCHAIR_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fb\u200d\U0001f9bc" -MAN_IN_MOTORIZED_WHEELCHAIR_MEDIUM_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fc\u200d\U0001f9bc" +MAN_IN_MOTORIZED_WHEELCHAIR_MEDIUM_LIGHT_SKIN_TONE = ( + "\U0001f468\U0001f3fc\u200d\U0001f9bc" +) MAN_IN_MOTORIZED_WHEELCHAIR_MEDIUM_SKIN_TONE = "\U0001f468\U0001f3fd\u200d\U0001f9bc" -MAN_IN_MOTORIZED_WHEELCHAIR_MEDIUM_DARK_SKIN_TONE = "\U0001f468\U0001f3fe\u200d\U0001f9bc" +MAN_IN_MOTORIZED_WHEELCHAIR_MEDIUM_DARK_SKIN_TONE = ( + "\U0001f468\U0001f3fe\u200d\U0001f9bc" +) MAN_IN_MOTORIZED_WHEELCHAIR_DARK_SKIN_TONE = "\U0001f468\U0001f3ff\u200d\U0001f9bc" WOMAN_IN_MOTORIZED_WHEELCHAIR = "\U0001f469\u200d\U0001f9bc" WOMAN_IN_MOTORIZED_WHEELCHAIR_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fb\u200d\U0001f9bc" -WOMAN_IN_MOTORIZED_WHEELCHAIR_MEDIUM_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fc\u200d\U0001f9bc" +WOMAN_IN_MOTORIZED_WHEELCHAIR_MEDIUM_LIGHT_SKIN_TONE = ( + "\U0001f469\U0001f3fc\u200d\U0001f9bc" +) WOMAN_IN_MOTORIZED_WHEELCHAIR_MEDIUM_SKIN_TONE = "\U0001f469\U0001f3fd\u200d\U0001f9bc" -WOMAN_IN_MOTORIZED_WHEELCHAIR_MEDIUM_DARK_SKIN_TONE = "\U0001f469\U0001f3fe\u200d\U0001f9bc" +WOMAN_IN_MOTORIZED_WHEELCHAIR_MEDIUM_DARK_SKIN_TONE = ( + "\U0001f469\U0001f3fe\u200d\U0001f9bc" +) WOMAN_IN_MOTORIZED_WHEELCHAIR_DARK_SKIN_TONE = "\U0001f469\U0001f3ff\u200d\U0001f9bc" PERSON_IN_MANUAL_WHEELCHAIR = "\U0001f9d1\u200d\U0001f9bd" PERSON_IN_MANUAL_WHEELCHAIR_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fb\u200d\U0001f9bd" -PERSON_IN_MANUAL_WHEELCHAIR_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fc\u200d\U0001f9bd" +PERSON_IN_MANUAL_WHEELCHAIR_MEDIUM_LIGHT_SKIN_TONE = ( + "\U0001f9d1\U0001f3fc\u200d\U0001f9bd" +) PERSON_IN_MANUAL_WHEELCHAIR_MEDIUM_SKIN_TONE = "\U0001f9d1\U0001f3fd\u200d\U0001f9bd" -PERSON_IN_MANUAL_WHEELCHAIR_MEDIUM_DARK_SKIN_TONE = "\U0001f9d1\U0001f3fe\u200d\U0001f9bd" +PERSON_IN_MANUAL_WHEELCHAIR_MEDIUM_DARK_SKIN_TONE = ( + "\U0001f9d1\U0001f3fe\u200d\U0001f9bd" +) PERSON_IN_MANUAL_WHEELCHAIR_DARK_SKIN_TONE = "\U0001f9d1\U0001f3ff\u200d\U0001f9bd" MAN_IN_MANUAL_WHEELCHAIR = "\U0001f468\u200d\U0001f9bd" MAN_IN_MANUAL_WHEELCHAIR_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fb\u200d\U0001f9bd" @@ -1630,9 +1692,13 @@ MAN_IN_MANUAL_WHEELCHAIR_DARK_SKIN_TONE = "\U0001f468\U0001f3ff\u200d\U0001f9bd" WOMAN_IN_MANUAL_WHEELCHAIR = "\U0001f469\u200d\U0001f9bd" WOMAN_IN_MANUAL_WHEELCHAIR_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fb\u200d\U0001f9bd" -WOMAN_IN_MANUAL_WHEELCHAIR_MEDIUM_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fc\u200d\U0001f9bd" +WOMAN_IN_MANUAL_WHEELCHAIR_MEDIUM_LIGHT_SKIN_TONE = ( + "\U0001f469\U0001f3fc\u200d\U0001f9bd" +) WOMAN_IN_MANUAL_WHEELCHAIR_MEDIUM_SKIN_TONE = "\U0001f469\U0001f3fd\u200d\U0001f9bd" -WOMAN_IN_MANUAL_WHEELCHAIR_MEDIUM_DARK_SKIN_TONE = "\U0001f469\U0001f3fe\u200d\U0001f9bd" +WOMAN_IN_MANUAL_WHEELCHAIR_MEDIUM_DARK_SKIN_TONE = ( + "\U0001f469\U0001f3fe\u200d\U0001f9bd" +) WOMAN_IN_MANUAL_WHEELCHAIR_DARK_SKIN_TONE = "\U0001f469\U0001f3ff\u200d\U0001f9bd" PERSON_RUNNING = "\U0001f3c3" PERSON_RUNNING_LIGHT_SKIN_TONE = "\U0001f3c3\U0001f3fb" @@ -1902,9 +1968,13 @@ MAN_PLAYING_WATER_POLO_DARK_SKIN_TONE = "\U0001f93d\U0001f3ff\u200d\u2642\ufe0f" WOMAN_PLAYING_WATER_POLO = "\U0001f93d\u200d\u2640\ufe0f" WOMAN_PLAYING_WATER_POLO_LIGHT_SKIN_TONE = "\U0001f93d\U0001f3fb\u200d\u2640\ufe0f" -WOMAN_PLAYING_WATER_POLO_MEDIUM_LIGHT_SKIN_TONE = "\U0001f93d\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_PLAYING_WATER_POLO_MEDIUM_LIGHT_SKIN_TONE = ( + "\U0001f93d\U0001f3fc\u200d\u2640\ufe0f" +) WOMAN_PLAYING_WATER_POLO_MEDIUM_SKIN_TONE = "\U0001f93d\U0001f3fd\u200d\u2640\ufe0f" -WOMAN_PLAYING_WATER_POLO_MEDIUM_DARK_SKIN_TONE = "\U0001f93d\U0001f3fe\u200d\u2640\ufe0f" +WOMAN_PLAYING_WATER_POLO_MEDIUM_DARK_SKIN_TONE = ( + "\U0001f93d\U0001f3fe\u200d\u2640\ufe0f" +) WOMAN_PLAYING_WATER_POLO_DARK_SKIN_TONE = "\U0001f93d\U0001f3ff\u200d\u2640\ufe0f" PERSON_PLAYING_HANDBALL = "\U0001f93e" PERSON_PLAYING_HANDBALL_LIGHT_SKIN_TONE = "\U0001f93e\U0001f3fb" @@ -1956,7 +2026,9 @@ MAN_IN_LOTUS_POSITION_DARK_SKIN_TONE = "\U0001f9d8\U0001f3ff\u200d\u2642\ufe0f" WOMAN_IN_LOTUS_POSITION = "\U0001f9d8\u200d\u2640\ufe0f" WOMAN_IN_LOTUS_POSITION_LIGHT_SKIN_TONE = "\U0001f9d8\U0001f3fb\u200d\u2640\ufe0f" -WOMAN_IN_LOTUS_POSITION_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d8\U0001f3fc\u200d\u2640\ufe0f" +WOMAN_IN_LOTUS_POSITION_MEDIUM_LIGHT_SKIN_TONE = ( + "\U0001f9d8\U0001f3fc\u200d\u2640\ufe0f" +) WOMAN_IN_LOTUS_POSITION_MEDIUM_SKIN_TONE = "\U0001f9d8\U0001f3fd\u200d\u2640\ufe0f" WOMAN_IN_LOTUS_POSITION_MEDIUM_DARK_SKIN_TONE = "\U0001f9d8\U0001f3fe\u200d\u2640\ufe0f" WOMAN_IN_LOTUS_POSITION_DARK_SKIN_TONE = "\U0001f9d8\U0001f3ff\u200d\u2640\ufe0f" @@ -1973,172 +2045,278 @@ PERSON_IN_BED_MEDIUM_DARK_SKIN_TONE = "\U0001f6cc\U0001f3fe" PERSON_IN_BED_DARK_SKIN_TONE = "\U0001f6cc\U0001f3ff" PEOPLE_HOLDING_HANDS = "\U0001f9d1\u200d\U0001f91d\u200d\U0001f9d1" -PEOPLE_HOLDING_HANDS_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fb\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fb" -PEOPLE_HOLDING_HANDS_LIGHT_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +PEOPLE_HOLDING_HANDS_LIGHT_SKIN_TONE = ( + "\U0001f9d1\U0001f3fb\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fb" +) +PEOPLE_HOLDING_HANDS_LIGHT_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f9d1\U0001f3fb\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fc" -PEOPLE_HOLDING_HANDS_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ +) +PEOPLE_HOLDING_HANDS_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f9d1\U0001f3fb\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fd" -PEOPLE_HOLDING_HANDS_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +PEOPLE_HOLDING_HANDS_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f9d1\U0001f3fb\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fe" -PEOPLE_HOLDING_HANDS_LIGHT_SKIN_TONE_DARK_SKIN_TONE = "\U0001f9d1\U0001f3fb\u200d\U0001f91d\u200d\U0001f9d1\U0001f3ff" -PEOPLE_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +PEOPLE_HOLDING_HANDS_LIGHT_SKIN_TONE_DARK_SKIN_TONE = ( + "\U0001f9d1\U0001f3fb\u200d\U0001f91d\u200d\U0001f9d1\U0001f3ff" +) +PEOPLE_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f9d1\U0001f3fc\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fb" -PEOPLE_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3fc\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fc" -PEOPLE_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ +) +PEOPLE_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE = ( + "\U0001f9d1\U0001f3fc\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fc" +) +PEOPLE_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f9d1\U0001f3fc\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fd" -PEOPLE_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +PEOPLE_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f9d1\U0001f3fc\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fe" -PEOPLE_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ +) +PEOPLE_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f9d1\U0001f3fc\u200d\U0001f91d\u200d\U0001f9d1\U0001f3ff" -PEOPLE_HOLDING_HANDS_MEDIUM_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +PEOPLE_HOLDING_HANDS_MEDIUM_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f9d1\U0001f3fd\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fb" -PEOPLE_HOLDING_HANDS_MEDIUM_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +) +PEOPLE_HOLDING_HANDS_MEDIUM_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f9d1\U0001f3fd\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fc" -PEOPLE_HOLDING_HANDS_MEDIUM_SKIN_TONE = "\U0001f9d1\U0001f3fd\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fd" -PEOPLE_HOLDING_HANDS_MEDIUM_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +PEOPLE_HOLDING_HANDS_MEDIUM_SKIN_TONE = ( + "\U0001f9d1\U0001f3fd\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fd" +) +PEOPLE_HOLDING_HANDS_MEDIUM_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f9d1\U0001f3fd\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fe" -PEOPLE_HOLDING_HANDS_MEDIUM_SKIN_TONE_DARK_SKIN_TONE = "\U0001f9d1\U0001f3fd\u200d\U0001f91d\u200d\U0001f9d1\U0001f3ff" -PEOPLE_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +PEOPLE_HOLDING_HANDS_MEDIUM_SKIN_TONE_DARK_SKIN_TONE = ( + "\U0001f9d1\U0001f3fd\u200d\U0001f91d\u200d\U0001f9d1\U0001f3ff" +) +PEOPLE_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f9d1\U0001f3fe\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fb" -PEOPLE_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +) +PEOPLE_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f9d1\U0001f3fe\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fc" -PEOPLE_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ +) +PEOPLE_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f9d1\U0001f3fe\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fd" -PEOPLE_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE = "\U0001f9d1\U0001f3fe\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fe" -PEOPLE_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_DARK_SKIN_TONE = \ +) +PEOPLE_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE = ( + "\U0001f9d1\U0001f3fe\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fe" +) +PEOPLE_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f9d1\U0001f3fe\u200d\U0001f91d\u200d\U0001f9d1\U0001f3ff" -PEOPLE_HOLDING_HANDS_DARK_SKIN_TONE_LIGHT_SKIN_TONE = "\U0001f9d1\U0001f3ff\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fb" -PEOPLE_HOLDING_HANDS_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +) +PEOPLE_HOLDING_HANDS_DARK_SKIN_TONE_LIGHT_SKIN_TONE = ( + "\U0001f9d1\U0001f3ff\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fb" +) +PEOPLE_HOLDING_HANDS_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f9d1\U0001f3ff\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fc" -PEOPLE_HOLDING_HANDS_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = "\U0001f9d1\U0001f3ff\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fd" -PEOPLE_HOLDING_HANDS_DARK_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +PEOPLE_HOLDING_HANDS_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = ( + "\U0001f9d1\U0001f3ff\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fd" +) +PEOPLE_HOLDING_HANDS_DARK_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f9d1\U0001f3ff\u200d\U0001f91d\u200d\U0001f9d1\U0001f3fe" -PEOPLE_HOLDING_HANDS_DARK_SKIN_TONE = "\U0001f9d1\U0001f3ff\u200d\U0001f91d\u200d\U0001f9d1\U0001f3ff" +) +PEOPLE_HOLDING_HANDS_DARK_SKIN_TONE = ( + "\U0001f9d1\U0001f3ff\u200d\U0001f91d\u200d\U0001f9d1\U0001f3ff" +) WOMEN_HOLDING_HANDS = "\U0001f46d" WOMEN_HOLDING_HANDS_LIGHT_SKIN_TONE = "\U0001f46d\U0001f3fb" -WOMEN_HOLDING_HANDS_LIGHT_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +WOMEN_HOLDING_HANDS_LIGHT_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3fb\u200d\U0001f91d\u200d\U0001f469\U0001f3fc" -WOMEN_HOLDING_HANDS_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = "\U0001f469\U0001f3fb\u200d\U0001f91d\u200d\U0001f469\U0001f3fd" -WOMEN_HOLDING_HANDS_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +WOMEN_HOLDING_HANDS_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = ( + "\U0001f469\U0001f3fb\u200d\U0001f91d\u200d\U0001f469\U0001f3fd" +) +WOMEN_HOLDING_HANDS_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fb\u200d\U0001f91d\u200d\U0001f469\U0001f3fe" -WOMEN_HOLDING_HANDS_LIGHT_SKIN_TONE_DARK_SKIN_TONE = "\U0001f469\U0001f3fb\u200d\U0001f91d\u200d\U0001f469\U0001f3ff" -WOMEN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +WOMEN_HOLDING_HANDS_LIGHT_SKIN_TONE_DARK_SKIN_TONE = ( + "\U0001f469\U0001f3fb\u200d\U0001f91d\u200d\U0001f469\U0001f3ff" +) +WOMEN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3fc\u200d\U0001f91d\u200d\U0001f469\U0001f3fb" +) WOMEN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE = "\U0001f46d\U0001f3fc" -WOMEN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ +WOMEN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f469\U0001f3fc\u200d\U0001f91d\u200d\U0001f469\U0001f3fd" -WOMEN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +WOMEN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fc\u200d\U0001f91d\u200d\U0001f469\U0001f3fe" -WOMEN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ +) +WOMEN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fc\u200d\U0001f91d\u200d\U0001f469\U0001f3ff" -WOMEN_HOLDING_HANDS_MEDIUM_SKIN_TONE_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fd\u200d\U0001f91d\u200d\U0001f469\U0001f3fb" -WOMEN_HOLDING_HANDS_MEDIUM_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +) +WOMEN_HOLDING_HANDS_MEDIUM_SKIN_TONE_LIGHT_SKIN_TONE = ( + "\U0001f469\U0001f3fd\u200d\U0001f91d\u200d\U0001f469\U0001f3fb" +) +WOMEN_HOLDING_HANDS_MEDIUM_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3fd\u200d\U0001f91d\u200d\U0001f469\U0001f3fc" +) WOMEN_HOLDING_HANDS_MEDIUM_SKIN_TONE = "\U0001f46d\U0001f3fd" -WOMEN_HOLDING_HANDS_MEDIUM_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +WOMEN_HOLDING_HANDS_MEDIUM_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fd\u200d\U0001f91d\u200d\U0001f469\U0001f3fe" -WOMEN_HOLDING_HANDS_MEDIUM_SKIN_TONE_DARK_SKIN_TONE = "\U0001f469\U0001f3fd\u200d\U0001f91d\u200d\U0001f469\U0001f3ff" -WOMEN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +WOMEN_HOLDING_HANDS_MEDIUM_SKIN_TONE_DARK_SKIN_TONE = ( + "\U0001f469\U0001f3fd\u200d\U0001f91d\u200d\U0001f469\U0001f3ff" +) +WOMEN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3fe\u200d\U0001f91d\u200d\U0001f469\U0001f3fb" -WOMEN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +) +WOMEN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3fe\u200d\U0001f91d\u200d\U0001f469\U0001f3fc" -WOMEN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ +) +WOMEN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f469\U0001f3fe\u200d\U0001f91d\u200d\U0001f469\U0001f3fd" +) WOMEN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE = "\U0001f46d\U0001f3fe" -WOMEN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_DARK_SKIN_TONE = \ +WOMEN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fe\u200d\U0001f91d\u200d\U0001f469\U0001f3ff" -WOMEN_HOLDING_HANDS_DARK_SKIN_TONE_LIGHT_SKIN_TONE = "\U0001f469\U0001f3ff\u200d\U0001f91d\u200d\U0001f469\U0001f3fb" -WOMEN_HOLDING_HANDS_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +) +WOMEN_HOLDING_HANDS_DARK_SKIN_TONE_LIGHT_SKIN_TONE = ( + "\U0001f469\U0001f3ff\u200d\U0001f91d\u200d\U0001f469\U0001f3fb" +) +WOMEN_HOLDING_HANDS_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3ff\u200d\U0001f91d\u200d\U0001f469\U0001f3fc" -WOMEN_HOLDING_HANDS_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = "\U0001f469\U0001f3ff\u200d\U0001f91d\u200d\U0001f469\U0001f3fd" -WOMEN_HOLDING_HANDS_DARK_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +WOMEN_HOLDING_HANDS_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = ( + "\U0001f469\U0001f3ff\u200d\U0001f91d\u200d\U0001f469\U0001f3fd" +) +WOMEN_HOLDING_HANDS_DARK_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f469\U0001f3ff\u200d\U0001f91d\u200d\U0001f469\U0001f3fe" +) WOMEN_HOLDING_HANDS_DARK_SKIN_TONE = "\U0001f46d\U0001f3ff" WOMAN_AND_MAN_HOLDING_HANDS = "\U0001f46b" WOMAN_AND_MAN_HOLDING_HANDS_LIGHT_SKIN_TONE = "\U0001f46b\U0001f3fb" -WOMAN_AND_MAN_HOLDING_HANDS_LIGHT_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +WOMAN_AND_MAN_HOLDING_HANDS_LIGHT_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3fb\u200d\U0001f91d\u200d\U0001f468\U0001f3fc" -WOMAN_AND_MAN_HOLDING_HANDS_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ +) +WOMAN_AND_MAN_HOLDING_HANDS_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f469\U0001f3fb\u200d\U0001f91d\u200d\U0001f468\U0001f3fd" -WOMAN_AND_MAN_HOLDING_HANDS_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +WOMAN_AND_MAN_HOLDING_HANDS_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fb\u200d\U0001f91d\u200d\U0001f468\U0001f3fe" -WOMAN_AND_MAN_HOLDING_HANDS_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ +) +WOMAN_AND_MAN_HOLDING_HANDS_LIGHT_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fb\u200d\U0001f91d\u200d\U0001f468\U0001f3ff" -WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3fc\u200d\U0001f91d\u200d\U0001f468\U0001f3fb" +) WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE = "\U0001f46b\U0001f3fc" -WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ +WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f469\U0001f3fc\u200d\U0001f91d\u200d\U0001f468\U0001f3fd" -WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fc\u200d\U0001f91d\u200d\U0001f468\U0001f3fe" -WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ +) +WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fc\u200d\U0001f91d\u200d\U0001f468\U0001f3ff" -WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3fd\u200d\U0001f91d\u200d\U0001f468\U0001f3fb" -WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +) +WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3fd\u200d\U0001f91d\u200d\U0001f468\U0001f3fc" +) WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_SKIN_TONE = "\U0001f46b\U0001f3fd" -WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fd\u200d\U0001f91d\u200d\U0001f468\U0001f3fe" -WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_SKIN_TONE_DARK_SKIN_TONE = \ +) +WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fd\u200d\U0001f91d\u200d\U0001f468\U0001f3ff" -WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3fe\u200d\U0001f91d\u200d\U0001f468\U0001f3fb" -WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +) +WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3fe\u200d\U0001f91d\u200d\U0001f468\U0001f3fc" -WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ +) +WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f469\U0001f3fe\u200d\U0001f91d\u200d\U0001f468\U0001f3fd" +) WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE = "\U0001f46b\U0001f3fe" -WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_DARK_SKIN_TONE = \ +WOMAN_AND_MAN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fe\u200d\U0001f91d\u200d\U0001f468\U0001f3ff" -WOMAN_AND_MAN_HOLDING_HANDS_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +WOMAN_AND_MAN_HOLDING_HANDS_DARK_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3ff\u200d\U0001f91d\u200d\U0001f468\U0001f3fb" -WOMAN_AND_MAN_HOLDING_HANDS_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +) +WOMAN_AND_MAN_HOLDING_HANDS_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3ff\u200d\U0001f91d\u200d\U0001f468\U0001f3fc" -WOMAN_AND_MAN_HOLDING_HANDS_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ +) +WOMAN_AND_MAN_HOLDING_HANDS_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f469\U0001f3ff\u200d\U0001f91d\u200d\U0001f468\U0001f3fd" -WOMAN_AND_MAN_HOLDING_HANDS_DARK_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +WOMAN_AND_MAN_HOLDING_HANDS_DARK_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f469\U0001f3ff\u200d\U0001f91d\u200d\U0001f468\U0001f3fe" +) WOMAN_AND_MAN_HOLDING_HANDS_DARK_SKIN_TONE = "\U0001f46b\U0001f3ff" MEN_HOLDING_HANDS = "\U0001f46c" MEN_HOLDING_HANDS_LIGHT_SKIN_TONE = "\U0001f46c\U0001f3fb" -MEN_HOLDING_HANDS_LIGHT_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +MEN_HOLDING_HANDS_LIGHT_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f468\U0001f3fb\u200d\U0001f91d\u200d\U0001f468\U0001f3fc" -MEN_HOLDING_HANDS_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = "\U0001f468\U0001f3fb\u200d\U0001f91d\u200d\U0001f468\U0001f3fd" -MEN_HOLDING_HANDS_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +MEN_HOLDING_HANDS_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = ( + "\U0001f468\U0001f3fb\u200d\U0001f91d\u200d\U0001f468\U0001f3fd" +) +MEN_HOLDING_HANDS_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f468\U0001f3fb\u200d\U0001f91d\u200d\U0001f468\U0001f3fe" -MEN_HOLDING_HANDS_LIGHT_SKIN_TONE_DARK_SKIN_TONE = "\U0001f468\U0001f3fb\u200d\U0001f91d\u200d\U0001f468\U0001f3ff" -MEN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +MEN_HOLDING_HANDS_LIGHT_SKIN_TONE_DARK_SKIN_TONE = ( + "\U0001f468\U0001f3fb\u200d\U0001f91d\u200d\U0001f468\U0001f3ff" +) +MEN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f468\U0001f3fc\u200d\U0001f91d\u200d\U0001f468\U0001f3fb" +) MEN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE = "\U0001f46c\U0001f3fc" -MEN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ +MEN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f468\U0001f3fc\u200d\U0001f91d\u200d\U0001f468\U0001f3fd" -MEN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +MEN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f468\U0001f3fc\u200d\U0001f91d\u200d\U0001f468\U0001f3fe" -MEN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ +) +MEN_HOLDING_HANDS_MEDIUM_LIGHT_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f468\U0001f3fc\u200d\U0001f91d\u200d\U0001f468\U0001f3ff" -MEN_HOLDING_HANDS_MEDIUM_SKIN_TONE_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fd\u200d\U0001f91d\u200d\U0001f468\U0001f3fb" -MEN_HOLDING_HANDS_MEDIUM_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +) +MEN_HOLDING_HANDS_MEDIUM_SKIN_TONE_LIGHT_SKIN_TONE = ( + "\U0001f468\U0001f3fd\u200d\U0001f91d\u200d\U0001f468\U0001f3fb" +) +MEN_HOLDING_HANDS_MEDIUM_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f468\U0001f3fd\u200d\U0001f91d\u200d\U0001f468\U0001f3fc" +) MEN_HOLDING_HANDS_MEDIUM_SKIN_TONE = "\U0001f46c\U0001f3fd" -MEN_HOLDING_HANDS_MEDIUM_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +MEN_HOLDING_HANDS_MEDIUM_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f468\U0001f3fd\u200d\U0001f91d\u200d\U0001f468\U0001f3fe" -MEN_HOLDING_HANDS_MEDIUM_SKIN_TONE_DARK_SKIN_TONE = "\U0001f468\U0001f3fd\u200d\U0001f91d\u200d\U0001f468\U0001f3ff" -MEN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +MEN_HOLDING_HANDS_MEDIUM_SKIN_TONE_DARK_SKIN_TONE = ( + "\U0001f468\U0001f3fd\u200d\U0001f91d\u200d\U0001f468\U0001f3ff" +) +MEN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f468\U0001f3fe\u200d\U0001f91d\u200d\U0001f468\U0001f3fb" -MEN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +) +MEN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f468\U0001f3fe\u200d\U0001f91d\u200d\U0001f468\U0001f3fc" -MEN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ +) +MEN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f468\U0001f3fe\u200d\U0001f91d\u200d\U0001f468\U0001f3fd" +) MEN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE = "\U0001f46c\U0001f3fe" -MEN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_DARK_SKIN_TONE = \ +MEN_HOLDING_HANDS_MEDIUM_DARK_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f468\U0001f3fe\u200d\U0001f91d\u200d\U0001f468\U0001f3ff" -MEN_HOLDING_HANDS_DARK_SKIN_TONE_LIGHT_SKIN_TONE = "\U0001f468\U0001f3ff\u200d\U0001f91d\u200d\U0001f468\U0001f3fb" -MEN_HOLDING_HANDS_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +) +MEN_HOLDING_HANDS_DARK_SKIN_TONE_LIGHT_SKIN_TONE = ( + "\U0001f468\U0001f3ff\u200d\U0001f91d\u200d\U0001f468\U0001f3fb" +) +MEN_HOLDING_HANDS_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f468\U0001f3ff\u200d\U0001f91d\u200d\U0001f468\U0001f3fc" -MEN_HOLDING_HANDS_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = "\U0001f468\U0001f3ff\u200d\U0001f91d\u200d\U0001f468\U0001f3fd" -MEN_HOLDING_HANDS_DARK_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +MEN_HOLDING_HANDS_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = ( + "\U0001f468\U0001f3ff\u200d\U0001f91d\u200d\U0001f468\U0001f3fd" +) +MEN_HOLDING_HANDS_DARK_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f468\U0001f3ff\u200d\U0001f91d\u200d\U0001f468\U0001f3fe" +) MEN_HOLDING_HANDS_DARK_SKIN_TONE = "\U0001f46c\U0001f3ff" KISS = "\U0001f48f" KISS_LIGHT_SKIN_TONE = "\U0001f48f\U0001f3fb" @@ -2146,381 +2324,596 @@ KISS_MEDIUM_SKIN_TONE = "\U0001f48f\U0001f3fd" KISS_MEDIUM_DARK_SKIN_TONE = "\U0001f48f\U0001f3fe" KISS_DARK_SKIN_TONE = "\U0001f48f\U0001f3ff" -KISS_PERSON_PERSON_LIGHT_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +KISS_PERSON_PERSON_LIGHT_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f9d1\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f9d1\U0001f3fc" -KISS_PERSON_PERSON_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ +) +KISS_PERSON_PERSON_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f9d1\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f9d1\U0001f3fd" -KISS_PERSON_PERSON_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +KISS_PERSON_PERSON_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f9d1\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f9d1\U0001f3fe" -KISS_PERSON_PERSON_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ +) +KISS_PERSON_PERSON_LIGHT_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f9d1\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f9d1\U0001f3ff" -KISS_PERSON_PERSON_MEDIUM_LIGHT_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +KISS_PERSON_PERSON_MEDIUM_LIGHT_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f9d1\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f9d1\U0001f3fb" -KISS_PERSON_PERSON_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ +) +KISS_PERSON_PERSON_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f9d1\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f9d1\U0001f3fd" -KISS_PERSON_PERSON_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +KISS_PERSON_PERSON_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f9d1\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f9d1\U0001f3fe" -KISS_PERSON_PERSON_MEDIUM_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ +) +KISS_PERSON_PERSON_MEDIUM_LIGHT_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f9d1\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f9d1\U0001f3ff" -KISS_PERSON_PERSON_MEDIUM_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +KISS_PERSON_PERSON_MEDIUM_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f9d1\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f9d1\U0001f3fb" -KISS_PERSON_PERSON_MEDIUM_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +) +KISS_PERSON_PERSON_MEDIUM_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f9d1\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f9d1\U0001f3fc" -KISS_PERSON_PERSON_MEDIUM_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +KISS_PERSON_PERSON_MEDIUM_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f9d1\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f9d1\U0001f3fe" -KISS_PERSON_PERSON_MEDIUM_SKIN_TONE_DARK_SKIN_TONE = \ +) +KISS_PERSON_PERSON_MEDIUM_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f9d1\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f9d1\U0001f3ff" -KISS_PERSON_PERSON_MEDIUM_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +KISS_PERSON_PERSON_MEDIUM_DARK_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f9d1\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f9d1\U0001f3fb" -KISS_PERSON_PERSON_MEDIUM_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +) +KISS_PERSON_PERSON_MEDIUM_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f9d1\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f9d1\U0001f3fc" -KISS_PERSON_PERSON_MEDIUM_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ +) +KISS_PERSON_PERSON_MEDIUM_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f9d1\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f9d1\U0001f3fd" -KISS_PERSON_PERSON_MEDIUM_DARK_SKIN_TONE_DARK_SKIN_TONE = \ +) +KISS_PERSON_PERSON_MEDIUM_DARK_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f9d1\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f9d1\U0001f3ff" -KISS_PERSON_PERSON_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +KISS_PERSON_PERSON_DARK_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f9d1\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f9d1\U0001f3fb" -KISS_PERSON_PERSON_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +) +KISS_PERSON_PERSON_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f9d1\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f9d1\U0001f3fc" -KISS_PERSON_PERSON_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ +) +KISS_PERSON_PERSON_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f9d1\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f9d1\U0001f3fd" -KISS_PERSON_PERSON_DARK_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +KISS_PERSON_PERSON_DARK_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f9d1\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f9d1\U0001f3fe" +) KISS_WOMAN_MAN = "\U0001f469\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468" -KISS_WOMAN_MAN_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fb" -KISS_WOMAN_MAN_LIGHT_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +KISS_WOMAN_MAN_LIGHT_SKIN_TONE = ( + "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fb" +) +KISS_WOMAN_MAN_LIGHT_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fc" -KISS_WOMAN_MAN_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ +) +KISS_WOMAN_MAN_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fd" -KISS_WOMAN_MAN_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +KISS_WOMAN_MAN_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fe" -KISS_WOMAN_MAN_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ +) +KISS_WOMAN_MAN_LIGHT_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3ff" -KISS_WOMAN_MAN_MEDIUM_LIGHT_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +KISS_WOMAN_MAN_MEDIUM_LIGHT_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fb" -KISS_WOMAN_MAN_MEDIUM_LIGHT_SKIN_TONE = \ +) +KISS_WOMAN_MAN_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fc" -KISS_WOMAN_MAN_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ +) +KISS_WOMAN_MAN_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fd" -KISS_WOMAN_MAN_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +KISS_WOMAN_MAN_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fe" -KISS_WOMAN_MAN_MEDIUM_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ +) +KISS_WOMAN_MAN_MEDIUM_LIGHT_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3ff" -KISS_WOMAN_MAN_MEDIUM_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +KISS_WOMAN_MAN_MEDIUM_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fb" -KISS_WOMAN_MAN_MEDIUM_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +) +KISS_WOMAN_MAN_MEDIUM_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fc" -KISS_WOMAN_MAN_MEDIUM_SKIN_TONE = "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fd" -KISS_WOMAN_MAN_MEDIUM_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +KISS_WOMAN_MAN_MEDIUM_SKIN_TONE = ( + "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fd" +) +KISS_WOMAN_MAN_MEDIUM_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fe" -KISS_WOMAN_MAN_MEDIUM_SKIN_TONE_DARK_SKIN_TONE = \ +) +KISS_WOMAN_MAN_MEDIUM_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3ff" -KISS_WOMAN_MAN_MEDIUM_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +KISS_WOMAN_MAN_MEDIUM_DARK_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fb" -KISS_WOMAN_MAN_MEDIUM_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +) +KISS_WOMAN_MAN_MEDIUM_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fc" -KISS_WOMAN_MAN_MEDIUM_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ +) +KISS_WOMAN_MAN_MEDIUM_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fd" -KISS_WOMAN_MAN_MEDIUM_DARK_SKIN_TONE = \ +) +KISS_WOMAN_MAN_MEDIUM_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fe" -KISS_WOMAN_MAN_MEDIUM_DARK_SKIN_TONE_DARK_SKIN_TONE = \ +) +KISS_WOMAN_MAN_MEDIUM_DARK_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3ff" -KISS_WOMAN_MAN_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +KISS_WOMAN_MAN_DARK_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fb" -KISS_WOMAN_MAN_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +) +KISS_WOMAN_MAN_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fc" -KISS_WOMAN_MAN_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ +) +KISS_WOMAN_MAN_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fd" -KISS_WOMAN_MAN_DARK_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +KISS_WOMAN_MAN_DARK_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fe" -KISS_WOMAN_MAN_DARK_SKIN_TONE = "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3ff" +) +KISS_WOMAN_MAN_DARK_SKIN_TONE = ( + "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3ff" +) KISS_MAN_MAN = "\U0001f468\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468" -KISS_MAN_MAN_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fb" -KISS_MAN_MAN_LIGHT_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +KISS_MAN_MAN_LIGHT_SKIN_TONE = ( + "\U0001f468\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fb" +) +KISS_MAN_MAN_LIGHT_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f468\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fc" -KISS_MAN_MAN_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ +) +KISS_MAN_MAN_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f468\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fd" -KISS_MAN_MAN_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +KISS_MAN_MAN_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f468\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fe" -KISS_MAN_MAN_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ +) +KISS_MAN_MAN_LIGHT_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f468\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3ff" -KISS_MAN_MAN_MEDIUM_LIGHT_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +KISS_MAN_MAN_MEDIUM_LIGHT_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f468\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fb" -KISS_MAN_MAN_MEDIUM_LIGHT_SKIN_TONE = \ +) +KISS_MAN_MAN_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f468\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fc" -KISS_MAN_MAN_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ +) +KISS_MAN_MAN_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f468\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fd" -KISS_MAN_MAN_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +KISS_MAN_MAN_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f468\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fe" -KISS_MAN_MAN_MEDIUM_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ +) +KISS_MAN_MAN_MEDIUM_LIGHT_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f468\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3ff" -KISS_MAN_MAN_MEDIUM_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +KISS_MAN_MAN_MEDIUM_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f468\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fb" -KISS_MAN_MAN_MEDIUM_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +) +KISS_MAN_MAN_MEDIUM_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f468\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fc" -KISS_MAN_MAN_MEDIUM_SKIN_TONE = "\U0001f468\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fd" -KISS_MAN_MAN_MEDIUM_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +KISS_MAN_MAN_MEDIUM_SKIN_TONE = ( + "\U0001f468\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fd" +) +KISS_MAN_MAN_MEDIUM_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f468\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fe" -KISS_MAN_MAN_MEDIUM_SKIN_TONE_DARK_SKIN_TONE = \ +) +KISS_MAN_MAN_MEDIUM_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f468\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3ff" -KISS_MAN_MAN_MEDIUM_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +KISS_MAN_MAN_MEDIUM_DARK_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f468\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fb" -KISS_MAN_MAN_MEDIUM_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +) +KISS_MAN_MAN_MEDIUM_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f468\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fc" -KISS_MAN_MAN_MEDIUM_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ +) +KISS_MAN_MAN_MEDIUM_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f468\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fd" -KISS_MAN_MAN_MEDIUM_DARK_SKIN_TONE = "\U0001f468\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fe" -KISS_MAN_MAN_MEDIUM_DARK_SKIN_TONE_DARK_SKIN_TONE = \ +) +KISS_MAN_MAN_MEDIUM_DARK_SKIN_TONE = ( + "\U0001f468\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fe" +) +KISS_MAN_MAN_MEDIUM_DARK_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f468\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3ff" -KISS_MAN_MAN_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +KISS_MAN_MAN_DARK_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f468\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fb" -KISS_MAN_MAN_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +) +KISS_MAN_MAN_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f468\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fc" -KISS_MAN_MAN_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ +) +KISS_MAN_MAN_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f468\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fd" -KISS_MAN_MAN_DARK_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +KISS_MAN_MAN_DARK_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f468\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3fe" -KISS_MAN_MAN_DARK_SKIN_TONE = "\U0001f468\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3ff" +) +KISS_MAN_MAN_DARK_SKIN_TONE = ( + "\U0001f468\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f468\U0001f3ff" +) KISS_WOMAN_WOMAN = "\U0001f469\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469" -KISS_WOMAN_WOMAN_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fb" -KISS_WOMAN_WOMAN_LIGHT_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +KISS_WOMAN_WOMAN_LIGHT_SKIN_TONE = ( + "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fb" +) +KISS_WOMAN_WOMAN_LIGHT_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fc" -KISS_WOMAN_WOMAN_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ +) +KISS_WOMAN_WOMAN_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fd" -KISS_WOMAN_WOMAN_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +KISS_WOMAN_WOMAN_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fe" -KISS_WOMAN_WOMAN_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ +) +KISS_WOMAN_WOMAN_LIGHT_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3ff" -KISS_WOMAN_WOMAN_MEDIUM_LIGHT_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +KISS_WOMAN_WOMAN_MEDIUM_LIGHT_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fb" -KISS_WOMAN_WOMAN_MEDIUM_LIGHT_SKIN_TONE = \ +) +KISS_WOMAN_WOMAN_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fc" -KISS_WOMAN_WOMAN_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ +) +KISS_WOMAN_WOMAN_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fd" -KISS_WOMAN_WOMAN_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +KISS_WOMAN_WOMAN_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fe" -KISS_WOMAN_WOMAN_MEDIUM_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ +) +KISS_WOMAN_WOMAN_MEDIUM_LIGHT_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3ff" -KISS_WOMAN_WOMAN_MEDIUM_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +KISS_WOMAN_WOMAN_MEDIUM_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fb" -KISS_WOMAN_WOMAN_MEDIUM_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +) +KISS_WOMAN_WOMAN_MEDIUM_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fc" -KISS_WOMAN_WOMAN_MEDIUM_SKIN_TONE = "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fd" -KISS_WOMAN_WOMAN_MEDIUM_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +KISS_WOMAN_WOMAN_MEDIUM_SKIN_TONE = ( + "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fd" +) +KISS_WOMAN_WOMAN_MEDIUM_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fe" -KISS_WOMAN_WOMAN_MEDIUM_SKIN_TONE_DARK_SKIN_TONE = \ +) +KISS_WOMAN_WOMAN_MEDIUM_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3ff" -KISS_WOMAN_WOMAN_MEDIUM_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +KISS_WOMAN_WOMAN_MEDIUM_DARK_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fb" -KISS_WOMAN_WOMAN_MEDIUM_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +) +KISS_WOMAN_WOMAN_MEDIUM_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fc" -KISS_WOMAN_WOMAN_MEDIUM_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ +) +KISS_WOMAN_WOMAN_MEDIUM_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fd" -KISS_WOMAN_WOMAN_MEDIUM_DARK_SKIN_TONE = \ +) +KISS_WOMAN_WOMAN_MEDIUM_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fe" -KISS_WOMAN_WOMAN_MEDIUM_DARK_SKIN_TONE_DARK_SKIN_TONE = \ +) +KISS_WOMAN_WOMAN_MEDIUM_DARK_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3ff" -KISS_WOMAN_WOMAN_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +KISS_WOMAN_WOMAN_DARK_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fb" -KISS_WOMAN_WOMAN_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +) +KISS_WOMAN_WOMAN_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fc" -KISS_WOMAN_WOMAN_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ +) +KISS_WOMAN_WOMAN_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fd" -KISS_WOMAN_WOMAN_DARK_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +KISS_WOMAN_WOMAN_DARK_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3fe" -KISS_WOMAN_WOMAN_DARK_SKIN_TONE = "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3ff" +) +KISS_WOMAN_WOMAN_DARK_SKIN_TONE = ( + "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f48b\u200d\U0001f469\U0001f3ff" +) COUPLE_WITH_HEART = "\U0001f491" COUPLE_WITH_HEART_LIGHT_SKIN_TONE = "\U0001f491\U0001f3fb" COUPLE_WITH_HEART_MEDIUM_LIGHT_SKIN_TONE = "\U0001f491\U0001f3fc" COUPLE_WITH_HEART_MEDIUM_SKIN_TONE = "\U0001f491\U0001f3fd" COUPLE_WITH_HEART_MEDIUM_DARK_SKIN_TONE = "\U0001f491\U0001f3fe" COUPLE_WITH_HEART_DARK_SKIN_TONE = "\U0001f491\U0001f3ff" -COUPLE_WITH_HEART_PERSON_PERSON_LIGHT_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +COUPLE_WITH_HEART_PERSON_PERSON_LIGHT_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f9d1\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f9d1\U0001f3fc" -COUPLE_WITH_HEART_PERSON_PERSON_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ +) +COUPLE_WITH_HEART_PERSON_PERSON_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f9d1\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f9d1\U0001f3fd" -COUPLE_WITH_HEART_PERSON_PERSON_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +COUPLE_WITH_HEART_PERSON_PERSON_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f9d1\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f9d1\U0001f3fe" -COUPLE_WITH_HEART_PERSON_PERSON_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ +) +COUPLE_WITH_HEART_PERSON_PERSON_LIGHT_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f9d1\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f9d1\U0001f3ff" -COUPLE_WITH_HEART_PERSON_PERSON_MEDIUM_LIGHT_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +COUPLE_WITH_HEART_PERSON_PERSON_MEDIUM_LIGHT_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f9d1\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f9d1\U0001f3fb" -COUPLE_WITH_HEART_PERSON_PERSON_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ +) +COUPLE_WITH_HEART_PERSON_PERSON_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f9d1\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f9d1\U0001f3fd" -COUPLE_WITH_HEART_PERSON_PERSON_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +COUPLE_WITH_HEART_PERSON_PERSON_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f9d1\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f9d1\U0001f3fe" -COUPLE_WITH_HEART_PERSON_PERSON_MEDIUM_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ +) +COUPLE_WITH_HEART_PERSON_PERSON_MEDIUM_LIGHT_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f9d1\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f9d1\U0001f3ff" -COUPLE_WITH_HEART_PERSON_PERSON_MEDIUM_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +COUPLE_WITH_HEART_PERSON_PERSON_MEDIUM_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f9d1\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f9d1\U0001f3fb" -COUPLE_WITH_HEART_PERSON_PERSON_MEDIUM_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +) +COUPLE_WITH_HEART_PERSON_PERSON_MEDIUM_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f9d1\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f9d1\U0001f3fc" -COUPLE_WITH_HEART_PERSON_PERSON_MEDIUM_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +COUPLE_WITH_HEART_PERSON_PERSON_MEDIUM_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f9d1\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f9d1\U0001f3fe" -COUPLE_WITH_HEART_PERSON_PERSON_MEDIUM_SKIN_TONE_DARK_SKIN_TONE = \ +) +COUPLE_WITH_HEART_PERSON_PERSON_MEDIUM_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f9d1\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f9d1\U0001f3ff" -COUPLE_WITH_HEART_PERSON_PERSON_MEDIUM_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +COUPLE_WITH_HEART_PERSON_PERSON_MEDIUM_DARK_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f9d1\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f9d1\U0001f3fb" -COUPLE_WITH_HEART_PERSON_PERSON_MEDIUM_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +) +COUPLE_WITH_HEART_PERSON_PERSON_MEDIUM_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f9d1\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f9d1\U0001f3fc" -COUPLE_WITH_HEART_PERSON_PERSON_MEDIUM_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ +) +COUPLE_WITH_HEART_PERSON_PERSON_MEDIUM_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f9d1\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f9d1\U0001f3fd" -COUPLE_WITH_HEART_PERSON_PERSON_MEDIUM_DARK_SKIN_TONE_DARK_SKIN_TONE = \ +) +COUPLE_WITH_HEART_PERSON_PERSON_MEDIUM_DARK_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f9d1\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f9d1\U0001f3ff" -COUPLE_WITH_HEART_PERSON_PERSON_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +COUPLE_WITH_HEART_PERSON_PERSON_DARK_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f9d1\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f9d1\U0001f3fb" -COUPLE_WITH_HEART_PERSON_PERSON_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +) +COUPLE_WITH_HEART_PERSON_PERSON_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f9d1\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f9d1\U0001f3fc" -COUPLE_WITH_HEART_PERSON_PERSON_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ +) +COUPLE_WITH_HEART_PERSON_PERSON_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f9d1\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f9d1\U0001f3fd" -COUPLE_WITH_HEART_PERSON_PERSON_DARK_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +COUPLE_WITH_HEART_PERSON_PERSON_DARK_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f9d1\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f9d1\U0001f3fe" +) COUPLE_WITH_HEART_WOMAN_MAN = "\U0001f469\u200d\u2764\ufe0f\u200d\U0001f468" -COUPLE_WITH_HEART_WOMAN_MAN_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fb" -COUPLE_WITH_HEART_WOMAN_MAN_LIGHT_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +COUPLE_WITH_HEART_WOMAN_MAN_LIGHT_SKIN_TONE = ( + "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fb" +) +COUPLE_WITH_HEART_WOMAN_MAN_LIGHT_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fc" -COUPLE_WITH_HEART_WOMAN_MAN_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ +) +COUPLE_WITH_HEART_WOMAN_MAN_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fd" -COUPLE_WITH_HEART_WOMAN_MAN_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +COUPLE_WITH_HEART_WOMAN_MAN_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fe" -COUPLE_WITH_HEART_WOMAN_MAN_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ +) +COUPLE_WITH_HEART_WOMAN_MAN_LIGHT_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3ff" -COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_LIGHT_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_LIGHT_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fb" -COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fc" -COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ +) +COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_LIGHT_SKIN_TONE = ( + "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fc" +) +COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fd" -COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fe" -COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ +) +COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_LIGHT_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3ff" -COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fb" -COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +) +COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fc" -COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_SKIN_TONE = "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fd" -COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_SKIN_TONE = ( + "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fd" +) +COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fe" -COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_SKIN_TONE_DARK_SKIN_TONE = \ +) +COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3ff" -COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_DARK_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fb" -COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +) +COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fc" -COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ +) +COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fd" -COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_DARK_SKIN_TONE = "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fe" -COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_DARK_SKIN_TONE_DARK_SKIN_TONE = \ +) +COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_DARK_SKIN_TONE = ( + "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fe" +) +COUPLE_WITH_HEART_WOMAN_MAN_MEDIUM_DARK_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3ff" -COUPLE_WITH_HEART_WOMAN_MAN_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +COUPLE_WITH_HEART_WOMAN_MAN_DARK_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fb" -COUPLE_WITH_HEART_WOMAN_MAN_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +) +COUPLE_WITH_HEART_WOMAN_MAN_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fc" -COUPLE_WITH_HEART_WOMAN_MAN_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ +) +COUPLE_WITH_HEART_WOMAN_MAN_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fd" -COUPLE_WITH_HEART_WOMAN_MAN_DARK_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +COUPLE_WITH_HEART_WOMAN_MAN_DARK_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fe" -COUPLE_WITH_HEART_WOMAN_MAN_DARK_SKIN_TONE = "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3ff" +) +COUPLE_WITH_HEART_WOMAN_MAN_DARK_SKIN_TONE = ( + "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3ff" +) COUPLE_WITH_HEART_MAN_MAN = "\U0001f468\u200d\u2764\ufe0f\u200d\U0001f468" -COUPLE_WITH_HEART_MAN_MAN_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fb" -COUPLE_WITH_HEART_MAN_MAN_LIGHT_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +COUPLE_WITH_HEART_MAN_MAN_LIGHT_SKIN_TONE = ( + "\U0001f468\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fb" +) +COUPLE_WITH_HEART_MAN_MAN_LIGHT_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f468\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fc" -COUPLE_WITH_HEART_MAN_MAN_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ +) +COUPLE_WITH_HEART_MAN_MAN_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f468\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fd" -COUPLE_WITH_HEART_MAN_MAN_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +COUPLE_WITH_HEART_MAN_MAN_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f468\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fe" -COUPLE_WITH_HEART_MAN_MAN_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ +) +COUPLE_WITH_HEART_MAN_MAN_LIGHT_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f468\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3ff" -COUPLE_WITH_HEART_MAN_MAN_MEDIUM_LIGHT_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +COUPLE_WITH_HEART_MAN_MAN_MEDIUM_LIGHT_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f468\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fb" -COUPLE_WITH_HEART_MAN_MAN_MEDIUM_LIGHT_SKIN_TONE = "\U0001f468\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fc" -COUPLE_WITH_HEART_MAN_MAN_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ +) +COUPLE_WITH_HEART_MAN_MAN_MEDIUM_LIGHT_SKIN_TONE = ( + "\U0001f468\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fc" +) +COUPLE_WITH_HEART_MAN_MAN_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f468\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fd" -COUPLE_WITH_HEART_MAN_MAN_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +COUPLE_WITH_HEART_MAN_MAN_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f468\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fe" -COUPLE_WITH_HEART_MAN_MAN_MEDIUM_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ +) +COUPLE_WITH_HEART_MAN_MAN_MEDIUM_LIGHT_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f468\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3ff" -COUPLE_WITH_HEART_MAN_MAN_MEDIUM_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +COUPLE_WITH_HEART_MAN_MAN_MEDIUM_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f468\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fb" -COUPLE_WITH_HEART_MAN_MAN_MEDIUM_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +) +COUPLE_WITH_HEART_MAN_MAN_MEDIUM_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f468\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fc" -COUPLE_WITH_HEART_MAN_MAN_MEDIUM_SKIN_TONE = "\U0001f468\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fd" -COUPLE_WITH_HEART_MAN_MAN_MEDIUM_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +COUPLE_WITH_HEART_MAN_MAN_MEDIUM_SKIN_TONE = ( + "\U0001f468\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fd" +) +COUPLE_WITH_HEART_MAN_MAN_MEDIUM_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f468\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fe" -COUPLE_WITH_HEART_MAN_MAN_MEDIUM_SKIN_TONE_DARK_SKIN_TONE = \ +) +COUPLE_WITH_HEART_MAN_MAN_MEDIUM_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f468\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3ff" -COUPLE_WITH_HEART_MAN_MAN_MEDIUM_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +COUPLE_WITH_HEART_MAN_MAN_MEDIUM_DARK_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f468\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fb" -COUPLE_WITH_HEART_MAN_MAN_MEDIUM_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +) +COUPLE_WITH_HEART_MAN_MAN_MEDIUM_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f468\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fc" -COUPLE_WITH_HEART_MAN_MAN_MEDIUM_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ +) +COUPLE_WITH_HEART_MAN_MAN_MEDIUM_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f468\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fd" -COUPLE_WITH_HEART_MAN_MAN_MEDIUM_DARK_SKIN_TONE = "\U0001f468\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fe" -COUPLE_WITH_HEART_MAN_MAN_MEDIUM_DARK_SKIN_TONE_DARK_SKIN_TONE = \ +) +COUPLE_WITH_HEART_MAN_MAN_MEDIUM_DARK_SKIN_TONE = ( + "\U0001f468\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fe" +) +COUPLE_WITH_HEART_MAN_MAN_MEDIUM_DARK_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f468\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3ff" -COUPLE_WITH_HEART_MAN_MAN_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +COUPLE_WITH_HEART_MAN_MAN_DARK_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f468\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fb" -COUPLE_WITH_HEART_MAN_MAN_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +) +COUPLE_WITH_HEART_MAN_MAN_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f468\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fc" -COUPLE_WITH_HEART_MAN_MAN_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ +) +COUPLE_WITH_HEART_MAN_MAN_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f468\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fd" -COUPLE_WITH_HEART_MAN_MAN_DARK_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +COUPLE_WITH_HEART_MAN_MAN_DARK_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f468\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3fe" -COUPLE_WITH_HEART_MAN_MAN_DARK_SKIN_TONE = "\U0001f468\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3ff" +) +COUPLE_WITH_HEART_MAN_MAN_DARK_SKIN_TONE = ( + "\U0001f468\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3ff" +) COUPLE_WITH_HEART_WOMAN_WOMAN = "\U0001f469\u200d\u2764\ufe0f\u200d\U0001f469" -COUPLE_WITH_HEART_WOMAN_WOMAN_LIGHT_SKIN_TONE = "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fb" -COUPLE_WITH_HEART_WOMAN_WOMAN_LIGHT_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +COUPLE_WITH_HEART_WOMAN_WOMAN_LIGHT_SKIN_TONE = ( + "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fb" +) +COUPLE_WITH_HEART_WOMAN_WOMAN_LIGHT_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fc" -COUPLE_WITH_HEART_WOMAN_WOMAN_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ +) +COUPLE_WITH_HEART_WOMAN_WOMAN_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fd" -COUPLE_WITH_HEART_WOMAN_WOMAN_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +COUPLE_WITH_HEART_WOMAN_WOMAN_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fe" -COUPLE_WITH_HEART_WOMAN_WOMAN_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ +) +COUPLE_WITH_HEART_WOMAN_WOMAN_LIGHT_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3ff" -COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_LIGHT_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_LIGHT_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fb" -COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_LIGHT_SKIN_TONE = \ +) +COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fc" -COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = \ +) +COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fd" -COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_LIGHT_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fe" -COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_LIGHT_SKIN_TONE_DARK_SKIN_TONE = \ +) +COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_LIGHT_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fc\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3ff" -COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fb" -COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +) +COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fc" -COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_SKIN_TONE = "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fd" -COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_SKIN_TONE = ( + "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fd" +) +COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fe" -COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_SKIN_TONE_DARK_SKIN_TONE = \ +) +COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fd\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3ff" -COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_DARK_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fb" -COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +) +COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fc" -COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ +) +COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fd" -COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_DARK_SKIN_TONE = \ +) +COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fe" -COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_DARK_SKIN_TONE_DARK_SKIN_TONE = \ +) +COUPLE_WITH_HEART_WOMAN_WOMAN_MEDIUM_DARK_SKIN_TONE_DARK_SKIN_TONE = ( "\U0001f469\U0001f3fe\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3ff" -COUPLE_WITH_HEART_WOMAN_WOMAN_DARK_SKIN_TONE_LIGHT_SKIN_TONE = \ +) +COUPLE_WITH_HEART_WOMAN_WOMAN_DARK_SKIN_TONE_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fb" -COUPLE_WITH_HEART_WOMAN_WOMAN_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = \ +) +COUPLE_WITH_HEART_WOMAN_WOMAN_DARK_SKIN_TONE_MEDIUM_LIGHT_SKIN_TONE = ( "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fc" -COUPLE_WITH_HEART_WOMAN_WOMAN_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = \ +) +COUPLE_WITH_HEART_WOMAN_WOMAN_DARK_SKIN_TONE_MEDIUM_SKIN_TONE = ( "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fd" -COUPLE_WITH_HEART_WOMAN_WOMAN_DARK_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = \ +) +COUPLE_WITH_HEART_WOMAN_WOMAN_DARK_SKIN_TONE_MEDIUM_DARK_SKIN_TONE = ( "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3fe" -COUPLE_WITH_HEART_WOMAN_WOMAN_DARK_SKIN_TONE = "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3ff" +) +COUPLE_WITH_HEART_WOMAN_WOMAN_DARK_SKIN_TONE = ( + "\U0001f469\U0001f3ff\u200d\u2764\ufe0f\u200d\U0001f469\U0001f3ff" +) FAMILY = "\U0001f46a" FAMILY_MAN_WOMAN_BOY = "\U0001f468\u200d\U0001f469\u200d\U0001f466" FAMILY_MAN_WOMAN_GIRL = "\U0001f468\u200d\U0001f469\u200d\U0001f467" FAMILY_MAN_WOMAN_GIRL_BOY = "\U0001f468\u200d\U0001f469\u200d\U0001f467\u200d\U0001f466" FAMILY_MAN_WOMAN_BOY_BOY = "\U0001f468\u200d\U0001f469\u200d\U0001f466\u200d\U0001f466" -FAMILY_MAN_WOMAN_GIRL_GIRL = "\U0001f468\u200d\U0001f469\u200d\U0001f467\u200d\U0001f467" +FAMILY_MAN_WOMAN_GIRL_GIRL = ( + "\U0001f468\u200d\U0001f469\u200d\U0001f467\u200d\U0001f467" +) FAMILY_MAN_MAN_BOY = "\U0001f468\u200d\U0001f468\u200d\U0001f466" FAMILY_MAN_MAN_GIRL = "\U0001f468\u200d\U0001f468\u200d\U0001f467" FAMILY_MAN_MAN_GIRL_BOY = "\U0001f468\u200d\U0001f468\u200d\U0001f467\u200d\U0001f466" @@ -2528,9 +2921,15 @@ FAMILY_MAN_MAN_GIRL_GIRL = "\U0001f468\u200d\U0001f468\u200d\U0001f467\u200d\U0001f467" FAMILY_WOMAN_WOMAN_BOY = "\U0001f469\u200d\U0001f469\u200d\U0001f466" FAMILY_WOMAN_WOMAN_GIRL = "\U0001f469\u200d\U0001f469\u200d\U0001f467" -FAMILY_WOMAN_WOMAN_GIRL_BOY = "\U0001f469\u200d\U0001f469\u200d\U0001f467\u200d\U0001f466" -FAMILY_WOMAN_WOMAN_BOY_BOY = "\U0001f469\u200d\U0001f469\u200d\U0001f466\u200d\U0001f466" -FAMILY_WOMAN_WOMAN_GIRL_GIRL = "\U0001f469\u200d\U0001f469\u200d\U0001f467\u200d\U0001f467" +FAMILY_WOMAN_WOMAN_GIRL_BOY = ( + "\U0001f469\u200d\U0001f469\u200d\U0001f467\u200d\U0001f466" +) +FAMILY_WOMAN_WOMAN_BOY_BOY = ( + "\U0001f469\u200d\U0001f469\u200d\U0001f466\u200d\U0001f466" +) +FAMILY_WOMAN_WOMAN_GIRL_GIRL = ( + "\U0001f469\u200d\U0001f469\u200d\U0001f467\u200d\U0001f467" +) FAMILY_MAN_BOY = "\U0001f468\u200d\U0001f466" FAMILY_MAN_BOY_BOY = "\U0001f468\u200d\U0001f466\u200d\U0001f466" FAMILY_MAN_GIRL = "\U0001f468\u200d\U0001f467" diff --git a/pyrogram/enums/__init__.py b/pyrogram/enums/__init__.py index 15eadf275..fc738bd21 100644 --- a/pyrogram/enums/__init__.py +++ b/pyrogram/enums/__init__.py @@ -38,24 +38,24 @@ from .user_status import UserStatus __all__ = [ - 'ChatAction', - 'ChatEventAction', - 'ChatMemberStatus', - 'ChatMembersFilter', - 'ChatType', - 'ListenerTypes', - 'MessageEntityType', - 'MessageMediaType', - 'MessageServiceType', - 'MessagesFilter', - 'NextCodeType', - 'ParseMode', - 'PollType', - 'ProfileColor', - 'ReactionType', - 'ReplyColor', - 'SentCodeType', + "ChatAction", + "ChatEventAction", + "ChatMemberStatus", + "ChatMembersFilter", + "ChatType", + "ListenerTypes", + "MessageEntityType", + "MessageMediaType", + "MessageServiceType", + "MessagesFilter", + "NextCodeType", + "ParseMode", + "PollType", + "ProfileColor", + "ReactionType", + "ReplyColor", + "SentCodeType", "StoriesPrivacyRules", "StoryPrivacy", - 'UserStatus' + "UserStatus", ] diff --git a/pyrogram/enums/profile_color.py b/pyrogram/enums/profile_color.py index b86c42b17..13c78c277 100644 --- a/pyrogram/enums/profile_color.py +++ b/pyrogram/enums/profile_color.py @@ -69,4 +69,4 @@ class ProfileColor(AutoName): "Pink color with light pink gradient." GRAY_LIGHT_GRAY = 15 - "Gray color with light gray gradient." \ No newline at end of file + "Gray color with light gray gradient." diff --git a/pyrogram/enums/reaction_type.py b/pyrogram/enums/reaction_type.py index 829de1ecd..0eea73003 100644 --- a/pyrogram/enums/reaction_type.py +++ b/pyrogram/enums/reaction_type.py @@ -22,6 +22,7 @@ class ReactionType(AutoName): """Reaction type enumeration used in :obj:`~pyrogram.types.ReactionType`.""" + EMOJI = auto() """Emoji reaction type.""" diff --git a/pyrogram/enums/reply_color.py b/pyrogram/enums/reply_color.py index 428297f63..64ae49a82 100644 --- a/pyrogram/enums/reply_color.py +++ b/pyrogram/enums/reply_color.py @@ -91,4 +91,4 @@ class ReplyColor(AutoName): For now: Red - If you use Telegram desktop. Blue - If you are using Telegram android/ios. - """ \ No newline at end of file + """ diff --git a/pyrogram/errors/__init__.py b/pyrogram/errors/__init__.py index c084f877d..7dd8ba8dc 100644 --- a/pyrogram/errors/__init__.py +++ b/pyrogram/errors/__init__.py @@ -26,7 +26,7 @@ class BadMsgNotification(Exception): 16: "The msg_id is too low, the client time has to be synchronized.", 17: "The msg_id is too high, the client time has to be synchronized.", 18: "Incorrect two lower order of the msg_id bits, the server expects the client message " - "msg_id to be divisible by 4.", + "msg_id to be divisible by 4.", 19: "The container msg_id is the same as the msg_id of a previously received message.", 20: "The message is too old, it cannot be verified by the server.", 32: "The msg_seqno is too low.", @@ -34,7 +34,7 @@ class BadMsgNotification(Exception): 34: "An even msg_seqno was expected, but an odd one was received.", 35: "An odd msg_seqno was expected, but an even one was received.", 48: "Incorrect server salt.", - 64: "Invalid container." + 64: "Invalid container.", } def __init__(self, code): @@ -56,11 +56,15 @@ class SecurityCheckMismatch(SecurityError): """Raised when a security check mismatch occurs.""" def __init__(self, msg: str = None): - super().__init__("A security check mismatch has occurred." if msg is None else msg) + super().__init__( + "A security check mismatch has occurred." if msg is None else msg + ) class CDNFileHashMismatch(SecurityError): """Raised when a CDN file hash mismatch occurs.""" def __init__(self, msg: str = None): - super().__init__("A CDN file hash mismatch has occurred." if msg is None else msg) + super().__init__( + "A CDN file hash mismatch has occurred." if msg is None else msg + ) diff --git a/pyrogram/errors/pyromod/__init__.py b/pyrogram/errors/pyromod/__init__.py index 4f3fdfae2..00921aa28 100644 --- a/pyrogram/errors/pyromod/__init__.py +++ b/pyrogram/errors/pyromod/__init__.py @@ -1,4 +1,4 @@ from .listener_stopped import ListenerStopped from .listener_timeout import ListenerTimeout -__all__ = ["ListenerStopped", "ListenerTimeout"] \ No newline at end of file +__all__ = ["ListenerStopped", "ListenerTimeout"] diff --git a/pyrogram/errors/pyromod/listener_stopped.py b/pyrogram/errors/pyromod/listener_stopped.py index fa939e04d..05a1016e2 100644 --- a/pyrogram/errors/pyromod/listener_stopped.py +++ b/pyrogram/errors/pyromod/listener_stopped.py @@ -1,2 +1,2 @@ class ListenerStopped(Exception): - pass \ No newline at end of file + pass diff --git a/pyrogram/errors/pyromod/listener_timeout.py b/pyrogram/errors/pyromod/listener_timeout.py index 1a97e68ce..9c2accd11 100644 --- a/pyrogram/errors/pyromod/listener_timeout.py +++ b/pyrogram/errors/pyromod/listener_timeout.py @@ -1,2 +1,2 @@ class ListenerTimeout(Exception): - pass \ No newline at end of file + pass diff --git a/pyrogram/errors/rpc_error.py b/pyrogram/errors/rpc_error.py index 63375f199..90befc679 100644 --- a/pyrogram/errors/rpc_error.py +++ b/pyrogram/errors/rpc_error.py @@ -37,15 +37,17 @@ def __init__( value: Union[int, str, raw.types.RpcError] = None, rpc_name: str = None, is_unknown: bool = False, - is_signed: bool = False + is_signed: bool = False, ): - super().__init__("Telegram says: [{}{} {}] - {} {}".format( - "-" if is_signed else "", - self.CODE, - self.ID or self.NAME, - self.MESSAGE.format(value=value), - f'(caused by "{rpc_name}")' if rpc_name else "" - )) + super().__init__( + "Telegram says: [{}{} {}] - {} {}".format( + "-" if is_signed else "", + self.CODE, + self.ID or self.NAME, + self.MESSAGE.format(value=value), + f'(caused by "{rpc_name}")' if rpc_name else "", + ) + ) try: self.value = int(value) @@ -71,30 +73,27 @@ def raise_it(rpc_error: "raw.types.RpcError", rpc_type: Type[TLObject]): value=f"[{error_code} {error_message}]", rpc_name=rpc_name, is_unknown=True, - is_signed=is_signed + is_signed=is_signed, ) error_id = re.sub(r"_\d+", "_X", error_message) if error_id not in exceptions[error_code]: raise getattr( - import_module("pyrogram.errors"), - exceptions[error_code]["_"] - )(value=f"[{error_code} {error_message}]", - rpc_name=rpc_name, - is_unknown=True, - is_signed=is_signed) + import_module("pyrogram.errors"), exceptions[error_code]["_"] + )( + value=f"[{error_code} {error_message}]", + rpc_name=rpc_name, + is_unknown=True, + is_signed=is_signed, + ) value = re.search(r"_(\d+)", error_message) value = value.group(1) if value is not None else value raise getattr( - import_module("pyrogram.errors"), - exceptions[error_code][error_id] - )(value=value, - rpc_name=rpc_name, - is_unknown=False, - is_signed=is_signed) + import_module("pyrogram.errors"), exceptions[error_code][error_id] + )(value=value, rpc_name=rpc_name, is_unknown=False, is_signed=is_signed) class UnknownError(RPCError): diff --git a/pyrogram/file_id.py b/pyrogram/file_id.py index 1a54a49d6..0c0e2d06f 100644 --- a/pyrogram/file_id.py +++ b/pyrogram/file_id.py @@ -112,6 +112,7 @@ def rle_decode(s: bytes) -> bytes: class FileType(IntEnum): """Known file types""" + THUMBNAIL = 0 CHAT_PHOTO = 1 # ProfilePhoto PHOTO = 2 @@ -134,6 +135,7 @@ class FileType(IntEnum): class ThumbnailSource(IntEnum): """Known thumbnail sources""" + LEGACY = 0 THUMBNAIL = 1 CHAT_PHOTO_SMALL = 2 # DialogPhotoSmall @@ -142,8 +144,13 @@ class ThumbnailSource(IntEnum): # Photo-like file ids are longer and contain extra info, the rest are all documents -PHOTO_TYPES = {FileType.THUMBNAIL, FileType.CHAT_PHOTO, FileType.PHOTO, FileType.WALLPAPER, - FileType.ENCRYPTED_THUMBNAIL} +PHOTO_TYPES = { + FileType.THUMBNAIL, + FileType.CHAT_PHOTO, + FileType.PHOTO, + FileType.WALLPAPER, + FileType.ENCRYPTED_THUMBNAIL, +} DOCUMENT_TYPES = set(FileType) - PHOTO_TYPES # Since the file type values are small enough to fit them in few bits, Telegram thought it would be a good idea to @@ -157,7 +164,8 @@ class FileId: MINOR = 30 def __init__( - self, *, + self, + *, major: int = MAJOR, minor: int = MINOR, file_type: FileType, @@ -175,7 +183,7 @@ def __init__( chat_id: int = None, chat_access_hash: int = None, sticker_set_id: int = None, - sticker_set_access_hash: int = None + sticker_set_access_hash: int = None, ): self.major = major self.minor = minor @@ -231,7 +239,7 @@ def decode(file_id: str): if has_web_location: url = String.read(buffer) - access_hash, = struct.unpack(" Filter: Parameters: func (``Callable``): A function that accepts three positional arguments *(filter, client, update)* and returns a boolean: True if the - update should be handled, False otherwise. - The *filter* argument refers to the filter itself and can be used to access keyword arguments (read below). + update should be handled, False otherwise. + The *filter* argument refers to the filter itself and can be used to access keyword arguments (read below). The *client* argument refers to the :obj:`~pyrogram.Client` that received the update. - The *update* argument type will vary depending on which `Handler `_ is coming from. + The *update* argument type will vary depending on which `Handler `_ is coming from. For example, in a :obj:`~pyrogram.handlers.MessageHandler` the *update* argument will be a :obj:`~pyrogram.types.Message`; in a :obj:`~pyrogram.handlers.CallbackQueryHandler` the *update* will be a :obj:`~pyrogram.types.CallbackQuery`. Your function body can then access the incoming update attributes and decide whether to allow it or not. @@ -155,7 +145,7 @@ def create(func: Callable, name: str = None, **kwargs) -> Filter: return type( name or func.__name__ or CUSTOM_FILTER_NAME, (Filter,), - {"__call__": func, **kwargs} + {"__call__": func, **kwargs}, )() @@ -469,7 +459,9 @@ async def private_filter(_, __, m: Message): # region group_filter async def group_filter(_, __, m: Message): - return bool(m.chat and m.chat.type in {enums.ChatType.GROUP, enums.ChatType.SUPERGROUP}) + return bool( + m.chat and m.chat.type in {enums.ChatType.GROUP, enums.ChatType.SUPERGROUP} + ) group = create(group_filter) @@ -767,6 +759,7 @@ async def linked_channel_filter(_, __, m: Message): async def forum_topic_closed_filter(_, __, m: Message): return bool(m.forum_topic_closed) + forum_topic_closed = create(forum_topic_closed_filter) """Filter service message for closed forum topics""" @@ -777,6 +770,7 @@ async def forum_topic_closed_filter(_, __, m: Message): async def forum_topic_created_filter(_, __, m: Message): return bool(m.forum_topic_created) + forum_topic_created = create(forum_topic_created_filter) """Filter service message for created forum topics""" @@ -787,6 +781,7 @@ async def forum_topic_created_filter(_, __, m: Message): async def forum_topic_edited_filter(_, __, m: Message): return bool(m.forum_topic_edited) + forum_topic_edited = create(forum_topic_edited_filter) """Filter service message for edited forum topics""" @@ -798,6 +793,7 @@ async def forum_topic_edited_filter(_, __, m: Message): async def forum_topic_reopened_filter(_, __, m: Message): return bool(m.forum_topic_reopened) + forum_topic_reopened = create(forum_topic_reopened_filter) """Filter service message for reopened forum topics""" @@ -808,6 +804,7 @@ async def forum_topic_reopened_filter(_, __, m: Message): async def general_topic_hidden_filter(_, __, m: Message): return bool(m.general_topic_hidden) + general_forum_topic_hidden = create(general_topic_hidden_filter) """Filter service message for hidden general forum topics""" @@ -819,6 +816,7 @@ async def general_topic_hidden_filter(_, __, m: Message): async def general_topic_unhidden_filter(_, __, m: Message): return bool(m.general_topic_unhidden) + general_forum_topic_unhidden = create(general_topic_unhidden_filter) """Filter service message for unhidden general forum topics""" @@ -826,7 +824,11 @@ async def general_topic_unhidden_filter(_, __, m: Message): # endregion # region command_filter -def command(commands: Union[str, List[str]], prefixes: Union[str, List[str]] = "/", case_sensitive: bool = False): +def command( + commands: Union[str, List[str]], + prefixes: Union[str, List[str]] = "/", + case_sensitive: bool = False, +): """Filter commands, i.e.: text messages starting with "/" or any other custom prefix. Parameters: @@ -859,15 +861,23 @@ async def func(flt, client: pyrogram.Client, message: Message): if not text.startswith(prefix): continue - without_prefix = text[len(prefix):] + without_prefix = text[len(prefix) :] for cmd in flt.commands: - if not re.match(rf"^(?:{cmd}(?:@?{username})?)(?:\s|$)", without_prefix, - flags=re.IGNORECASE if not flt.case_sensitive else 0): + if not re.match( + rf"^(?:{cmd}(?:@?{username})?)(?:\s|$)", + without_prefix, + flags=re.IGNORECASE if not flt.case_sensitive else 0, + ): continue - without_command = re.sub(rf"{cmd}(?:@?{username})?\s?", "", without_prefix, count=1, - flags=re.IGNORECASE if not flt.case_sensitive else 0) + without_command = re.sub( + rf"{cmd}(?:@?{username})?\s?", + "", + without_prefix, + count=1, + flags=re.IGNORECASE if not flt.case_sensitive else 0, + ) # match.groups are 1-indexed, group(1) is the quote, group(2) is the text # between the quotes, group(3) is unquoted, whitespace-split text @@ -894,12 +904,13 @@ async def func(flt, client: pyrogram.Client, message: Message): "CommandFilter", commands=commands, prefixes=prefixes, - case_sensitive=case_sensitive + case_sensitive=case_sensitive, ) # endregion + def regex(pattern: Union[str, Pattern], flags: int = 0): """Filter updates that match a given regular expression pattern. @@ -938,7 +949,7 @@ async def func(flt, _, update: Update): return create( func, "RegexFilter", - p=pattern if isinstance(pattern, Pattern) else re.compile(pattern, flags) + p=pattern if isinstance(pattern, Pattern) else re.compile(pattern, flags), ) @@ -960,18 +971,23 @@ def __init__(self, users: Union[int, str, List[Union[int, str]]] = None): users = [] if users is None else users if isinstance(users, list) else [users] super().__init__( - "me" if u in ["me", "self"] - else u.lower().strip("@") if isinstance(u, str) - else u for u in users + "me" + if u in ["me", "self"] + else u.lower().strip("@") + if isinstance(u, str) + else u + for u in users ) async def __call__(self, _, message: Message): - return (message.from_user - and (message.from_user.id in self - or (message.from_user.username - and message.from_user.username.lower() in self) - or ("me" in self - and message.from_user.is_self))) + return message.from_user and ( + message.from_user.id in self + or ( + message.from_user.username + and message.from_user.username.lower() in self + ) + or ("me" in self and message.from_user.is_self) + ) # noinspection PyPep8Naming @@ -992,38 +1008,43 @@ def __init__(self, chats: Union[int, str, List[Union[int, str]]] = None): chats = [] if chats is None else chats if isinstance(chats, list) else [chats] super().__init__( - "me" if c in ["me", "self"] - else c.lower().strip("@") if isinstance(c, str) - else c for c in chats + "me" + if c in ["me", "self"] + else c.lower().strip("@") + if isinstance(c, str) + else c + for c in chats ) async def __call__(self, _, message: Union[Message, Story]): if isinstance(message, Story): return ( - message.sender_chat - and ( - message.sender_chat.id in self - or ( - message.sender_chat.username - and message.sender_chat.username.lower() in self - ) + message.sender_chat + and ( + message.sender_chat.id in self + or ( + message.sender_chat.username + and message.sender_chat.username.lower() in self ) - ) or ( - message.from_user - and ( - message.from_user.id in self - or ( - message.from_user.username - and message.from_user.username.lower() in self - ) + ) + ) or ( + message.from_user + and ( + message.from_user.id in self + or ( + message.from_user.username + and message.from_user.username.lower() in self ) ) + ) else: - return (message.chat - and (message.chat.id in self - or (message.chat.username - and message.chat.username.lower() in self) - or ("me" in self - and message.from_user - and message.from_user.is_self - and not message.outgoing))) + return message.chat and ( + message.chat.id in self + or (message.chat.username and message.chat.username.lower() in self) + or ( + "me" in self + and message.from_user + and message.from_user.is_self + and not message.outgoing + ) + ) diff --git a/pyrogram/handlers/__init__.py b/pyrogram/handlers/__init__.py index ab9186680..5e0840454 100644 --- a/pyrogram/handlers/__init__.py +++ b/pyrogram/handlers/__init__.py @@ -32,4 +32,4 @@ from .user_status_handler import UserStatusHandler from .story_handler import StoryHandler from .message_reaction_updated_handler import MessageReactionUpdatedHandler -from .message_reaction_count_updated_handler import MessageReactionCountUpdatedHandler \ No newline at end of file +from .message_reaction_count_updated_handler import MessageReactionCountUpdatedHandler diff --git a/pyrogram/handlers/conversation_handler.py b/pyrogram/handlers/conversation_handler.py index 03de1e84d..790d62245 100644 --- a/pyrogram/handlers/conversation_handler.py +++ b/pyrogram/handlers/conversation_handler.py @@ -27,36 +27,45 @@ class ConversationHandler(MessageHandler, CallbackQueryHandler): """The Conversation handler class.""" + def __init__(self): self.waiters = {} - async def check(self, client: "pyrogram.Client", update: Union[Message, CallbackQuery]): + async def check( + self, client: "pyrogram.Client", update: Union[Message, CallbackQuery] + ): if isinstance(update, Message) and update.outgoing: return False try: - chat_id = update.chat.id if isinstance(update, Message) else update.message.chat.id + chat_id = ( + update.chat.id + if isinstance(update, Message) + else update.message.chat.id + ) except AttributeError: return False waiter = self.waiters.get(chat_id) - if not waiter or not isinstance(update, waiter['update_type']) or waiter['future'].done(): + if ( + not waiter + or not isinstance(update, waiter["update_type"]) + or waiter["future"].done() + ): return False - filters = waiter.get('filters') + filters = waiter.get("filters") if callable(filters): if inspect.iscoroutinefunction(filters.__call__): filtered = await filters(client, update) else: filtered = await client.loop.run_in_executor( - client.executor, - filters, - client, update + client.executor, filters, client, update ) - if not filtered or waiter['future'].done(): + if not filtered or waiter["future"].done(): return False - waiter['future'].set_result(update) + waiter["future"].set_result(update) return True @staticmethod @@ -64,5 +73,5 @@ async def callback(_, __): pass def delete_waiter(self, chat_id, future): - if future == self.waiters[chat_id]['future']: - del self.waiters[chat_id] \ No newline at end of file + if future == self.waiters[chat_id]["future"]: + del self.waiters[chat_id] diff --git a/pyrogram/handlers/handler.py b/pyrogram/handlers/handler.py index c666d042e..ca9d64f01 100644 --- a/pyrogram/handlers/handler.py +++ b/pyrogram/handlers/handler.py @@ -35,9 +35,7 @@ async def check(self, client: "pyrogram.Client", update: Update): return await self.filters(client, update) else: return await client.loop.run_in_executor( - client.executor, - self.filters, - client, update + client.executor, self.filters, client, update ) return True diff --git a/pyrogram/handlers/message_handler.py b/pyrogram/handlers/message_handler.py index 55739c632..bd693c62c 100644 --- a/pyrogram/handlers/message_handler.py +++ b/pyrogram/handlers/message_handler.py @@ -52,7 +52,9 @@ def __init__(self, callback: Callable, filters=None): self.original_callback = callback super().__init__(self.resolve_future_or_callback, filters) - async def check_if_has_matching_listener(self, client: "pyrogram.Client", message: Message): + async def check_if_has_matching_listener( + self, client: "pyrogram.Client", message: Message + ): """ Checks if the message has a matching listener. @@ -73,7 +75,9 @@ async def check_if_has_matching_listener(self, client: "pyrogram.Client", messag from_user_id=[from_user_id, from_user_username], ) - listener = client.get_listener_matching_with_data(data, pyrogram.enums.ListenerTypes.MESSAGE) + listener = client.get_listener_matching_with_data( + data, pyrogram.enums.ListenerTypes.MESSAGE + ) listener_does_match = False @@ -117,7 +121,9 @@ async def check(self, client: "pyrogram.Client", message: Message): # exists but its filters doesn't match return listener_does_match or handler_does_match - async def resolve_future_or_callback(self, client: "pyrogram.Client", message: Message, *args): + async def resolve_future_or_callback( + self, client: "pyrogram.Client", message: Message, *args + ): """ Resolves the future or calls the callback of the listener if the message has a matching listener. @@ -147,4 +153,4 @@ async def resolve_future_or_callback(self, client: "pyrogram.Client", message: M else: raise ValueError("Listener must have either a future or a callback") else: - await self.original_callback(client, message, *args) \ No newline at end of file + await self.original_callback(client, message, *args) diff --git a/pyrogram/handlers/message_reaction_count_updated_handler.py b/pyrogram/handlers/message_reaction_count_updated_handler.py index 74ab37a80..cf9fed92a 100644 --- a/pyrogram/handlers/message_reaction_count_updated_handler.py +++ b/pyrogram/handlers/message_reaction_count_updated_handler.py @@ -48,4 +48,4 @@ class MessageReactionCountUpdatedHandler(Handler): """ def __init__(self, callback: Callable, filters=None): - super().__init__(callback, filters) \ No newline at end of file + super().__init__(callback, filters) diff --git a/pyrogram/handlers/message_reaction_updated_handler.py b/pyrogram/handlers/message_reaction_updated_handler.py index ea86a6d79..245a03709 100644 --- a/pyrogram/handlers/message_reaction_updated_handler.py +++ b/pyrogram/handlers/message_reaction_updated_handler.py @@ -48,4 +48,4 @@ class MessageReactionUpdatedHandler(Handler): """ def __init__(self, callback: Callable, filters=None): - super().__init__(callback, filters) \ No newline at end of file + super().__init__(callback, filters) diff --git a/pyrogram/helpers/__init__.py b/pyrogram/helpers/__init__.py index 786d7e01e..cd2fdc533 100644 --- a/pyrogram/helpers/__init__.py +++ b/pyrogram/helpers/__init__.py @@ -13,4 +13,4 @@ You should have received a copy of the GNU General Public License along with pyromod. If not, see . """ -from .helpers import ikb, bki, ntb, btn, kb, kbtn, array_chunk, force_reply \ No newline at end of file +from .helpers import ikb, bki, ntb, btn, kb, kbtn, array_chunk, force_reply diff --git a/pyrogram/helpers/helpers.py b/pyrogram/helpers/helpers.py index 8aecc1700..3bbbd5e0c 100644 --- a/pyrogram/helpers/helpers.py +++ b/pyrogram/helpers/helpers.py @@ -135,4 +135,4 @@ def array_chunk(input_array, size): :param size: The size of each chunk. :return: List of chunks. """ - return [input_array[i: i + size] for i in range(0, len(input_array), size)] + return [input_array[i : i + size] for i in range(0, len(input_array), size)] diff --git a/pyrogram/methods/advanced/__init__.py b/pyrogram/methods/advanced/__init__.py index bf19658a3..8e30d3809 100644 --- a/pyrogram/methods/advanced/__init__.py +++ b/pyrogram/methods/advanced/__init__.py @@ -21,9 +21,5 @@ from .save_file import SaveFile -class Advanced( - Invoke, - ResolvePeer, - SaveFile -): +class Advanced(Invoke, ResolvePeer, SaveFile): pass diff --git a/pyrogram/methods/advanced/invoke.py b/pyrogram/methods/advanced/invoke.py index 0af771adc..8f3df2f85 100644 --- a/pyrogram/methods/advanced/invoke.py +++ b/pyrogram/methods/advanced/invoke.py @@ -32,7 +32,7 @@ async def invoke( query: TLObject, retries: int = Session.MAX_RETRIES, timeout: float = Session.WAIT_TIMEOUT, - sleep_threshold: float = None + sleep_threshold: float = None, ): """Invoke raw Telegram functions. @@ -74,13 +74,15 @@ async def invoke( query = raw.functions.InvokeWithoutUpdates(query=query) if self.takeout_id: - query = raw.functions.InvokeWithTakeout(takeout_id=self.takeout_id, query=query) + query = raw.functions.InvokeWithTakeout( + takeout_id=self.takeout_id, query=query + ) r = await self.session.invoke( - query, retries, timeout, - (sleep_threshold - if sleep_threshold is not None - else self.sleep_threshold) + query, + retries, + timeout, + (sleep_threshold if sleep_threshold is not None else self.sleep_threshold), ) await self.fetch_peers(getattr(r, "users", [])) diff --git a/pyrogram/methods/advanced/resolve_peer.py b/pyrogram/methods/advanced/resolve_peer.py index c92ec90d3..82c99f3a0 100644 --- a/pyrogram/methods/advanced/resolve_peer.py +++ b/pyrogram/methods/advanced/resolve_peer.py @@ -30,8 +30,7 @@ class ResolvePeer: async def resolve_peer( - self: "pyrogram.Client", - peer_id: Union[int, str] + self: "pyrogram.Client", peer_id: Union[int, str] ) -> Union[raw.base.InputPeer, raw.base.InputUser, raw.base.InputChannel]: """Get the InputPeer of a known peer id. Useful whenever an InputPeer type is required. @@ -75,9 +74,7 @@ async def resolve_peer( return await self.storage.get_peer_by_username(peer_id) except KeyError: await self.invoke( - raw.functions.contacts.ResolveUsername( - username=peer_id - ) + raw.functions.contacts.ResolveUsername(username=peer_id) ) return await self.storage.get_peer_by_username(peer_id) @@ -93,28 +90,18 @@ async def resolve_peer( await self.fetch_peers( await self.invoke( raw.functions.users.GetUsers( - id=[ - raw.types.InputUser( - user_id=peer_id, - access_hash=0 - ) - ] + id=[raw.types.InputUser(user_id=peer_id, access_hash=0)] ) ) ) elif peer_type == "chat": - await self.invoke( - raw.functions.messages.GetChats( - id=[-peer_id] - ) - ) + await self.invoke(raw.functions.messages.GetChats(id=[-peer_id])) else: await self.invoke( raw.functions.channels.GetChannels( id=[ raw.types.InputChannel( - channel_id=utils.get_channel_id(peer_id), - access_hash=0 + channel_id=utils.get_channel_id(peer_id), access_hash=0 ) ] ) diff --git a/pyrogram/methods/advanced/save_file.py b/pyrogram/methods/advanced/save_file.py index 2cbfeea82..01ee9d6aa 100644 --- a/pyrogram/methods/advanced/save_file.py +++ b/pyrogram/methods/advanced/save_file.py @@ -42,7 +42,7 @@ async def save_file( file_id: int = None, file_part: int = 0, progress: Callable = None, - progress_args: tuple = () + progress_args: tuple = (), ): """Upload a file onto Telegram servers, without actually sending the message to anyone. Useful whenever an InputFile type is required. @@ -117,7 +117,9 @@ async def worker(session): elif isinstance(path, io.IOBase): fp = path else: - raise ValueError("Invalid file. Expected a file path as string or a binary (not text) file pointer") + raise ValueError( + "Invalid file. Expected a file path as string or a binary (not text) file pointer" + ) file_name = getattr(fp, "name", "file.jpg") @@ -131,7 +133,9 @@ async def worker(session): file_size_limit_mib = 4000 if self.me.is_premium else 2000 if file_size > file_size_limit_mib * 1024 * 1024: - raise ValueError(f"Can't upload files bigger than {file_size_limit_mib} MiB") + raise ValueError( + f"Can't upload files bigger than {file_size_limit_mib} MiB" + ) file_total_parts = int(math.ceil(file_size / part_size)) is_big = file_size > 10 * 1024 * 1024 @@ -144,11 +148,16 @@ async def worker(session): session = self.media_sessions.get(dc_id) if not session: session = self.media_sessions[dc_id] = Session( - self, dc_id, await self.storage.auth_key(), - await self.storage.test_mode(), is_media=True + self, + dc_id, + await self.storage.auth_key(), + await self.storage.test_mode(), + is_media=True, ) - workers = [self.loop.create_task(worker(session)) for _ in range(workers_count)] + workers = [ + self.loop.create_task(worker(session)) for _ in range(workers_count) + ] queue = asyncio.Queue(1) try: @@ -161,7 +170,9 @@ async def worker(session): if not chunk: if not is_big and not is_missing_part: - md5_sum = "".join([hex(i)[2:].zfill(2) for i in md5_sum.digest()]) + md5_sum = "".join( + [hex(i)[2:].zfill(2) for i in md5_sum.digest()] + ) break if is_big: @@ -169,13 +180,11 @@ async def worker(session): file_id=file_id, file_part=file_part, file_total_parts=file_total_parts, - bytes=chunk + bytes=chunk, ) else: rpc = raw.functions.upload.SaveFilePart( - file_id=file_id, - file_part=file_part, - bytes=chunk + file_id=file_id, file_part=file_part, bytes=chunk ) await queue.put(rpc) @@ -193,7 +202,7 @@ async def worker(session): progress, min(file_part * part_size, file_size), file_size, - *progress_args + *progress_args, ) if inspect.iscoroutinefunction(progress): @@ -210,14 +219,13 @@ async def worker(session): id=file_id, parts=file_total_parts, name=file_name, - ) else: return raw.types.InputFile( id=file_id, parts=file_total_parts, name=file_name, - md5_checksum=md5_sum + md5_checksum=md5_sum, ) finally: for _ in workers: diff --git a/pyrogram/methods/auth/__init__.py b/pyrogram/methods/auth/__init__.py index ce585648d..c17d036cf 100644 --- a/pyrogram/methods/auth/__init__.py +++ b/pyrogram/methods/auth/__init__.py @@ -48,6 +48,6 @@ class Auth( SignIn, SignInBot, SignUp, - Terminate + Terminate, ): pass diff --git a/pyrogram/methods/auth/accept_terms_of_service.py b/pyrogram/methods/auth/accept_terms_of_service.py index cc1fcf545..19d133106 100644 --- a/pyrogram/methods/auth/accept_terms_of_service.py +++ b/pyrogram/methods/auth/accept_terms_of_service.py @@ -22,8 +22,7 @@ class AcceptTermsOfService: async def accept_terms_of_service( - self: "pyrogram.Client", - terms_of_service_id: str + self: "pyrogram.Client", terms_of_service_id: str ) -> bool: """Accept the given terms of service. @@ -35,9 +34,7 @@ async def accept_terms_of_service( """ r = await self.invoke( raw.functions.help.AcceptTermsOfService( - id=raw.types.DataJSON( - data=terms_of_service_id - ) + id=raw.types.DataJSON(data=terms_of_service_id) ) ) diff --git a/pyrogram/methods/auth/check_password.py b/pyrogram/methods/auth/check_password.py index 39aa82fcc..8ef96839a 100644 --- a/pyrogram/methods/auth/check_password.py +++ b/pyrogram/methods/auth/check_password.py @@ -27,10 +27,7 @@ class CheckPassword: - async def check_password( - self: "pyrogram.Client", - password: str - ) -> "types.User": + async def check_password(self: "pyrogram.Client", password: str) -> "types.User": """Check your Two-Step Verification password and log in. .. include:: /_includes/usable-by/users.rst @@ -48,8 +45,7 @@ async def check_password( r = await self.invoke( raw.functions.auth.CheckPassword( password=compute_password_check( - await self.invoke(raw.functions.account.GetPassword()), - password + await self.invoke(raw.functions.account.GetPassword()), password ) ) ) diff --git a/pyrogram/methods/auth/connect.py b/pyrogram/methods/auth/connect.py index 612e064bb..73f3b7448 100644 --- a/pyrogram/methods/auth/connect.py +++ b/pyrogram/methods/auth/connect.py @@ -40,8 +40,10 @@ async def connect( await self.load_session() self.session = Session( - self, await self.storage.dc_id(), - await self.storage.auth_key(), await self.storage.test_mode() + self, + await self.storage.dc_id(), + await self.storage.auth_key(), + await self.storage.test_mode(), ) await self.session.start() diff --git a/pyrogram/methods/auth/recover_password.py b/pyrogram/methods/auth/recover_password.py index 0a3475075..a823196ce 100644 --- a/pyrogram/methods/auth/recover_password.py +++ b/pyrogram/methods/auth/recover_password.py @@ -27,8 +27,7 @@ class RecoverPassword: async def recover_password( - self: "pyrogram.Client", - recovery_code: str + self: "pyrogram.Client", recovery_code: str ) -> "types.User": """Recover your password with a recovery code and log in. @@ -45,11 +44,7 @@ async def recover_password( Raises: BadRequest: In case the recovery code is invalid. """ - r = await self.invoke( - raw.functions.auth.RecoverPassword( - code=recovery_code - ) - ) + r = await self.invoke(raw.functions.auth.RecoverPassword(code=recovery_code)) await self.storage.user_id(r.user.id) await self.storage.is_bot(False) diff --git a/pyrogram/methods/auth/resend_code.py b/pyrogram/methods/auth/resend_code.py index 9644ac4f5..464e9a2a0 100644 --- a/pyrogram/methods/auth/resend_code.py +++ b/pyrogram/methods/auth/resend_code.py @@ -27,9 +27,7 @@ class ResendCode: async def resend_code( - self: "pyrogram.Client", - phone_number: str, - phone_code_hash: str + self: "pyrogram.Client", phone_number: str, phone_code_hash: str ) -> "types.SentCode": """Re-send the confirmation code using a different type. @@ -56,8 +54,7 @@ async def resend_code( r = await self.invoke( raw.functions.auth.ResendCode( - phone_number=phone_number, - phone_code_hash=phone_code_hash + phone_number=phone_number, phone_code_hash=phone_code_hash ) ) diff --git a/pyrogram/methods/auth/send_code.py b/pyrogram/methods/auth/send_code.py index 92ffc9999..de5cd1745 100644 --- a/pyrogram/methods/auth/send_code.py +++ b/pyrogram/methods/auth/send_code.py @@ -28,10 +28,7 @@ class SendCode: - async def send_code( - self: "pyrogram.Client", - phone_number: str - ) -> "types.SentCode": + async def send_code(self: "pyrogram.Client", phone_number: str) -> "types.SentCode": """Send the confirmation code to the given phone number. .. include:: /_includes/usable-by/users.rst @@ -56,7 +53,7 @@ async def send_code( phone_number=phone_number, api_id=self.api_id, api_hash=self.api_hash, - settings=raw.types.CodeSettings() + settings=raw.types.CodeSettings(), ) ) except (PhoneMigrate, NetworkMigrate) as e: @@ -65,13 +62,14 @@ async def send_code( await self.storage.dc_id(e.value) await self.storage.auth_key( await Auth( - self, await self.storage.dc_id(), - await self.storage.test_mode() + self, await self.storage.dc_id(), await self.storage.test_mode() ).create() ) self.session = Session( - self, await self.storage.dc_id(), - await self.storage.auth_key(), await self.storage.test_mode() + self, + await self.storage.dc_id(), + await self.storage.auth_key(), + await self.storage.test_mode(), ) await self.session.start() diff --git a/pyrogram/methods/auth/send_recovery_code.py b/pyrogram/methods/auth/send_recovery_code.py index 9a25f3c68..15f3ef2d8 100644 --- a/pyrogram/methods/auth/send_recovery_code.py +++ b/pyrogram/methods/auth/send_recovery_code.py @@ -38,6 +38,6 @@ async def send_recovery_code( Raises: BadRequest: In case no recovery email was set up. """ - return (await self.invoke( - raw.functions.auth.RequestPasswordRecovery() - )).email_pattern + return ( + await self.invoke(raw.functions.auth.RequestPasswordRecovery()) + ).email_pattern diff --git a/pyrogram/methods/auth/sign_in.py b/pyrogram/methods/auth/sign_in.py index 9d77f1cd3..f7ac815be 100644 --- a/pyrogram/methods/auth/sign_in.py +++ b/pyrogram/methods/auth/sign_in.py @@ -31,7 +31,7 @@ async def sign_in( self: "pyrogram.Client", phone_number: str, phone_code_hash: str, - phone_code: str + phone_code: str, ) -> Union["types.User", "types.TermsOfService", bool]: """Authorize a user in Telegram with a valid confirmation code. @@ -64,7 +64,7 @@ async def sign_in( raw.functions.auth.SignIn( phone_number=phone_number, phone_code_hash=phone_code_hash, - phone_code=phone_code + phone_code=phone_code, ) ) diff --git a/pyrogram/methods/auth/sign_in_bot.py b/pyrogram/methods/auth/sign_in_bot.py index 09a2f2837..52ca6b7b9 100644 --- a/pyrogram/methods/auth/sign_in_bot.py +++ b/pyrogram/methods/auth/sign_in_bot.py @@ -28,10 +28,7 @@ class SignInBot: - async def sign_in_bot( - self: "pyrogram.Client", - bot_token: str - ) -> "types.User": + async def sign_in_bot(self: "pyrogram.Client", bot_token: str) -> "types.User": """Authorize a bot using its bot token generated by BotFather. .. include:: /_includes/usable-by/bots.rst @@ -53,7 +50,7 @@ async def sign_in_bot( flags=0, api_id=self.api_id, api_hash=self.api_hash, - bot_auth_token=bot_token + bot_auth_token=bot_token, ) ) except UserMigrate as e: @@ -62,13 +59,14 @@ async def sign_in_bot( await self.storage.dc_id(e.value) await self.storage.auth_key( await Auth( - self, await self.storage.dc_id(), - await self.storage.test_mode() + self, await self.storage.dc_id(), await self.storage.test_mode() ).create() ) self.session = Session( - self, await self.storage.dc_id(), - await self.storage.auth_key(), await self.storage.test_mode() + self, + await self.storage.dc_id(), + await self.storage.auth_key(), + await self.storage.test_mode(), ) await self.session.start() diff --git a/pyrogram/methods/auth/sign_up.py b/pyrogram/methods/auth/sign_up.py index f09a779d8..2488446cd 100644 --- a/pyrogram/methods/auth/sign_up.py +++ b/pyrogram/methods/auth/sign_up.py @@ -31,7 +31,7 @@ async def sign_up( phone_number: str, phone_code_hash: str, first_name: str, - last_name: str = "" + last_name: str = "", ) -> "types.User": """Register a new user in Telegram. @@ -63,7 +63,7 @@ async def sign_up( phone_number=phone_number, first_name=first_name, last_name=last_name, - phone_code_hash=phone_code_hash + phone_code_hash=phone_code_hash, ) ) diff --git a/pyrogram/methods/bots/__init__.py b/pyrogram/methods/bots/__init__.py index 536125551..4bb3fec8c 100644 --- a/pyrogram/methods/bots/__init__.py +++ b/pyrogram/methods/bots/__init__.py @@ -54,6 +54,6 @@ class Bots( GetBotInfo, SetChatMenuButton, GetChatMenuButton, - AnswerWebAppQuery + AnswerWebAppQuery, ): pass diff --git a/pyrogram/methods/bots/answer_callback_query.py b/pyrogram/methods/bots/answer_callback_query.py index a6d8747cd..ac424b0e8 100644 --- a/pyrogram/methods/bots/answer_callback_query.py +++ b/pyrogram/methods/bots/answer_callback_query.py @@ -27,7 +27,7 @@ async def answer_callback_query( text: str = None, show_alert: bool = None, url: str = None, - cache_time: int = 0 + cache_time: int = 0, ): """Send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. @@ -76,6 +76,6 @@ async def answer_callback_query( cache_time=cache_time, alert=show_alert or None, message=text or None, - url=url or None + url=url or None, ) ) diff --git a/pyrogram/methods/bots/answer_inline_query.py b/pyrogram/methods/bots/answer_inline_query.py index c3a450a01..46a6bee8d 100644 --- a/pyrogram/methods/bots/answer_inline_query.py +++ b/pyrogram/methods/bots/answer_inline_query.py @@ -33,7 +33,7 @@ async def answer_inline_query( is_personal: bool = False, next_offset: str = "", switch_pm_text: str = "", - switch_pm_parameter: str = "" + switch_pm_parameter: str = "", ): """Send answers to an inline query. @@ -105,8 +105,9 @@ async def answer_inline_query( private=is_personal or None, next_offset=next_offset or None, switch_pm=raw.types.InlineBotSwitchPM( - text=switch_pm_text, - start_param=switch_pm_parameter - ) if switch_pm_text else None + text=switch_pm_text, start_param=switch_pm_parameter + ) + if switch_pm_text + else None, ) ) diff --git a/pyrogram/methods/bots/answer_web_app_query.py b/pyrogram/methods/bots/answer_web_app_query.py index 74f56079b..f93136734 100644 --- a/pyrogram/methods/bots/answer_web_app_query.py +++ b/pyrogram/methods/bots/answer_web_app_query.py @@ -25,7 +25,7 @@ class AnswerWebAppQuery: async def answer_web_app_query( self: "pyrogram.Client", web_app_query_id: str, - result: "types.InlineQueryResult" + result: "types.InlineQueryResult", ) -> "types.SentWebAppMessage": """Set the result of an interaction with a `Web App `_ and send a corresponding message on behalf of the user to the chat from which the query originated. @@ -45,8 +45,7 @@ async def answer_web_app_query( r = await self.invoke( raw.functions.messages.SendWebViewResultMessage( - bot_query_id=web_app_query_id, - result=await result.write(self) + bot_query_id=web_app_query_id, result=await result.write(self) ) ) diff --git a/pyrogram/methods/bots/get_bot_default_privileges.py b/pyrogram/methods/bots/get_bot_default_privileges.py index 217d9b438..d9d667921 100644 --- a/pyrogram/methods/bots/get_bot_default_privileges.py +++ b/pyrogram/methods/bots/get_bot_default_privileges.py @@ -25,8 +25,7 @@ class GetBotDefaultPrivileges: async def get_bot_default_privileges( - self: "pyrogram.Client", - for_channels: bool = None + self: "pyrogram.Client", for_channels: bool = None ) -> Optional["types.ChatPrivileges"]: """Get the current default privileges of the bot. @@ -47,12 +46,12 @@ async def get_bot_default_privileges( """ bot_info = await self.invoke( - raw.functions.users.GetFullUser( - id=raw.types.InputUserSelf() - ) + raw.functions.users.GetFullUser(id=raw.types.InputUserSelf()) ) - field = "bot_broadcast_admin_rights" if for_channels else "bot_group_admin_rights" + field = ( + "bot_broadcast_admin_rights" if for_channels else "bot_group_admin_rights" + ) admin_rights = getattr(bot_info.full_user, field) diff --git a/pyrogram/methods/bots/get_bot_info.py b/pyrogram/methods/bots/get_bot_info.py index dcb60de68..8fde322a8 100644 --- a/pyrogram/methods/bots/get_bot_info.py +++ b/pyrogram/methods/bots/get_bot_info.py @@ -24,9 +24,7 @@ class GetBotInfo: async def get_bot_info( - self: "pyrogram.Client", - lang_code: str, - bot: Union[int, str] = None + self: "pyrogram.Client", lang_code: str, bot: Union[int, str] = None ) -> pyrogram.types.BotInfo: """Get the bot info in given language. @@ -45,5 +43,7 @@ async def get_bot_info( peer = None if bot: peer = await self.resolve_peer(bot) - r = await self.invoke(raw.functions.bots.GetBotInfo(lang_code=lang_code, bot=peer)) + r = await self.invoke( + raw.functions.bots.GetBotInfo(lang_code=lang_code, bot=peer) + ) return pyrogram.types.BotInfo._parse(r) diff --git a/pyrogram/methods/bots/get_chat_menu_button.py b/pyrogram/methods/bots/get_chat_menu_button.py index 4f55abe09..c27be81b2 100644 --- a/pyrogram/methods/bots/get_chat_menu_button.py +++ b/pyrogram/methods/bots/get_chat_menu_button.py @@ -46,11 +46,11 @@ async def get_chat_menu_button( ) ) else: - r = (await self.invoke( - raw.functions.users.GetFullUser( - id=raw.types.InputUserSelf() + r = ( + await self.invoke( + raw.functions.users.GetFullUser(id=raw.types.InputUserSelf()) ) - )).full_user.bot_info.menu_button + ).full_user.bot_info.menu_button if isinstance(r, raw.types.BotMenuButtonCommands): return types.MenuButtonCommands() @@ -60,8 +60,5 @@ async def get_chat_menu_button( if isinstance(r, raw.types.BotMenuButton): return types.MenuButtonWebApp( - text=r.text, - web_app=types.WebAppInfo( - url=r.url - ) + text=r.text, web_app=types.WebAppInfo(url=r.url) ) diff --git a/pyrogram/methods/bots/get_game_high_scores.py b/pyrogram/methods/bots/get_game_high_scores.py index d8e21af4b..d50b425b6 100644 --- a/pyrogram/methods/bots/get_game_high_scores.py +++ b/pyrogram/methods/bots/get_game_high_scores.py @@ -28,7 +28,7 @@ async def get_game_high_scores( self: "pyrogram.Client", user_id: Union[int, str], chat_id: Union[int, str], - message_id: int = None + message_id: int = None, ) -> List["types.GameHighScore"]: """Get data for high score tables. @@ -66,8 +66,10 @@ async def get_game_high_scores( raw.functions.messages.GetGameHighScores( peer=await self.resolve_peer(chat_id), id=message_id, - user_id=await self.resolve_peer(user_id) + user_id=await self.resolve_peer(user_id), ) ) - return types.List(types.GameHighScore._parse(self, score, r.users) for score in r.scores) + return types.List( + types.GameHighScore._parse(self, score, r.users) for score in r.scores + ) diff --git a/pyrogram/methods/bots/get_inline_bot_results.py b/pyrogram/methods/bots/get_inline_bot_results.py index b6605bf9c..39bf0c3a4 100644 --- a/pyrogram/methods/bots/get_inline_bot_results.py +++ b/pyrogram/methods/bots/get_inline_bot_results.py @@ -30,7 +30,7 @@ async def get_inline_bot_results( query: str = "", offset: str = "", latitude: float = None, - longitude: float = None + longitude: float = None, ): """Get bot results via inline queries. You can then send a result using :meth:`~pyrogram.Client.send_inline_bot_result` @@ -79,10 +79,9 @@ async def get_inline_bot_results( peer=raw.types.InputPeerSelf(), query=query, offset=offset, - geo_point=raw.types.InputGeoPoint( - lat=latitude, - long=longitude - ) if (latitude is not None and longitude is not None) else None + geo_point=raw.types.InputGeoPoint(lat=latitude, long=longitude) + if (latitude is not None and longitude is not None) + else None, ) ) except UnknownError as e: diff --git a/pyrogram/methods/bots/request_callback_answer.py b/pyrogram/methods/bots/request_callback_answer.py index f18f25afd..035d97922 100644 --- a/pyrogram/methods/bots/request_callback_answer.py +++ b/pyrogram/methods/bots/request_callback_answer.py @@ -28,7 +28,7 @@ async def request_callback_answer( chat_id: Union[int, str], message_id: int, callback_data: Union[str, bytes], - timeout: int = 10 + timeout: int = 10, ): """Request a callback answer from bots. This is the equivalent of clicking an inline button containing callback data. @@ -65,14 +65,16 @@ async def request_callback_answer( """ # Telegram only wants bytes, but we are allowed to pass strings too. - data = bytes(callback_data, "utf-8") if isinstance(callback_data, str) else callback_data + data = ( + bytes(callback_data, "utf-8") + if isinstance(callback_data, str) + else callback_data + ) return await self.invoke( raw.functions.messages.GetBotCallbackAnswer( - peer=await self.resolve_peer(chat_id), - msg_id=message_id, - data=data + peer=await self.resolve_peer(chat_id), msg_id=message_id, data=data ), retries=0, - timeout=timeout + timeout=timeout, ) diff --git a/pyrogram/methods/bots/send_game.py b/pyrogram/methods/bots/send_game.py index 98e28ed1c..1e119ec54 100644 --- a/pyrogram/methods/bots/send_game.py +++ b/pyrogram/methods/bots/send_game.py @@ -37,8 +37,8 @@ async def send_game( "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None + "types.ForceReply", + ] = None, ) -> "types.Message": """Send a game. @@ -84,7 +84,7 @@ async def send_game( client=self, chat_id=chat_id, reply_to_message_id=reply_to_message_id, - message_thread_id=message_thread_id + message_thread_id=message_thread_id, ) r = await self.invoke( @@ -92,8 +92,7 @@ async def send_game( peer=await self.resolve_peer(chat_id), media=raw.types.InputMediaGame( id=raw.types.InputGameShortName( - bot_id=raw.types.InputUserSelf(), - short_name=game_short_name + bot_id=raw.types.InputUserSelf(), short_name=game_short_name ), ), message="", @@ -101,14 +100,17 @@ async def send_game( reply_to=reply_to, random_id=self.rnd_id(), noforwards=protect_content, - reply_markup=await reply_markup.write(self) if reply_markup else None + reply_markup=await reply_markup.write(self) if reply_markup else None, ) ) for i in r.updates: - if isinstance(i, (raw.types.UpdateNewMessage, raw.types.UpdateNewChannelMessage)): + if isinstance( + i, (raw.types.UpdateNewMessage, raw.types.UpdateNewChannelMessage) + ): return await types.Message._parse( - self, i.message, + self, + i.message, {i.id: i for i in r.users}, - {i.id: i for i in r.chats} + {i.id: i for i in r.chats}, ) diff --git a/pyrogram/methods/bots/send_inline_bot_result.py b/pyrogram/methods/bots/send_inline_bot_result.py index 3a11a7899..c84f2df39 100644 --- a/pyrogram/methods/bots/send_inline_bot_result.py +++ b/pyrogram/methods/bots/send_inline_bot_result.py @@ -34,7 +34,7 @@ async def send_inline_bot_result( reply_to_message_id: int = None, quote_text: str = None, quote_entities: List["types.MessageEntity"] = None, - parse_mode: Optional["enums.ParseMode"] = None + parse_mode: Optional["enums.ParseMode"] = None, ) -> "raw.base.Updates": """Send an inline bot result. Bot results can be retrieved using :meth:`~pyrogram.Client.get_inline_bot_results` @@ -86,7 +86,7 @@ async def send_inline_bot_result( await app.send_inline_bot_result(chat_id, query_id, result_id) """ - + reply_to = await utils.get_reply_to( client=self, chat_id=chat_id, @@ -94,7 +94,7 @@ async def send_inline_bot_result( message_thread_id=message_thread_id, quote_text=quote_text, quote_entities=quote_entities, - parse_mode=parse_mode + parse_mode=parse_mode, ) return await self.invoke( @@ -104,6 +104,6 @@ async def send_inline_bot_result( id=result_id, random_id=self.rnd_id(), silent=disable_notification or None, - reply_to=reply_to + reply_to=reply_to, ) ) diff --git a/pyrogram/methods/bots/set_bot_default_privileges.py b/pyrogram/methods/bots/set_bot_default_privileges.py index 2890ee1ae..b438e4ed9 100644 --- a/pyrogram/methods/bots/set_bot_default_privileges.py +++ b/pyrogram/methods/bots/set_bot_default_privileges.py @@ -25,7 +25,7 @@ class SetBotDefaultPrivileges: async def set_bot_default_privileges( self: "pyrogram.Client", privileges: "types.ChatPrivileges" = None, - for_channels: bool = None + for_channels: bool = None, ) -> bool: """Change the default privileges requested by the bot when it's added as an administrator to groups or channels. @@ -64,18 +64,22 @@ async def set_bot_default_privileges( else raw.functions.bots.SetBotGroupDefaultAdminRights ) - admin_rights = raw.types.ChatAdminRights( - change_info=privileges.can_change_info, - post_messages=privileges.can_post_messages, - edit_messages=privileges.can_edit_messages, - delete_messages=privileges.can_delete_messages, - ban_users=privileges.can_restrict_members, - invite_users=privileges.can_invite_users, - pin_messages=privileges.can_pin_messages, - add_admins=privileges.can_promote_members, - anonymous=privileges.is_anonymous, - manage_call=privileges.can_manage_video_chats, - other=privileges.can_manage_chat - ) if privileges else raw.types.ChatAdminRights() + admin_rights = ( + raw.types.ChatAdminRights( + change_info=privileges.can_change_info, + post_messages=privileges.can_post_messages, + edit_messages=privileges.can_edit_messages, + delete_messages=privileges.can_delete_messages, + ban_users=privileges.can_restrict_members, + invite_users=privileges.can_invite_users, + pin_messages=privileges.can_pin_messages, + add_admins=privileges.can_promote_members, + anonymous=privileges.is_anonymous, + manage_call=privileges.can_manage_video_chats, + other=privileges.can_manage_chat, + ) + if privileges + else raw.types.ChatAdminRights() + ) return await self.invoke(function(admin_rights=admin_rights)) diff --git a/pyrogram/methods/bots/set_bot_info.py b/pyrogram/methods/bots/set_bot_info.py index 7559a6b45..a16547143 100644 --- a/pyrogram/methods/bots/set_bot_info.py +++ b/pyrogram/methods/bots/set_bot_info.py @@ -29,7 +29,7 @@ async def set_bot_info( bot: Union[int, str] = None, name: str = None, about: str = None, - description: str = None + description: str = None, ) -> bool: """Get the bot info in given language. @@ -47,7 +47,7 @@ async def set_bot_info( name (``str``, *optional*): The bot name. - + about (``str``, *optional*): The bot bio. @@ -57,5 +57,13 @@ async def set_bot_info( peer = None if bot: peer = await self.resolve_peer(bot) - r = await self.invoke(raw.functions.bots.SetBotInfo(lang_code=lang_code, bot=peer, name=name, about=about, description=description)) + r = await self.invoke( + raw.functions.bots.SetBotInfo( + lang_code=lang_code, + bot=peer, + name=name, + about=about, + description=description, + ) + ) return bool(r) diff --git a/pyrogram/methods/bots/set_chat_menu_button.py b/pyrogram/methods/bots/set_chat_menu_button.py index fa5af85ce..12eeb0bac 100644 --- a/pyrogram/methods/bots/set_chat_menu_button.py +++ b/pyrogram/methods/bots/set_chat_menu_button.py @@ -27,7 +27,7 @@ class SetChatMenuButton: async def set_chat_menu_button( self: "pyrogram.Client", chat_id: Union[int, str] = None, - menu_button: "types.MenuButton" = None + menu_button: "types.MenuButton" = None, ) -> bool: """Change the bot's menu button in a private chat, or the default menu button. @@ -47,9 +47,10 @@ async def set_chat_menu_button( raw.functions.bots.SetBotMenuButton( user_id=await self.resolve_peer(chat_id or "me"), button=( - (await menu_button.write(self)) if menu_button + (await menu_button.write(self)) + if menu_button else (await types.MenuButtonDefault().write(self)) - ) + ), ) ) diff --git a/pyrogram/methods/bots/set_game_score.py b/pyrogram/methods/bots/set_game_score.py index 9703b3d14..87fc05efd 100644 --- a/pyrogram/methods/bots/set_game_score.py +++ b/pyrogram/methods/bots/set_game_score.py @@ -31,7 +31,7 @@ async def set_game_score( force: bool = None, disable_edit_message: bool = None, chat_id: Union[int, str] = None, - message_id: int = None + message_id: int = None, ) -> Union["types.Message", bool]: # inline_message_id: str = None): TODO Add inline_message_id """Set the score of the specified user in a game. @@ -85,17 +85,19 @@ async def set_game_score( id=message_id, user_id=await self.resolve_peer(user_id), force=force or None, - edit_message=not disable_edit_message or None + edit_message=not disable_edit_message or None, ) ) for i in r.updates: - if isinstance(i, (raw.types.UpdateEditMessage, - raw.types.UpdateEditChannelMessage)): + if isinstance( + i, (raw.types.UpdateEditMessage, raw.types.UpdateEditChannelMessage) + ): return await types.Message._parse( - self, i.message, + self, + i.message, {i.id: i for i in r.users}, - {i.id: i for i in r.chats} + {i.id: i for i in r.chats}, ) return True diff --git a/pyrogram/methods/chats/__init__.py b/pyrogram/methods/chats/__init__.py index a0619862e..cc198fc05 100644 --- a/pyrogram/methods/chats/__init__.py +++ b/pyrogram/methods/chats/__init__.py @@ -123,6 +123,6 @@ class Chats( GetSendAsChats, SetSendAsChat, SetChatProtectedContent, - UpdateColor + UpdateColor, ): pass diff --git a/pyrogram/methods/chats/add_chat_members.py b/pyrogram/methods/chats/add_chat_members.py index af9af1dfe..40fe3460d 100644 --- a/pyrogram/methods/chats/add_chat_members.py +++ b/pyrogram/methods/chats/add_chat_members.py @@ -27,7 +27,7 @@ async def add_chat_members( self: "pyrogram.Client", chat_id: Union[int, str], user_ids: Union[Union[int, str], List[Union[int, str]]], - forward_limit: int = 100 + forward_limit: int = 100, ) -> bool: """Add new chat members to a group, supergroup or channel @@ -74,17 +74,14 @@ async def add_chat_members( raw.functions.messages.AddChatUser( chat_id=peer.chat_id, user_id=await self.resolve_peer(user_id), - fwd_limit=forward_limit + fwd_limit=forward_limit, ) ) else: await self.invoke( raw.functions.channels.InviteToChannel( channel=peer, - users=[ - await self.resolve_peer(user_id) - for user_id in user_ids - ] + users=[await self.resolve_peer(user_id) for user_id in user_ids], ) ) diff --git a/pyrogram/methods/chats/archive_chats.py b/pyrogram/methods/chats/archive_chats.py index 010a65ac8..3d111a00d 100644 --- a/pyrogram/methods/chats/archive_chats.py +++ b/pyrogram/methods/chats/archive_chats.py @@ -58,15 +58,12 @@ async def archive_chats( for chat in chat_ids: folder_peers.append( raw.types.InputFolderPeer( - peer=await self.resolve_peer(chat), - folder_id=1 + peer=await self.resolve_peer(chat), folder_id=1 ) ) await self.invoke( - raw.functions.folders.EditPeerFolders( - folder_peers=folder_peers - ) + raw.functions.folders.EditPeerFolders(folder_peers=folder_peers) ) return True diff --git a/pyrogram/methods/chats/ban_chat_member.py b/pyrogram/methods/chats/ban_chat_member.py index afb0d1a29..e0f45b0bc 100644 --- a/pyrogram/methods/chats/ban_chat_member.py +++ b/pyrogram/methods/chats/ban_chat_member.py @@ -29,7 +29,7 @@ async def ban_chat_member( self: "pyrogram.Client", chat_id: Union[int, str], user_id: Union[int, str], - until_date: datetime = utils.zero_datetime() + until_date: datetime = utils.zero_datetime(), ) -> Union["types.Message", bool]: """Ban a user from a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the group on their own using @@ -92,23 +92,25 @@ async def ban_chat_member( send_inline=True, embed_links=True, manage_topics=True, - ) + ), ) ) else: r = await self.invoke( raw.functions.messages.DeleteChatUser( - chat_id=abs(chat_id), - user_id=user_peer + chat_id=abs(chat_id), user_id=user_peer ) ) for i in r.updates: - if isinstance(i, (raw.types.UpdateNewMessage, raw.types.UpdateNewChannelMessage)): + if isinstance( + i, (raw.types.UpdateNewMessage, raw.types.UpdateNewChannelMessage) + ): return await types.Message._parse( - self, i.message, + self, + i.message, {i.id: i for i in r.users}, - {i.id: i for i in r.chats} + {i.id: i for i in r.chats}, ) else: return True diff --git a/pyrogram/methods/chats/close_forum_topic.py b/pyrogram/methods/chats/close_forum_topic.py index fb4c537fe..1ffc155be 100644 --- a/pyrogram/methods/chats/close_forum_topic.py +++ b/pyrogram/methods/chats/close_forum_topic.py @@ -23,9 +23,7 @@ class CloseForumTopic: async def close_forum_topic( - self: "pyrogram.Client", - chat_id: Union[int, str], - topic_id: int + self: "pyrogram.Client", chat_id: Union[int, str], topic_id: int ) -> bool: """Close a forum topic. @@ -49,9 +47,7 @@ async def close_forum_topic( """ await self.invoke( raw.functions.channels.EditForumTopic( - channel=await self.resolve_peer(chat_id), - topic_id=topic_id, - closed=True + channel=await self.resolve_peer(chat_id), topic_id=topic_id, closed=True ) ) return True diff --git a/pyrogram/methods/chats/close_general_topic.py b/pyrogram/methods/chats/close_general_topic.py index 2f9156693..fab95ad5c 100644 --- a/pyrogram/methods/chats/close_general_topic.py +++ b/pyrogram/methods/chats/close_general_topic.py @@ -23,8 +23,7 @@ class CloseGeneralTopic: async def close_general_topic( - self: "pyrogram.Client", - chat_id: Union[int, str] + self: "pyrogram.Client", chat_id: Union[int, str] ) -> bool: """Close a forum topic. @@ -45,9 +44,7 @@ async def close_general_topic( """ await self.invoke( raw.functions.channels.EditForumTopic( - channel=await self.resolve_peer(chat_id), - topic_id=1, - closed=True + channel=await self.resolve_peer(chat_id), topic_id=1, closed=True ) ) return True diff --git a/pyrogram/methods/chats/create_channel.py b/pyrogram/methods/chats/create_channel.py index 292fa97dd..87fa0faf6 100644 --- a/pyrogram/methods/chats/create_channel.py +++ b/pyrogram/methods/chats/create_channel.py @@ -22,9 +22,7 @@ class CreateChannel: async def create_channel( - self: "pyrogram.Client", - title: str, - description: str = "" + self: "pyrogram.Client", title: str, description: str = "" ) -> "types.Chat": """Create a new broadcast channel. @@ -47,9 +45,7 @@ async def create_channel( """ r = await self.invoke( raw.functions.channels.CreateChannel( - title=title, - about=description, - broadcast=True + title=title, about=description, broadcast=True ) ) diff --git a/pyrogram/methods/chats/create_forum_topic.py b/pyrogram/methods/chats/create_forum_topic.py index d6d23f300..4f8a94671 100644 --- a/pyrogram/methods/chats/create_forum_topic.py +++ b/pyrogram/methods/chats/create_forum_topic.py @@ -27,7 +27,7 @@ async def create_forum_topic( chat_id: Union[int, str], title: str, icon_color: int = None, - icon_emoji_id: int = None + icon_emoji_id: int = None, ) -> "types.ForumTopicCreated": """Create a new forum topic. @@ -61,7 +61,7 @@ async def create_forum_topic( title=title, random_id=self.rnd_id(), icon_color=icon_color, - icon_emoji_id=icon_emoji_id + icon_emoji_id=icon_emoji_id, ) ) diff --git a/pyrogram/methods/chats/create_group.py b/pyrogram/methods/chats/create_group.py index 027315de2..fee50d7e0 100644 --- a/pyrogram/methods/chats/create_group.py +++ b/pyrogram/methods/chats/create_group.py @@ -27,7 +27,7 @@ class CreateGroup: async def create_group( self: "pyrogram.Client", title: str, - users: Union[Union[int, str], List[Union[int, str]]] + users: Union[Union[int, str], List[Union[int, str]]], ) -> "types.Chat": """Create a new basic group. @@ -59,8 +59,7 @@ async def create_group( r = await self.invoke( raw.functions.messages.CreateChat( - title=title, - users=[await self.resolve_peer(u) for u in users] + title=title, users=[await self.resolve_peer(u) for u in users] ) ) diff --git a/pyrogram/methods/chats/create_supergroup.py b/pyrogram/methods/chats/create_supergroup.py index d1cbbbd89..162820427 100644 --- a/pyrogram/methods/chats/create_supergroup.py +++ b/pyrogram/methods/chats/create_supergroup.py @@ -22,9 +22,7 @@ class CreateSupergroup: async def create_supergroup( - self: "pyrogram.Client", - title: str, - description: str = "" + self: "pyrogram.Client", title: str, description: str = "" ) -> "types.Chat": """Create a new supergroup. @@ -51,9 +49,7 @@ async def create_supergroup( """ r = await self.invoke( raw.functions.channels.CreateChannel( - title=title, - about=description, - megagroup=True + title=title, about=description, megagroup=True ) ) diff --git a/pyrogram/methods/chats/delete_channel.py b/pyrogram/methods/chats/delete_channel.py index c1e4b953a..90ba46621 100644 --- a/pyrogram/methods/chats/delete_channel.py +++ b/pyrogram/methods/chats/delete_channel.py @@ -23,10 +23,7 @@ class DeleteChannel: - async def delete_channel( - self: "pyrogram.Client", - chat_id: Union[int, str] - ) -> bool: + async def delete_channel(self: "pyrogram.Client", chat_id: Union[int, str]) -> bool: """Delete a channel. .. include:: /_includes/usable-by/users.rst diff --git a/pyrogram/methods/chats/delete_chat_photo.py b/pyrogram/methods/chats/delete_chat_photo.py index a8ce7e63c..690592af2 100644 --- a/pyrogram/methods/chats/delete_chat_photo.py +++ b/pyrogram/methods/chats/delete_chat_photo.py @@ -24,8 +24,7 @@ class DeleteChatPhoto: async def delete_chat_photo( - self: "pyrogram.Client", - chat_id: Union[int, str] + self: "pyrogram.Client", chat_id: Union[int, str] ) -> bool: """Delete a chat photo. @@ -54,15 +53,13 @@ async def delete_chat_photo( if isinstance(peer, raw.types.InputPeerChat): await self.invoke( raw.functions.messages.EditChatPhoto( - chat_id=peer.chat_id, - photo=raw.types.InputChatPhotoEmpty() + chat_id=peer.chat_id, photo=raw.types.InputChatPhotoEmpty() ) ) elif isinstance(peer, raw.types.InputPeerChannel): await self.invoke( raw.functions.channels.EditPhoto( - channel=peer, - photo=raw.types.InputChatPhotoEmpty() + channel=peer, photo=raw.types.InputChatPhotoEmpty() ) ) else: diff --git a/pyrogram/methods/chats/delete_forum_topic.py b/pyrogram/methods/chats/delete_forum_topic.py index 0fcc8da58..f48a958f2 100644 --- a/pyrogram/methods/chats/delete_forum_topic.py +++ b/pyrogram/methods/chats/delete_forum_topic.py @@ -23,9 +23,7 @@ class DeleteForumTopic: async def delete_forum_topic( - self: "pyrogram.Client", - chat_id: Union[int, str], - topic_id: int + self: "pyrogram.Client", chat_id: Union[int, str], topic_id: int ) -> bool: """Delete a forum topic. @@ -50,8 +48,7 @@ async def delete_forum_topic( try: await self.invoke( raw.functions.channels.DeleteTopicHistory( - channel=await self.resolve_peer(chat_id), - top_msg_id=topic_id + channel=await self.resolve_peer(chat_id), top_msg_id=topic_id ) ) except Exception as e: diff --git a/pyrogram/methods/chats/delete_supergroup.py b/pyrogram/methods/chats/delete_supergroup.py index 1c246613b..cbb15710e 100644 --- a/pyrogram/methods/chats/delete_supergroup.py +++ b/pyrogram/methods/chats/delete_supergroup.py @@ -24,8 +24,7 @@ class DeleteSupergroup: async def delete_supergroup( - self: "pyrogram.Client", - chat_id: Union[int, str] + self: "pyrogram.Client", chat_id: Union[int, str] ) -> bool: """Delete a supergroup. diff --git a/pyrogram/methods/chats/delete_user_history.py b/pyrogram/methods/chats/delete_user_history.py index 0f5c0bc89..48278f45a 100644 --- a/pyrogram/methods/chats/delete_user_history.py +++ b/pyrogram/methods/chats/delete_user_history.py @@ -48,7 +48,7 @@ async def delete_user_history( r = await self.invoke( raw.functions.channels.DeleteParticipantHistory( channel=await self.resolve_peer(chat_id), - participant=await self.resolve_peer(user_id) + participant=await self.resolve_peer(user_id), ) ) diff --git a/pyrogram/methods/chats/edit_forum_topic.py b/pyrogram/methods/chats/edit_forum_topic.py index ceb0aa6db..c82deffac 100644 --- a/pyrogram/methods/chats/edit_forum_topic.py +++ b/pyrogram/methods/chats/edit_forum_topic.py @@ -27,7 +27,7 @@ async def edit_forum_topic( chat_id: Union[int, str], topic_id: int, title: str = None, - icon_emoji_id: int = None + icon_emoji_id: int = None, ) -> bool: """Edit a forum topic. @@ -60,7 +60,7 @@ async def edit_forum_topic( channel=await self.resolve_peer(chat_id), topic_id=topic_id, title=title, - icon_emoji_id=icon_emoji_id + icon_emoji_id=icon_emoji_id, ) ) return True diff --git a/pyrogram/methods/chats/edit_general_topic.py b/pyrogram/methods/chats/edit_general_topic.py index 134598434..514e05811 100644 --- a/pyrogram/methods/chats/edit_general_topic.py +++ b/pyrogram/methods/chats/edit_general_topic.py @@ -23,9 +23,7 @@ class EditGeneralTopic: async def edit_general_topic( - self: "pyrogram.Client", - chat_id: Union[int, str], - title: str + self: "pyrogram.Client", chat_id: Union[int, str], title: str ) -> bool: """Edit a general forum topic. @@ -49,9 +47,7 @@ async def edit_general_topic( """ await self.invoke( raw.functions.channels.EditForumTopic( - channel=await self.resolve_peer(chat_id), - topic_id=1, - title=title + channel=await self.resolve_peer(chat_id), topic_id=1, title=title ) ) return True diff --git a/pyrogram/methods/chats/get_chat.py b/pyrogram/methods/chats/get_chat.py index 0dd0e5316..fc3fbd008 100644 --- a/pyrogram/methods/chats/get_chat.py +++ b/pyrogram/methods/chats/get_chat.py @@ -26,8 +26,7 @@ class GetChat: async def get_chat( - self: "pyrogram.Client", - chat_id: Union[int, str] + self: "pyrogram.Client", chat_id: Union[int, str] ) -> Union["types.Chat", "types.ChatPreview"]: """Get up to date information about a chat. @@ -60,9 +59,7 @@ async def get_chat( if match: r = await self.invoke( - raw.functions.messages.CheckChatInvite( - hash=match.group(1) - ) + raw.functions.messages.CheckChatInvite(hash=match.group(1)) ) if isinstance(r, raw.types.ChatInvite): @@ -83,6 +80,8 @@ async def get_chat( elif isinstance(peer, (raw.types.InputPeerUser, raw.types.InputPeerSelf)): r = await self.invoke(raw.functions.users.GetFullUser(id=peer)) else: - r = await self.invoke(raw.functions.messages.GetFullChat(chat_id=peer.chat_id)) + r = await self.invoke( + raw.functions.messages.GetFullChat(chat_id=peer.chat_id) + ) return await types.Chat._parse_full(self, r) diff --git a/pyrogram/methods/chats/get_chat_event_log.py b/pyrogram/methods/chats/get_chat_event_log.py index 6ac0893ac..7b24a9dfd 100644 --- a/pyrogram/methods/chats/get_chat_event_log.py +++ b/pyrogram/methods/chats/get_chat_event_log.py @@ -31,7 +31,7 @@ async def get_chat_event_log( offset_id: int = 0, limit: int = 0, filters: "types.ChatEventFilter" = None, - user_ids: List[Union[int, str]] = None + user_ids: List[Union[int, str]] = None, ) -> Optional[AsyncGenerator["types.ChatEvent", None]]: """Get the actions taken by chat members and administrators in the last 48h. @@ -91,7 +91,7 @@ async def get_chat_event_log( [await self.resolve_peer(i) for i in user_ids] if user_ids is not None else user_ids - ) + ), ) ) diff --git a/pyrogram/methods/chats/get_chat_member.py b/pyrogram/methods/chats/get_chat_member.py index 015c1785d..7346a6fd1 100644 --- a/pyrogram/methods/chats/get_chat_member.py +++ b/pyrogram/methods/chats/get_chat_member.py @@ -26,9 +26,7 @@ class GetChatMember: async def get_chat_member( - self: "pyrogram.Client", - chat_id: Union[int, str], - user_id: Union[int, str] + self: "pyrogram.Client", chat_id: Union[int, str], user_id: Union[int, str] ) -> "types.ChatMember": """Get information about one member of a chat. @@ -59,9 +57,7 @@ async def get_chat_member( if isinstance(chat, raw.types.InputPeerChat): r = await self.invoke( - raw.functions.messages.GetFullChat( - chat_id=chat.chat_id - ) + raw.functions.messages.GetFullChat(chat_id=chat.chat_id) ) members = getattr(r.full_chat.participants, "participants", []) @@ -80,10 +76,7 @@ async def get_chat_member( raise UserNotParticipant elif isinstance(chat, raw.types.InputPeerChannel): r = await self.invoke( - raw.functions.channels.GetParticipant( - channel=chat, - participant=user - ) + raw.functions.channels.GetParticipant(channel=chat, participant=user) ) users = {i.id: i for i in r.users} diff --git a/pyrogram/methods/chats/get_chat_members.py b/pyrogram/methods/chats/get_chat_members.py index 3700a1a0a..c0cc940e7 100644 --- a/pyrogram/methods/chats/get_chat_members.py +++ b/pyrogram/methods/chats/get_chat_members.py @@ -33,9 +33,11 @@ async def get_chunk( limit: int, query: str, ): - is_queryable = filter in [enums.ChatMembersFilter.SEARCH, - enums.ChatMembersFilter.BANNED, - enums.ChatMembersFilter.RESTRICTED] + is_queryable = filter in [ + enums.ChatMembersFilter.SEARCH, + enums.ChatMembersFilter.BANNED, + enums.ChatMembersFilter.RESTRICTED, + ] filter = filter.value(q=query) if is_queryable else filter.value() @@ -45,9 +47,9 @@ async def get_chunk( filter=filter, offset=offset, limit=limit, - hash=0 + hash=0, ), - sleep_threshold=60 + sleep_threshold=60, ) members = r.participants @@ -63,7 +65,7 @@ async def get_chat_members( chat_id: Union[int, str], query: str = "", limit: int = 0, - filter: "enums.ChatMembersFilter" = enums.ChatMembersFilter.SEARCH + filter: "enums.ChatMembersFilter" = enums.ChatMembersFilter.SEARCH, ) -> Optional[AsyncGenerator["types.ChatMember", None]]: """Get the members list of a chat. @@ -117,9 +119,7 @@ async def get_chat_members( if isinstance(peer, raw.types.InputPeerChat): r = await self.invoke( - raw.functions.messages.GetFullChat( - chat_id=peer.chat_id - ) + raw.functions.messages.GetFullChat(chat_id=peer.chat_id) ) members = getattr(r.full_chat.participants, "participants", []) @@ -142,7 +142,7 @@ async def get_chat_members( offset=offset, filter=filter, limit=limit, - query=query + query=query, ) if not members: diff --git a/pyrogram/methods/chats/get_chat_members_count.py b/pyrogram/methods/chats/get_chat_members_count.py index 71a8c0efc..f698b033e 100644 --- a/pyrogram/methods/chats/get_chat_members_count.py +++ b/pyrogram/methods/chats/get_chat_members_count.py @@ -24,8 +24,7 @@ class GetChatMembersCount: async def get_chat_members_count( - self: "pyrogram.Client", - chat_id: Union[int, str] + self: "pyrogram.Client", chat_id: Union[int, str] ) -> int: """Get the number of members in a chat. @@ -51,19 +50,11 @@ async def get_chat_members_count( peer = await self.resolve_peer(chat_id) if isinstance(peer, raw.types.InputPeerChat): - r = await self.invoke( - raw.functions.messages.GetChats( - id=[peer.chat_id] - ) - ) + r = await self.invoke(raw.functions.messages.GetChats(id=[peer.chat_id])) return r.chats[0].participants_count elif isinstance(peer, raw.types.InputPeerChannel): - r = await self.invoke( - raw.functions.channels.GetFullChannel( - channel=peer - ) - ) + r = await self.invoke(raw.functions.channels.GetFullChannel(channel=peer)) return r.full_chat.participants_count else: diff --git a/pyrogram/methods/chats/get_chat_online_count.py b/pyrogram/methods/chats/get_chat_online_count.py index fe6ab59a8..26a24f7b3 100644 --- a/pyrogram/methods/chats/get_chat_online_count.py +++ b/pyrogram/methods/chats/get_chat_online_count.py @@ -24,8 +24,7 @@ class GetChatOnlineCount: async def get_chat_online_count( - self: "pyrogram.Client", - chat_id: Union[int, str] + self: "pyrogram.Client", chat_id: Union[int, str] ) -> int: """Get the number of members that are currently online in a chat. @@ -45,8 +44,8 @@ async def get_chat_online_count( online = await app.get_chat_online_count(chat_id) print(online) """ - return (await self.invoke( - raw.functions.messages.GetOnlines( - peer=await self.resolve_peer(chat_id) + return ( + await self.invoke( + raw.functions.messages.GetOnlines(peer=await self.resolve_peer(chat_id)) ) - )).onlines + ).onlines diff --git a/pyrogram/methods/chats/get_dialogs.py b/pyrogram/methods/chats/get_dialogs.py index ccca63816..c7d1a3864 100644 --- a/pyrogram/methods/chats/get_dialogs.py +++ b/pyrogram/methods/chats/get_dialogs.py @@ -25,8 +25,7 @@ class GetDialogs: async def get_dialogs( - self: "pyrogram.Client", - limit: int = 0 + self: "pyrogram.Client", limit: int = 0 ) -> Optional[AsyncGenerator["types.Dialog", None]]: """Get a user's dialogs sequentially. @@ -62,9 +61,9 @@ async def get_dialogs( offset_id=offset_id, offset_peer=offset_peer, limit=limit, - hash=0 + hash=0, ), - sleep_threshold=60 + sleep_threshold=60, ) users = {i.id: i for i in r.users} @@ -78,7 +77,9 @@ async def get_dialogs( chat_id = utils.get_peer_id(message.peer_id) try: - messages[chat_id] = await types.Message._parse(self, message, users, chats) + messages[chat_id] = await types.Message._parse( + self, message, users, chats + ) except ChannelPrivate: continue @@ -88,7 +89,9 @@ async def get_dialogs( if not isinstance(dialog, raw.types.Dialog): continue - dialogs.append(types.Dialog._parse(self, dialog, messages, users, chats)) + dialogs.append( + types.Dialog._parse(self, dialog, messages, users, chats) + ) if not dialogs: return diff --git a/pyrogram/methods/chats/get_dialogs_count.py b/pyrogram/methods/chats/get_dialogs_count.py index ae22eb5cf..9ea2042cf 100644 --- a/pyrogram/methods/chats/get_dialogs_count.py +++ b/pyrogram/methods/chats/get_dialogs_count.py @@ -22,8 +22,7 @@ class GetDialogsCount: async def get_dialogs_count( - self: "pyrogram.Client", - pinned_only: bool = False + self: "pyrogram.Client", pinned_only: bool = False ) -> int: """Get the total count of your dialogs. @@ -45,7 +44,13 @@ async def get_dialogs_count( """ if pinned_only: - return len((await self.invoke(raw.functions.messages.GetPinnedDialogs(folder_id=0))).dialogs) + return len( + ( + await self.invoke( + raw.functions.messages.GetPinnedDialogs(folder_id=0) + ) + ).dialogs + ) else: r = await self.invoke( raw.functions.messages.GetDialogs( @@ -53,7 +58,7 @@ async def get_dialogs_count( offset_id=0, offset_peer=raw.types.InputPeerEmpty(), limit=1, - hash=0 + hash=0, ) ) diff --git a/pyrogram/methods/chats/get_forum_topics.py b/pyrogram/methods/chats/get_forum_topics.py index 1620bc4bc..48c27ce4d 100644 --- a/pyrogram/methods/chats/get_forum_topics.py +++ b/pyrogram/methods/chats/get_forum_topics.py @@ -30,9 +30,7 @@ class GetForumTopics: async def get_forum_topics( - self: "pyrogram.Client", - chat_id: Union[int, str], - limit: int = 0 + self: "pyrogram.Client", chat_id: Union[int, str], limit: int = 0 ) -> Optional[AsyncGenerator["types.ForumTopic", None]]: """Get one or more topic from a chat. @@ -62,7 +60,9 @@ async def get_forum_topics( peer = await self.resolve_peer(chat_id) - rpc = raw.functions.channels.GetForumTopics(channel=peer, offset_date=0, offset_id=0, offset_topic=0, limit=limit) + rpc = raw.functions.channels.GetForumTopics( + channel=peer, offset_date=0, offset_id=0, offset_topic=0, limit=limit + ) r = await self.invoke(rpc, sleep_threshold=-1) diff --git a/pyrogram/methods/chats/get_forum_topics_by_id.py b/pyrogram/methods/chats/get_forum_topics_by_id.py index ea2114aa1..503e79ff2 100644 --- a/pyrogram/methods/chats/get_forum_topics_by_id.py +++ b/pyrogram/methods/chats/get_forum_topics_by_id.py @@ -32,7 +32,7 @@ class GetForumTopicsByID: async def get_forum_topics_by_id( self: "pyrogram.Client", chat_id: Union[int, str], - topic_ids: Union[int, Iterable[int]] + topic_ids: Union[int, Iterable[int]], ) -> Union["types.ForumTopic", List["types.ForumTopic"]]: """Get one or more topic from a chat by using topic identifiers. @@ -63,10 +63,7 @@ async def get_forum_topics_by_id( Raises: ValueError: In case of invalid arguments. """ - ids, ids_type = ( - (topic_ids, int) if topic_ids - else (None, None) - ) + ids, ids_type = (topic_ids, int) if topic_ids else (None, None) if ids is None: raise ValueError("No argument supplied. Either pass topic_ids") diff --git a/pyrogram/methods/chats/get_nearby_chats.py b/pyrogram/methods/chats/get_nearby_chats.py index 8d1163ac9..c404bc3c0 100644 --- a/pyrogram/methods/chats/get_nearby_chats.py +++ b/pyrogram/methods/chats/get_nearby_chats.py @@ -26,9 +26,7 @@ class GetNearbyChats: async def get_nearby_chats( - self: "pyrogram.Client", - latitude: float, - longitude: float + self: "pyrogram.Client", latitude: float, longitude: float ) -> List["types.Chat"]: """Get nearby chats. @@ -53,10 +51,7 @@ async def get_nearby_chats( r = await self.invoke( raw.functions.contacts.GetLocated( - geo_point=raw.types.InputGeoPoint( - lat=latitude, - long=longitude - ) + geo_point=raw.types.InputGeoPoint(lat=latitude, long=longitude) ) ) diff --git a/pyrogram/methods/chats/get_send_as_chats.py b/pyrogram/methods/chats/get_send_as_chats.py index b530fe48f..0fecbbb55 100644 --- a/pyrogram/methods/chats/get_send_as_chats.py +++ b/pyrogram/methods/chats/get_send_as_chats.py @@ -25,8 +25,7 @@ class GetSendAsChats: async def get_send_as_chats( - self: "pyrogram.Client", - chat_id: Union[int, str] + self: "pyrogram.Client", chat_id: Union[int, str] ) -> List["types.Chat"]: """Get the list of "send_as" chats available. @@ -47,9 +46,7 @@ async def get_send_as_chats( print(chats) """ r = await self.invoke( - raw.functions.channels.GetSendAs( - peer=await self.resolve_peer(chat_id) - ) + raw.functions.channels.GetSendAs(peer=await self.resolve_peer(chat_id)) ) users = {u.id: u for u in r.users} diff --git a/pyrogram/methods/chats/hide_general_topic.py b/pyrogram/methods/chats/hide_general_topic.py index 901758ca6..bf212be85 100644 --- a/pyrogram/methods/chats/hide_general_topic.py +++ b/pyrogram/methods/chats/hide_general_topic.py @@ -23,8 +23,7 @@ class HideGeneralTopic: async def hide_general_topic( - self: "pyrogram.Client", - chat_id: Union[int, str] + self: "pyrogram.Client", chat_id: Union[int, str] ) -> bool: """hide a general forum topic. @@ -45,9 +44,7 @@ async def hide_general_topic( """ await self.invoke( raw.functions.channels.EditForumTopic( - channel=await self.resolve_peer(chat_id), - topic_id=1, - hidden=True + channel=await self.resolve_peer(chat_id), topic_id=1, hidden=True ) ) return True diff --git a/pyrogram/methods/chats/join_chat.py b/pyrogram/methods/chats/join_chat.py index def52db4d..e26caad4b 100644 --- a/pyrogram/methods/chats/join_chat.py +++ b/pyrogram/methods/chats/join_chat.py @@ -25,8 +25,7 @@ class JoinChat: async def join_chat( - self: "pyrogram.Client", - chat_id: Union[int, str] + self: "pyrogram.Client", chat_id: Union[int, str] ) -> "types.Chat": """Join a group chat or channel. @@ -56,9 +55,7 @@ async def join_chat( if match: chat = await self.invoke( - raw.functions.messages.ImportChatInvite( - hash=match.group(1) - ) + raw.functions.messages.ImportChatInvite(hash=match.group(1)) ) if isinstance(chat.chats[0], raw.types.Chat): return types.Chat._parse_chat_chat(self, chat.chats[0]) diff --git a/pyrogram/methods/chats/leave_chat.py b/pyrogram/methods/chats/leave_chat.py index 0e307897a..67c8bb765 100644 --- a/pyrogram/methods/chats/leave_chat.py +++ b/pyrogram/methods/chats/leave_chat.py @@ -24,9 +24,7 @@ class LeaveChat: async def leave_chat( - self: "pyrogram.Client", - chat_id: Union[int, str], - delete: bool = False + self: "pyrogram.Client", chat_id: Union[int, str], delete: bool = False ): """Leave a group chat or channel. @@ -62,17 +60,13 @@ async def leave_chat( elif isinstance(peer, raw.types.InputPeerChat): r = await self.invoke( raw.functions.messages.DeleteChatUser( - chat_id=peer.chat_id, - user_id=raw.types.InputUserSelf() + chat_id=peer.chat_id, user_id=raw.types.InputUserSelf() ) ) if delete: await self.invoke( - raw.functions.messages.DeleteHistory( - peer=peer, - max_id=0 - ) + raw.functions.messages.DeleteHistory(peer=peer, max_id=0) ) return r diff --git a/pyrogram/methods/chats/mark_chat_unread.py b/pyrogram/methods/chats/mark_chat_unread.py index b54265979..59614b5dd 100644 --- a/pyrogram/methods/chats/mark_chat_unread.py +++ b/pyrogram/methods/chats/mark_chat_unread.py @@ -42,7 +42,6 @@ async def mark_chat_unread( return await self.invoke( raw.functions.messages.MarkDialogUnread( - peer=await self.resolve_peer(chat_id), - unread=True + peer=await self.resolve_peer(chat_id), unread=True ) ) diff --git a/pyrogram/methods/chats/pin_chat_message.py b/pyrogram/methods/chats/pin_chat_message.py index 73b373fff..4c32c6cf7 100644 --- a/pyrogram/methods/chats/pin_chat_message.py +++ b/pyrogram/methods/chats/pin_chat_message.py @@ -69,7 +69,7 @@ async def pin_chat_message( peer=await self.resolve_peer(chat_id), id=message_id, silent=disable_notification or None, - pm_oneside=not both_sides or None + pm_oneside=not both_sides or None, ) ) @@ -77,6 +77,7 @@ async def pin_chat_message( chats = {c.id: c for c in r.chats} for i in r.updates: - if isinstance(i, (raw.types.UpdateNewMessage, - raw.types.UpdateNewChannelMessage)): + if isinstance( + i, (raw.types.UpdateNewMessage, raw.types.UpdateNewChannelMessage) + ): return await types.Message._parse(self, i.message, users, chats) diff --git a/pyrogram/methods/chats/promote_chat_member.py b/pyrogram/methods/chats/promote_chat_member.py index 9fe37180c..8fdc589a4 100644 --- a/pyrogram/methods/chats/promote_chat_member.py +++ b/pyrogram/methods/chats/promote_chat_member.py @@ -67,12 +67,13 @@ async def promote_chat_member( privileges = types.ChatPrivileges() try: - raw_chat_member = (await self.invoke( - raw.functions.channels.GetParticipant( - channel=chat_id, - participant=user_id + raw_chat_member = ( + await self.invoke( + raw.functions.channels.GetParticipant( + channel=chat_id, participant=user_id + ) ) - )).participant + ).participant except errors.RPCError: raw_chat_member = None @@ -99,9 +100,9 @@ async def promote_chat_member( post_stories=privileges.can_post_stories, edit_stories=privileges.can_edit_stories, delete_stories=privileges.can_delete_stories, - other=privileges.can_manage_chat + other=privileges.can_manage_chat, ), - rank=rank or "" + rank=rank or "", ) ) diff --git a/pyrogram/methods/chats/reopen_forum_topic.py b/pyrogram/methods/chats/reopen_forum_topic.py index 1b5e6a63c..10936a26a 100644 --- a/pyrogram/methods/chats/reopen_forum_topic.py +++ b/pyrogram/methods/chats/reopen_forum_topic.py @@ -23,9 +23,7 @@ class ReopenForumTopic: async def reopen_forum_topic( - self: "pyrogram.Client", - chat_id: Union[int, str], - topic_id: int + self: "pyrogram.Client", chat_id: Union[int, str], topic_id: int ) -> bool: """Reopen a forum topic. @@ -51,7 +49,7 @@ async def reopen_forum_topic( raw.functions.channels.EditForumTopic( channel=await self.resolve_peer(chat_id), topic_id=topic_id, - closed=False + closed=False, ) ) return True diff --git a/pyrogram/methods/chats/reopen_general_topic.py b/pyrogram/methods/chats/reopen_general_topic.py index a1ba65da3..256bdaba6 100644 --- a/pyrogram/methods/chats/reopen_general_topic.py +++ b/pyrogram/methods/chats/reopen_general_topic.py @@ -23,8 +23,7 @@ class ReopenGeneralTopic: async def reopen_general_topic( - self: "pyrogram.Client", - chat_id: Union[int, str] + self: "pyrogram.Client", chat_id: Union[int, str] ) -> bool: """Reopen a general forum topic. @@ -45,9 +44,7 @@ async def reopen_general_topic( """ await self.invoke( raw.functions.channels.EditForumTopic( - channel=await self.resolve_peer(chat_id), - topic_id=1, - closed=False + channel=await self.resolve_peer(chat_id), topic_id=1, closed=False ) ) return True diff --git a/pyrogram/methods/chats/restrict_chat_member.py b/pyrogram/methods/chats/restrict_chat_member.py index d537f9614..feb837a9c 100644 --- a/pyrogram/methods/chats/restrict_chat_member.py +++ b/pyrogram/methods/chats/restrict_chat_member.py @@ -31,7 +31,7 @@ async def restrict_chat_member( chat_id: Union[int, str], user_id: Union[int, str], permissions: "types.ChatPermissions", - until_date: datetime = utils.zero_datetime() + until_date: datetime = utils.zero_datetime(), ) -> "types.Chat": """Restrict a user in a supergroup. @@ -80,64 +80,134 @@ async def restrict_chat_member( """ if permissions.all_perms is not None: - send_audios=None - send_docs=None - send_games=None - send_gifs=None - send_photos=None - send_plain=None - send_roundvideos=None - send_stickers=None - send_videos=None - send_voices=None + send_audios = None + send_docs = None + send_games = None + send_gifs = None + send_photos = None + send_plain = None + send_roundvideos = None + send_stickers = None + send_videos = None + send_voices = None if permissions.all_perms: - send_messages=False - send_media=False - send_polls=False - embed_links=False - change_info=False - invite_users=False - pin_messages=False - manage_topics=False - send_inline=False + send_messages = False + send_media = False + send_polls = False + embed_links = False + change_info = False + invite_users = False + pin_messages = False + manage_topics = False + send_inline = False else: - send_messages=True - send_media=True - send_polls=True - embed_links=True - change_info=True - invite_users=True - pin_messages=True - manage_topics=True - send_inline=True + send_messages = True + send_media = True + send_polls = True + embed_links = True + change_info = True + invite_users = True + pin_messages = True + manage_topics = True + send_inline = True else: old_permissions = (await self.get_chat(chat_id)).permissions send_messages = None send_media = None - embed_links=not permissions.can_add_web_page_previews if permissions.can_add_web_page_previews is not None else not old_permissions.can_add_web_page_previews - send_polls=not permissions.can_send_polls if permissions.can_send_polls is not None else not old_permissions.can_send_polls - change_info=not permissions.can_change_info if permissions.can_change_info is not None else not old_permissions.can_change_info - invite_users=not permissions.can_invite_users if permissions.can_invite_users is not None else not old_permissions.can_invite_users - pin_messages=not permissions.can_pin_messages if permissions.can_pin_messages is not None else not old_permissions.can_pin_messages - manage_topics=not permissions.can_manage_topics if permissions.can_manage_topics is not None else not old_permissions.can_manage_topics - send_audios=not permissions.can_send_audios if permissions.can_send_audios is not None else not old_permissions.can_send_audios - send_docs=not permissions.can_send_docs if permissions.can_send_docs is not None else not old_permissions.can_send_docs - send_games=not permissions.can_send_games if permissions.can_send_games is not None else not old_permissions.can_send_games - send_gifs=not permissions.can_send_gifs if permissions.can_send_gifs is not None else not old_permissions.can_send_gifs - send_inline=not permissions.can_send_inline if permissions.can_send_inline is not None else not old_permissions.can_send_inline - send_photos=not permissions.can_send_photos if permissions.can_send_photos is not None else not old_permissions.can_send_photos - send_plain=not permissions.can_send_plain if permissions.can_send_plain is not None else not old_permissions.can_send_plain - send_roundvideos=not permissions.can_send_roundvideos if permissions.can_send_roundvideos is not None else not old_permissions.can_send_roundvideos - send_stickers=not permissions.can_send_stickers if permissions.can_send_stickers is not None else not old_permissions.can_send_stickers - send_videos=not permissions.can_send_videos if permissions.can_send_videos is not None else not old_permissions.can_send_videos - send_voices=not permissions.can_send_voices if permissions.can_send_voices is not None else not old_permissions.can_send_voices + embed_links = ( + not permissions.can_add_web_page_previews + if permissions.can_add_web_page_previews is not None + else not old_permissions.can_add_web_page_previews + ) + send_polls = ( + not permissions.can_send_polls + if permissions.can_send_polls is not None + else not old_permissions.can_send_polls + ) + change_info = ( + not permissions.can_change_info + if permissions.can_change_info is not None + else not old_permissions.can_change_info + ) + invite_users = ( + not permissions.can_invite_users + if permissions.can_invite_users is not None + else not old_permissions.can_invite_users + ) + pin_messages = ( + not permissions.can_pin_messages + if permissions.can_pin_messages is not None + else not old_permissions.can_pin_messages + ) + manage_topics = ( + not permissions.can_manage_topics + if permissions.can_manage_topics is not None + else not old_permissions.can_manage_topics + ) + send_audios = ( + not permissions.can_send_audios + if permissions.can_send_audios is not None + else not old_permissions.can_send_audios + ) + send_docs = ( + not permissions.can_send_docs + if permissions.can_send_docs is not None + else not old_permissions.can_send_docs + ) + send_games = ( + not permissions.can_send_games + if permissions.can_send_games is not None + else not old_permissions.can_send_games + ) + send_gifs = ( + not permissions.can_send_gifs + if permissions.can_send_gifs is not None + else not old_permissions.can_send_gifs + ) + send_inline = ( + not permissions.can_send_inline + if permissions.can_send_inline is not None + else not old_permissions.can_send_inline + ) + send_photos = ( + not permissions.can_send_photos + if permissions.can_send_photos is not None + else not old_permissions.can_send_photos + ) + send_plain = ( + not permissions.can_send_plain + if permissions.can_send_plain is not None + else not old_permissions.can_send_plain + ) + send_roundvideos = ( + not permissions.can_send_roundvideos + if permissions.can_send_roundvideos is not None + else not old_permissions.can_send_roundvideos + ) + send_stickers = ( + not permissions.can_send_stickers + if permissions.can_send_stickers is not None + else not old_permissions.can_send_stickers + ) + send_videos = ( + not permissions.can_send_videos + if permissions.can_send_videos is not None + else not old_permissions.can_send_videos + ) + send_voices = ( + not permissions.can_send_voices + if permissions.can_send_voices is not None + else not old_permissions.can_send_voices + ) if permissions.can_send_messages is not None: if permissions.can_send_messages: send_plain = False else: send_plain = True if permissions.can_send_media_messages is None: - permissions.can_send_media_messages = old_permissions.can_send_media_messages + permissions.can_send_media_messages = ( + old_permissions.can_send_media_messages + ) if permissions.can_send_media_messages is not None: if permissions.can_send_media_messages: embed_links = False @@ -189,8 +259,8 @@ async def restrict_chat_member( send_roundvideos=send_roundvideos, send_stickers=send_stickers, send_videos=send_videos, - send_voices=send_voices - ) + send_voices=send_voices, + ), ) ) diff --git a/pyrogram/methods/chats/set_administrator_title.py b/pyrogram/methods/chats/set_administrator_title.py index 9e0424084..5762e8d31 100644 --- a/pyrogram/methods/chats/set_administrator_title.py +++ b/pyrogram/methods/chats/set_administrator_title.py @@ -61,26 +61,26 @@ async def set_administrator_title( chat_id = await self.resolve_peer(chat_id) user_id = await self.resolve_peer(user_id) - r = (await self.invoke( - raw.functions.channels.GetParticipant( - channel=chat_id, - participant=user_id + r = ( + await self.invoke( + raw.functions.channels.GetParticipant( + channel=chat_id, participant=user_id + ) ) - )).participant + ).participant if isinstance(r, raw.types.ChannelParticipantCreator): admin_rights = raw.types.ChatAdminRights() elif isinstance(r, raw.types.ChannelParticipantAdmin): admin_rights = r.admin_rights else: - raise ValueError("Custom titles can only be applied to owners or administrators of supergroups") + raise ValueError( + "Custom titles can only be applied to owners or administrators of supergroups" + ) await self.invoke( raw.functions.channels.EditAdmin( - channel=chat_id, - user_id=user_id, - admin_rights=admin_rights, - rank=title + channel=chat_id, user_id=user_id, admin_rights=admin_rights, rank=title ) ) diff --git a/pyrogram/methods/chats/set_chat_description.py b/pyrogram/methods/chats/set_chat_description.py index c9cd14dad..c2c155739 100644 --- a/pyrogram/methods/chats/set_chat_description.py +++ b/pyrogram/methods/chats/set_chat_description.py @@ -24,9 +24,7 @@ class SetChatDescription: async def set_chat_description( - self: "pyrogram.Client", - chat_id: Union[int, str], - description: str + self: "pyrogram.Client", chat_id: Union[int, str], description: str ) -> bool: """Change the description of a supergroup or a channel. You must be an administrator in the chat for this to work and must have the appropriate admin rights. @@ -56,10 +54,7 @@ async def set_chat_description( if isinstance(peer, (raw.types.InputPeerChannel, raw.types.InputPeerChat)): await self.invoke( - raw.functions.messages.EditChatAbout( - peer=peer, - about=description - ) + raw.functions.messages.EditChatAbout(peer=peer, about=description) ) else: raise ValueError(f'The chat_id "{chat_id}" belongs to a user') diff --git a/pyrogram/methods/chats/set_chat_permissions.py b/pyrogram/methods/chats/set_chat_permissions.py index 9210b246b..25207eec8 100644 --- a/pyrogram/methods/chats/set_chat_permissions.py +++ b/pyrogram/methods/chats/set_chat_permissions.py @@ -67,64 +67,134 @@ async def set_chat_permissions( """ if permissions.all_perms is not None: - send_audios=None - send_docs=None - send_games=None - send_gifs=None - send_photos=None - send_plain=None - send_roundvideos=None - send_stickers=None - send_videos=None - send_voices=None + send_audios = None + send_docs = None + send_games = None + send_gifs = None + send_photos = None + send_plain = None + send_roundvideos = None + send_stickers = None + send_videos = None + send_voices = None if permissions.all_perms: - send_messages=False - send_media=False - send_polls=False - embed_links=False - change_info=False - invite_users=False - pin_messages=False - manage_topics=False - send_inline=False + send_messages = False + send_media = False + send_polls = False + embed_links = False + change_info = False + invite_users = False + pin_messages = False + manage_topics = False + send_inline = False else: - send_messages=True - send_media=True - send_polls=True - embed_links=True - change_info=True - invite_users=True - pin_messages=True - manage_topics=True - send_inline=True + send_messages = True + send_media = True + send_polls = True + embed_links = True + change_info = True + invite_users = True + pin_messages = True + manage_topics = True + send_inline = True else: old_permissions = (await self.get_chat(chat_id)).permissions send_messages = None send_media = None - embed_links=not permissions.can_add_web_page_previews if permissions.can_add_web_page_previews is not None else not old_permissions.can_add_web_page_previews - send_polls=not permissions.can_send_polls if permissions.can_send_polls is not None else not old_permissions.can_send_polls - change_info=not permissions.can_change_info if permissions.can_change_info is not None else not old_permissions.can_change_info - invite_users=not permissions.can_invite_users if permissions.can_invite_users is not None else not old_permissions.can_invite_users - pin_messages=not permissions.can_pin_messages if permissions.can_pin_messages is not None else not old_permissions.can_pin_messages - manage_topics=not permissions.can_manage_topics if permissions.can_manage_topics is not None else not old_permissions.can_manage_topics - send_audios=not permissions.can_send_audios if permissions.can_send_audios is not None else not old_permissions.can_send_audios - send_docs=not permissions.can_send_docs if permissions.can_send_docs is not None else not old_permissions.can_send_docs - send_games=not permissions.can_send_games if permissions.can_send_games is not None else not old_permissions.can_send_games - send_gifs=not permissions.can_send_gifs if permissions.can_send_gifs is not None else not old_permissions.can_send_gifs - send_inline=not permissions.can_send_inline if permissions.can_send_inline is not None else not old_permissions.can_send_inline - send_photos=not permissions.can_send_photos if permissions.can_send_photos is not None else not old_permissions.can_send_photos - send_plain=not permissions.can_send_plain if permissions.can_send_plain is not None else not old_permissions.can_send_plain - send_roundvideos=not permissions.can_send_roundvideos if permissions.can_send_roundvideos is not None else not old_permissions.can_send_roundvideos - send_stickers=not permissions.can_send_stickers if permissions.can_send_stickers is not None else not old_permissions.can_send_stickers - send_videos=not permissions.can_send_videos if permissions.can_send_videos is not None else not old_permissions.can_send_videos - send_voices=not permissions.can_send_voices if permissions.can_send_voices is not None else not old_permissions.can_send_voices + embed_links = ( + not permissions.can_add_web_page_previews + if permissions.can_add_web_page_previews is not None + else not old_permissions.can_add_web_page_previews + ) + send_polls = ( + not permissions.can_send_polls + if permissions.can_send_polls is not None + else not old_permissions.can_send_polls + ) + change_info = ( + not permissions.can_change_info + if permissions.can_change_info is not None + else not old_permissions.can_change_info + ) + invite_users = ( + not permissions.can_invite_users + if permissions.can_invite_users is not None + else not old_permissions.can_invite_users + ) + pin_messages = ( + not permissions.can_pin_messages + if permissions.can_pin_messages is not None + else not old_permissions.can_pin_messages + ) + manage_topics = ( + not permissions.can_manage_topics + if permissions.can_manage_topics is not None + else not old_permissions.can_manage_topics + ) + send_audios = ( + not permissions.can_send_audios + if permissions.can_send_audios is not None + else not old_permissions.can_send_audios + ) + send_docs = ( + not permissions.can_send_docs + if permissions.can_send_docs is not None + else not old_permissions.can_send_docs + ) + send_games = ( + not permissions.can_send_games + if permissions.can_send_games is not None + else not old_permissions.can_send_games + ) + send_gifs = ( + not permissions.can_send_gifs + if permissions.can_send_gifs is not None + else not old_permissions.can_send_gifs + ) + send_inline = ( + not permissions.can_send_inline + if permissions.can_send_inline is not None + else not old_permissions.can_send_inline + ) + send_photos = ( + not permissions.can_send_photos + if permissions.can_send_photos is not None + else not old_permissions.can_send_photos + ) + send_plain = ( + not permissions.can_send_plain + if permissions.can_send_plain is not None + else not old_permissions.can_send_plain + ) + send_roundvideos = ( + not permissions.can_send_roundvideos + if permissions.can_send_roundvideos is not None + else not old_permissions.can_send_roundvideos + ) + send_stickers = ( + not permissions.can_send_stickers + if permissions.can_send_stickers is not None + else not old_permissions.can_send_stickers + ) + send_videos = ( + not permissions.can_send_videos + if permissions.can_send_videos is not None + else not old_permissions.can_send_videos + ) + send_voices = ( + not permissions.can_send_voices + if permissions.can_send_voices is not None + else not old_permissions.can_send_voices + ) if permissions.can_send_messages is not None: if permissions.can_send_messages: send_plain = False else: send_plain = True if permissions.can_send_media_messages is None: - permissions.can_send_media_messages = old_permissions.can_send_media_messages + permissions.can_send_media_messages = ( + old_permissions.can_send_media_messages + ) if permissions.can_send_media_messages is not None: if permissions.can_send_media_messages: embed_links = False @@ -176,8 +246,8 @@ async def set_chat_permissions( send_roundvideos=send_roundvideos, send_stickers=send_stickers, send_videos=send_videos, - send_voices=send_voices - ) + send_voices=send_voices, + ), ) ) diff --git a/pyrogram/methods/chats/set_chat_photo.py b/pyrogram/methods/chats/set_chat_photo.py index 7a3057395..091e6a372 100644 --- a/pyrogram/methods/chats/set_chat_photo.py +++ b/pyrogram/methods/chats/set_chat_photo.py @@ -111,10 +111,7 @@ async def set_chat_photo( ) elif isinstance(peer, raw.types.InputPeerChannel): await self.invoke( - raw.functions.channels.EditPhoto( - channel=peer, - photo=photo - ) + raw.functions.channels.EditPhoto(channel=peer, photo=photo) ) else: raise ValueError(f'The chat_id "{chat_id}" belongs to a user') diff --git a/pyrogram/methods/chats/set_chat_protected_content.py b/pyrogram/methods/chats/set_chat_protected_content.py index b64848ce9..0c9c0b3e6 100644 --- a/pyrogram/methods/chats/set_chat_protected_content.py +++ b/pyrogram/methods/chats/set_chat_protected_content.py @@ -24,9 +24,7 @@ class SetChatProtectedContent: async def set_chat_protected_content( - self: "pyrogram.Client", - chat_id: Union[int, str], - enabled: bool + self: "pyrogram.Client", chat_id: Union[int, str], enabled: bool ) -> bool: """Set the chat protected content setting. @@ -46,8 +44,7 @@ async def set_chat_protected_content( await self.invoke( raw.functions.messages.ToggleNoForwards( - peer=await self.resolve_peer(chat_id), - enabled=enabled + peer=await self.resolve_peer(chat_id), enabled=enabled ) ) diff --git a/pyrogram/methods/chats/set_chat_title.py b/pyrogram/methods/chats/set_chat_title.py index 1e0b2ed8c..9fc610d87 100644 --- a/pyrogram/methods/chats/set_chat_title.py +++ b/pyrogram/methods/chats/set_chat_title.py @@ -24,9 +24,7 @@ class SetChatTitle: async def set_chat_title( - self: "pyrogram.Client", - chat_id: Union[int, str], - title: str + self: "pyrogram.Client", chat_id: Union[int, str], title: str ) -> bool: """Change the title of a chat. Titles can't be changed for private chats. @@ -61,17 +59,11 @@ async def set_chat_title( if isinstance(peer, raw.types.InputPeerChat): await self.invoke( - raw.functions.messages.EditChatTitle( - chat_id=peer.chat_id, - title=title - ) + raw.functions.messages.EditChatTitle(chat_id=peer.chat_id, title=title) ) elif isinstance(peer, raw.types.InputPeerChannel): await self.invoke( - raw.functions.channels.EditTitle( - channel=peer, - title=title - ) + raw.functions.channels.EditTitle(channel=peer, title=title) ) else: raise ValueError(f'The chat_id "{chat_id}" belongs to a user') diff --git a/pyrogram/methods/chats/set_chat_username.py b/pyrogram/methods/chats/set_chat_username.py index af12d542e..f62ae226e 100644 --- a/pyrogram/methods/chats/set_chat_username.py +++ b/pyrogram/methods/chats/set_chat_username.py @@ -24,9 +24,7 @@ class SetChatUsername: async def set_chat_username( - self: "pyrogram.Client", - chat_id: Union[int, str], - username: Optional[str] + self: "pyrogram.Client", chat_id: Union[int, str], username: Optional[str] ) -> bool: """Set a channel or a supergroup username. @@ -60,8 +58,7 @@ async def set_chat_username( return bool( await self.invoke( raw.functions.channels.UpdateUsername( - channel=peer, - username=username or "" + channel=peer, username=username or "" ) ) ) diff --git a/pyrogram/methods/chats/set_send_as_chat.py b/pyrogram/methods/chats/set_send_as_chat.py index 95f29464d..d05dc2656 100644 --- a/pyrogram/methods/chats/set_send_as_chat.py +++ b/pyrogram/methods/chats/set_send_as_chat.py @@ -26,7 +26,7 @@ class SetSendAsChat: async def set_send_as_chat( self: "pyrogram.Client", chat_id: Union[int, str], - send_as_chat_id: Union[int, str] + send_as_chat_id: Union[int, str], ) -> bool: """Set the default "send_as" chat for a chat. @@ -54,6 +54,6 @@ async def set_send_as_chat( return await self.invoke( raw.functions.messages.SaveDefaultSendAs( peer=await self.resolve_peer(chat_id), - send_as=await self.resolve_peer(send_as_chat_id) + send_as=await self.resolve_peer(send_as_chat_id), ) ) diff --git a/pyrogram/methods/chats/set_slow_mode.py b/pyrogram/methods/chats/set_slow_mode.py index eeac55254..b35ebb07b 100644 --- a/pyrogram/methods/chats/set_slow_mode.py +++ b/pyrogram/methods/chats/set_slow_mode.py @@ -24,9 +24,7 @@ class SetSlowMode: async def set_slow_mode( - self: "pyrogram.Client", - chat_id: Union[int, str], - seconds: Optional[int] + self: "pyrogram.Client", chat_id: Union[int, str], seconds: Optional[int] ) -> bool: """Set the slow mode interval for a chat. @@ -56,8 +54,7 @@ async def set_slow_mode( await self.invoke( raw.functions.channels.ToggleSlowMode( - channel=await self.resolve_peer(chat_id), - seconds=seconds or 0 + channel=await self.resolve_peer(chat_id), seconds=seconds or 0 ) ) diff --git a/pyrogram/methods/chats/unarchive_chats.py b/pyrogram/methods/chats/unarchive_chats.py index 160a56b16..ca568fc40 100644 --- a/pyrogram/methods/chats/unarchive_chats.py +++ b/pyrogram/methods/chats/unarchive_chats.py @@ -58,15 +58,12 @@ async def unarchive_chats( for chat in chat_ids: folder_peers.append( raw.types.InputFolderPeer( - peer=await self.resolve_peer(chat), - folder_id=0 + peer=await self.resolve_peer(chat), folder_id=0 ) ) await self.invoke( - raw.functions.folders.EditPeerFolders( - folder_peers=folder_peers - ) + raw.functions.folders.EditPeerFolders(folder_peers=folder_peers) ) return True diff --git a/pyrogram/methods/chats/unban_chat_member.py b/pyrogram/methods/chats/unban_chat_member.py index 38eff2349..2333a5e44 100644 --- a/pyrogram/methods/chats/unban_chat_member.py +++ b/pyrogram/methods/chats/unban_chat_member.py @@ -24,9 +24,7 @@ class UnbanChatMember: async def unban_chat_member( - self: "pyrogram.Client", - chat_id: Union[int, str], - user_id: Union[int, str] + self: "pyrogram.Client", chat_id: Union[int, str], user_id: Union[int, str] ) -> bool: """Unban a previously banned user in a supergroup or channel. The user will **not** return to the group or channel automatically, but will be able to join via link, etc. @@ -56,9 +54,7 @@ async def unban_chat_member( raw.functions.channels.EditBanned( channel=await self.resolve_peer(chat_id), participant=await self.resolve_peer(user_id), - banned_rights=raw.types.ChatBannedRights( - until_date=0 - ) + banned_rights=raw.types.ChatBannedRights(until_date=0), ) ) diff --git a/pyrogram/methods/chats/unhide_general_topic.py b/pyrogram/methods/chats/unhide_general_topic.py index 2bad75ed8..7631a444f 100644 --- a/pyrogram/methods/chats/unhide_general_topic.py +++ b/pyrogram/methods/chats/unhide_general_topic.py @@ -23,8 +23,7 @@ class UnhideGeneralTopic: async def unhide_general_topic( - self: "pyrogram.Client", - chat_id: Union[int, str] + self: "pyrogram.Client", chat_id: Union[int, str] ) -> bool: """unhide a general forum topic. @@ -45,9 +44,7 @@ async def unhide_general_topic( """ await self.invoke( raw.functions.channels.EditForumTopic( - channel=await self.resolve_peer(chat_id), - topic_id=1, - hidden=False + channel=await self.resolve_peer(chat_id), topic_id=1, hidden=False ) ) return True diff --git a/pyrogram/methods/chats/unpin_chat_message.py b/pyrogram/methods/chats/unpin_chat_message.py index 4d1c1a23c..6f702ecc9 100644 --- a/pyrogram/methods/chats/unpin_chat_message.py +++ b/pyrogram/methods/chats/unpin_chat_message.py @@ -24,9 +24,7 @@ class UnpinChatMessage: async def unpin_chat_message( - self: "pyrogram.Client", - chat_id: Union[int, str], - message_id: int = 0 + self: "pyrogram.Client", chat_id: Union[int, str], message_id: int = 0 ) -> bool: """Unpin a message in a group, channel or your own chat. You must be an administrator in the chat for this to work and must have the "can_pin_messages" admin @@ -53,9 +51,7 @@ async def unpin_chat_message( """ await self.invoke( raw.functions.messages.UpdatePinnedMessage( - peer=await self.resolve_peer(chat_id), - id=message_id, - unpin=True + peer=await self.resolve_peer(chat_id), id=message_id, unpin=True ) ) diff --git a/pyrogram/methods/chats/update_color.py b/pyrogram/methods/chats/update_color.py index f14d55689..ec1076eba 100644 --- a/pyrogram/methods/chats/update_color.py +++ b/pyrogram/methods/chats/update_color.py @@ -22,12 +22,13 @@ from pyrogram import raw from pyrogram import enums + class UpdateColor: async def update_color( self: "pyrogram.Client", chat_id: Union[int, str], color: Union["enums.ReplyColor", "enums.ProfileColor"], - background_emoji_id: int = None + background_emoji_id: int = None, ) -> bool: """Update color @@ -60,7 +61,7 @@ async def update_color( raw.functions.account.UpdateColor( for_profile=isinstance(color, enums.ProfileColor), color=color.value, - background_emoji_id=background_emoji_id + background_emoji_id=background_emoji_id, ) ) else: @@ -68,8 +69,8 @@ async def update_color( raw.functions.channels.UpdateColor( channel=peer, color=color.value, - background_emoji_id=background_emoji_id + background_emoji_id=background_emoji_id, ) ) - return bool(r) \ No newline at end of file + return bool(r) diff --git a/pyrogram/methods/contacts/__init__.py b/pyrogram/methods/contacts/__init__.py index 5849ce438..312b493a7 100644 --- a/pyrogram/methods/contacts/__init__.py +++ b/pyrogram/methods/contacts/__init__.py @@ -24,10 +24,6 @@ class Contacts( - GetContacts, - DeleteContacts, - ImportContacts, - GetContactsCount, - AddContact + GetContacts, DeleteContacts, ImportContacts, GetContactsCount, AddContact ): pass diff --git a/pyrogram/methods/contacts/add_contact.py b/pyrogram/methods/contacts/add_contact.py index 26e15230e..ae4f40886 100644 --- a/pyrogram/methods/contacts/add_contact.py +++ b/pyrogram/methods/contacts/add_contact.py @@ -30,7 +30,7 @@ async def add_contact( first_name: str, last_name: str = "", phone_number: str = "", - share_phone_number: bool = False + share_phone_number: bool = False, ): """Add an existing Telegram user as contact, even without a phone number. @@ -72,7 +72,7 @@ async def add_contact( first_name=first_name, last_name=last_name, phone=phone_number, - add_phone_privacy_exception=share_phone_number + add_phone_privacy_exception=share_phone_number, ) ) diff --git a/pyrogram/methods/contacts/delete_contacts.py b/pyrogram/methods/contacts/delete_contacts.py index cd2df5e13..1ad3de7bf 100644 --- a/pyrogram/methods/contacts/delete_contacts.py +++ b/pyrogram/methods/contacts/delete_contacts.py @@ -24,8 +24,7 @@ class DeleteContacts: async def delete_contacts( - self: "pyrogram.Client", - user_ids: Union[int, str, List[Union[int, str]]] + self: "pyrogram.Client", user_ids: Union[int, str, List[Union[int, str]]] ) -> Union["types.User", List["types.User"], None]: """Delete contacts from your Telegram address book. diff --git a/pyrogram/methods/contacts/get_contacts.py b/pyrogram/methods/contacts/get_contacts.py index 763f9a305..097bfa3f4 100644 --- a/pyrogram/methods/contacts/get_contacts.py +++ b/pyrogram/methods/contacts/get_contacts.py @@ -27,9 +27,7 @@ class GetContacts: - async def get_contacts( - self: "pyrogram.Client" - ) -> List["types.User"]: + async def get_contacts(self: "pyrogram.Client") -> List["types.User"]: """Get contacts from your Telegram address book. .. include:: /_includes/usable-by/users.rst diff --git a/pyrogram/methods/contacts/get_contacts_count.py b/pyrogram/methods/contacts/get_contacts_count.py index 56120bac7..2d50401ce 100644 --- a/pyrogram/methods/contacts/get_contacts_count.py +++ b/pyrogram/methods/contacts/get_contacts_count.py @@ -21,9 +21,7 @@ class GetContactsCount: - async def get_contacts_count( - self: "pyrogram.Client" - ) -> int: + async def get_contacts_count(self: "pyrogram.Client") -> int: """Get the total count of contacts from your Telegram address book. .. include:: /_includes/usable-by/users.rst @@ -38,4 +36,6 @@ async def get_contacts_count( print(count) """ - return len((await self.invoke(raw.functions.contacts.GetContacts(hash=0))).contacts) + return len( + (await self.invoke(raw.functions.contacts.GetContacts(hash=0))).contacts + ) diff --git a/pyrogram/methods/contacts/import_contacts.py b/pyrogram/methods/contacts/import_contacts.py index aa8fd4ae3..5e5b2ddaa 100644 --- a/pyrogram/methods/contacts/import_contacts.py +++ b/pyrogram/methods/contacts/import_contacts.py @@ -25,8 +25,7 @@ class ImportContacts: async def import_contacts( - self: "pyrogram.Client", - contacts: List["types.InputPhoneContact"] + self: "pyrogram.Client", contacts: List["types.InputPhoneContact"] ): """Import contacts to your Telegram address book. @@ -50,9 +49,7 @@ async def import_contacts( InputPhoneContact("+1-789-012-3456", "Baz")]) """ imported_contacts = await self.invoke( - raw.functions.contacts.ImportContacts( - contacts=contacts - ) + raw.functions.contacts.ImportContacts(contacts=contacts) ) return imported_contacts diff --git a/pyrogram/methods/decorators/__init__.py b/pyrogram/methods/decorators/__init__.py index 169b1ec33..759a13bbb 100644 --- a/pyrogram/methods/decorators/__init__.py +++ b/pyrogram/methods/decorators/__init__.py @@ -49,6 +49,6 @@ class Decorators( OnChatJoinRequest, OnStory, OnMessageReactionUpdated, - OnMessageReactionCountUpdated + OnMessageReactionCountUpdated, ): pass diff --git a/pyrogram/methods/decorators/on_callback_query.py b/pyrogram/methods/decorators/on_callback_query.py index 07e15a3e7..bd3f3cd55 100644 --- a/pyrogram/methods/decorators/on_callback_query.py +++ b/pyrogram/methods/decorators/on_callback_query.py @@ -23,11 +23,7 @@ class OnCallbackQuery: - def on_callback_query( - self=None, - filters=None, - group: int = 0 - ) -> Callable: + def on_callback_query(self=None, filters=None, group: int = 0) -> Callable: """Decorator for handling callback queries. This does the same thing as :meth:`~pyrogram.Client.add_handler` using the @@ -44,7 +40,9 @@ def on_callback_query( def decorator(func: Callable) -> Callable: if isinstance(self, pyrogram.Client): - self.add_handler(pyrogram.handlers.CallbackQueryHandler(func, filters), group) + self.add_handler( + pyrogram.handlers.CallbackQueryHandler(func, filters), group + ) elif isinstance(self, Filter) or self is None: if not hasattr(func, "handlers"): func.handlers = [] @@ -52,7 +50,7 @@ def decorator(func: Callable) -> Callable: func.handlers.append( ( pyrogram.handlers.CallbackQueryHandler(func, self), - group if filters is None else filters + group if filters is None else filters, ) ) diff --git a/pyrogram/methods/decorators/on_chat_join_request.py b/pyrogram/methods/decorators/on_chat_join_request.py index 57fb709cb..8a59eb776 100644 --- a/pyrogram/methods/decorators/on_chat_join_request.py +++ b/pyrogram/methods/decorators/on_chat_join_request.py @@ -23,11 +23,7 @@ class OnChatJoinRequest: - def on_chat_join_request( - self=None, - filters=None, - group: int = 0 - ) -> Callable: + def on_chat_join_request(self=None, filters=None, group: int = 0) -> Callable: """Decorator for handling chat join requests. This does the same thing as :meth:`~pyrogram.Client.add_handler` using the @@ -43,7 +39,9 @@ def on_chat_join_request( def decorator(func: Callable) -> Callable: if isinstance(self, pyrogram.Client): - self.add_handler(pyrogram.handlers.ChatJoinRequestHandler(func, filters), group) + self.add_handler( + pyrogram.handlers.ChatJoinRequestHandler(func, filters), group + ) elif isinstance(self, Filter) or self is None: if not hasattr(func, "handlers"): func.handlers = [] @@ -51,7 +49,7 @@ def decorator(func: Callable) -> Callable: func.handlers.append( ( pyrogram.handlers.ChatJoinRequestHandler(func, self), - group if filters is None else filters + group if filters is None else filters, ) ) diff --git a/pyrogram/methods/decorators/on_chat_member_updated.py b/pyrogram/methods/decorators/on_chat_member_updated.py index c2f0e888a..451516b3d 100644 --- a/pyrogram/methods/decorators/on_chat_member_updated.py +++ b/pyrogram/methods/decorators/on_chat_member_updated.py @@ -23,11 +23,7 @@ class OnChatMemberUpdated: - def on_chat_member_updated( - self=None, - filters=None, - group: int = 0 - ) -> Callable: + def on_chat_member_updated(self=None, filters=None, group: int = 0) -> Callable: """Decorator for handling event changes on chat members. This does the same thing as :meth:`~pyrogram.Client.add_handler` using the @@ -43,7 +39,9 @@ def on_chat_member_updated( def decorator(func: Callable) -> Callable: if isinstance(self, pyrogram.Client): - self.add_handler(pyrogram.handlers.ChatMemberUpdatedHandler(func, filters), group) + self.add_handler( + pyrogram.handlers.ChatMemberUpdatedHandler(func, filters), group + ) elif isinstance(self, Filter) or self is None: if not hasattr(func, "handlers"): func.handlers = [] @@ -51,7 +49,7 @@ def decorator(func: Callable) -> Callable: func.handlers.append( ( pyrogram.handlers.ChatMemberUpdatedHandler(func, self), - group if filters is None else filters + group if filters is None else filters, ) ) diff --git a/pyrogram/methods/decorators/on_chosen_inline_result.py b/pyrogram/methods/decorators/on_chosen_inline_result.py index 090f6c042..dd8312ddd 100644 --- a/pyrogram/methods/decorators/on_chosen_inline_result.py +++ b/pyrogram/methods/decorators/on_chosen_inline_result.py @@ -23,11 +23,7 @@ class OnChosenInlineResult: - def on_chosen_inline_result( - self=None, - filters=None, - group: int = 0 - ) -> Callable: + def on_chosen_inline_result(self=None, filters=None, group: int = 0) -> Callable: """Decorator for handling chosen inline results. This does the same thing as :meth:`~pyrogram.Client.add_handler` using the @@ -44,7 +40,9 @@ def on_chosen_inline_result( def decorator(func: Callable) -> Callable: if isinstance(self, pyrogram.Client): - self.add_handler(pyrogram.handlers.ChosenInlineResultHandler(func, filters), group) + self.add_handler( + pyrogram.handlers.ChosenInlineResultHandler(func, filters), group + ) elif isinstance(self, Filter) or self is None: if not hasattr(func, "handlers"): func.handlers = [] @@ -52,7 +50,7 @@ def decorator(func: Callable) -> Callable: func.handlers.append( ( pyrogram.handlers.ChosenInlineResultHandler(func, self), - group if filters is None else filters + group if filters is None else filters, ) ) diff --git a/pyrogram/methods/decorators/on_deleted_messages.py b/pyrogram/methods/decorators/on_deleted_messages.py index 9565c1132..cc1ee4656 100644 --- a/pyrogram/methods/decorators/on_deleted_messages.py +++ b/pyrogram/methods/decorators/on_deleted_messages.py @@ -23,11 +23,7 @@ class OnDeletedMessages: - def on_deleted_messages( - self=None, - filters=None, - group: int = 0 - ) -> Callable: + def on_deleted_messages(self=None, filters=None, group: int = 0) -> Callable: """Decorator for handling deleted messages. This does the same thing as :meth:`~pyrogram.Client.add_handler` using the @@ -44,7 +40,9 @@ def on_deleted_messages( def decorator(func: Callable) -> Callable: if isinstance(self, pyrogram.Client): - self.add_handler(pyrogram.handlers.DeletedMessagesHandler(func, filters), group) + self.add_handler( + pyrogram.handlers.DeletedMessagesHandler(func, filters), group + ) elif isinstance(self, Filter) or self is None: if not hasattr(func, "handlers"): func.handlers = [] @@ -52,7 +50,7 @@ def decorator(func: Callable) -> Callable: func.handlers.append( ( pyrogram.handlers.DeletedMessagesHandler(func, self), - group if filters is None else filters + group if filters is None else filters, ) ) diff --git a/pyrogram/methods/decorators/on_edited_message.py b/pyrogram/methods/decorators/on_edited_message.py index a8c86bb6d..2355447dc 100644 --- a/pyrogram/methods/decorators/on_edited_message.py +++ b/pyrogram/methods/decorators/on_edited_message.py @@ -23,11 +23,7 @@ class OnEditedMessage: - def on_edited_message( - self=None, - filters=None, - group: int = 0 - ) -> Callable: + def on_edited_message(self=None, filters=None, group: int = 0) -> Callable: """Decorator for handling edited messages. This does the same thing as :meth:`~pyrogram.Client.add_handler` using the @@ -44,7 +40,9 @@ def on_edited_message( def decorator(func: Callable) -> Callable: if isinstance(self, pyrogram.Client): - self.add_handler(pyrogram.handlers.EditedMessageHandler(func, filters), group) + self.add_handler( + pyrogram.handlers.EditedMessageHandler(func, filters), group + ) elif isinstance(self, Filter) or self is None: if not hasattr(func, "handlers"): func.handlers = [] @@ -52,7 +50,7 @@ def decorator(func: Callable) -> Callable: func.handlers.append( ( pyrogram.handlers.EditedMessageHandler(func, self), - group if filters is None else filters + group if filters is None else filters, ) ) diff --git a/pyrogram/methods/decorators/on_inline_query.py b/pyrogram/methods/decorators/on_inline_query.py index 6b53a464d..77cc16743 100644 --- a/pyrogram/methods/decorators/on_inline_query.py +++ b/pyrogram/methods/decorators/on_inline_query.py @@ -23,11 +23,7 @@ class OnInlineQuery: - def on_inline_query( - self=None, - filters=None, - group: int = 0 - ) -> Callable: + def on_inline_query(self=None, filters=None, group: int = 0) -> Callable: """Decorator for handling inline queries. This does the same thing as :meth:`~pyrogram.Client.add_handler` using the @@ -44,7 +40,9 @@ def on_inline_query( def decorator(func: Callable) -> Callable: if isinstance(self, pyrogram.Client): - self.add_handler(pyrogram.handlers.InlineQueryHandler(func, filters), group) + self.add_handler( + pyrogram.handlers.InlineQueryHandler(func, filters), group + ) elif isinstance(self, Filter) or self is None: if not hasattr(func, "handlers"): func.handlers = [] @@ -52,7 +50,7 @@ def decorator(func: Callable) -> Callable: func.handlers.append( ( pyrogram.handlers.InlineQueryHandler(func, self), - group if filters is None else filters + group if filters is None else filters, ) ) diff --git a/pyrogram/methods/decorators/on_message.py b/pyrogram/methods/decorators/on_message.py index 220c12bbc..ee5636f9d 100644 --- a/pyrogram/methods/decorators/on_message.py +++ b/pyrogram/methods/decorators/on_message.py @@ -23,11 +23,7 @@ class OnMessage: - def on_message( - self=None, - filters=None, - group: int = 0 - ) -> Callable: + def on_message(self=None, filters=None, group: int = 0) -> Callable: """Decorator for handling new messages. This does the same thing as :meth:`~pyrogram.Client.add_handler` using the @@ -52,7 +48,7 @@ def decorator(func: Callable) -> Callable: func.handlers.append( ( pyrogram.handlers.MessageHandler(func, self), - group if filters is None else filters + group if filters is None else filters, ) ) diff --git a/pyrogram/methods/decorators/on_message_reaction_count_updated.py b/pyrogram/methods/decorators/on_message_reaction_count_updated.py index 37e95a29f..547d8357c 100644 --- a/pyrogram/methods/decorators/on_message_reaction_count_updated.py +++ b/pyrogram/methods/decorators/on_message_reaction_count_updated.py @@ -24,9 +24,7 @@ class OnMessageReactionCountUpdated: def on_message_reaction_count_updated( - self=None, - filters=None, - group: int = 0 + self=None, filters=None, group: int = 0 ) -> Callable: """Decorator for handling anonymous reaction changes on messages. @@ -43,18 +41,23 @@ def on_message_reaction_count_updated( def decorator(func: Callable) -> Callable: if isinstance(self, pyrogram.Client): - self.add_handler(pyrogram.handlers.MessageReactionCountUpdatedHandler(func, filters), group) + self.add_handler( + pyrogram.handlers.MessageReactionCountUpdatedHandler(func, filters), + group, + ) elif isinstance(self, Filter) or self is None: if not hasattr(func, "handlers"): func.handlers = [] func.handlers.append( ( - pyrogram.handlers.MessageReactionCountUpdatedHandler(func, self), - group if filters is None else filters + pyrogram.handlers.MessageReactionCountUpdatedHandler( + func, self + ), + group if filters is None else filters, ) ) return func - return decorator \ No newline at end of file + return decorator diff --git a/pyrogram/methods/decorators/on_message_reaction_updated.py b/pyrogram/methods/decorators/on_message_reaction_updated.py index bc27776b9..1976db9c7 100644 --- a/pyrogram/methods/decorators/on_message_reaction_updated.py +++ b/pyrogram/methods/decorators/on_message_reaction_updated.py @@ -24,9 +24,7 @@ class OnMessageReactionUpdated: def on_message_reaction_updated( - self=None, - filters=None, - group: int = 0 + self=None, filters=None, group: int = 0 ) -> Callable: """Decorator for handling reaction changes on messages. @@ -43,7 +41,10 @@ def on_message_reaction_updated( def decorator(func: Callable) -> Callable: if isinstance(self, pyrogram.Client): - self.add_handler(pyrogram.handlers.MessageReactionUpdatedHandler(func, filters), group) + self.add_handler( + pyrogram.handlers.MessageReactionUpdatedHandler(func, filters), + group, + ) elif isinstance(self, Filter) or self is None: if not hasattr(func, "handlers"): func.handlers = [] @@ -51,10 +52,10 @@ def decorator(func: Callable) -> Callable: func.handlers.append( ( pyrogram.handlers.MessageReactionUpdatedHandler(func, self), - group if filters is None else filters + group if filters is None else filters, ) ) return func - return decorator \ No newline at end of file + return decorator diff --git a/pyrogram/methods/decorators/on_poll.py b/pyrogram/methods/decorators/on_poll.py index 6990c456b..a34d9ceb9 100644 --- a/pyrogram/methods/decorators/on_poll.py +++ b/pyrogram/methods/decorators/on_poll.py @@ -23,11 +23,7 @@ class OnPoll: - def on_poll( - self=None, - filters=None, - group: int = 0 - ) -> Callable: + def on_poll(self=None, filters=None, group: int = 0) -> Callable: """Decorator for handling poll updates. This does the same thing as :meth:`~pyrogram.Client.add_handler` using the @@ -52,7 +48,7 @@ def decorator(func: Callable) -> Callable: func.handlers.append( ( pyrogram.handlers.PollHandler(func, self), - group if filters is None else filters + group if filters is None else filters, ) ) diff --git a/pyrogram/methods/decorators/on_raw_update.py b/pyrogram/methods/decorators/on_raw_update.py index 644bc8a5b..64e1edd5e 100644 --- a/pyrogram/methods/decorators/on_raw_update.py +++ b/pyrogram/methods/decorators/on_raw_update.py @@ -22,10 +22,7 @@ class OnRawUpdate: - def on_raw_update( - self=None, - group: int = 0 - ) -> Callable: + def on_raw_update(self=None, group: int = 0) -> Callable: """Decorator for handling raw updates. This does the same thing as :meth:`~pyrogram.Client.add_handler` using the @@ -43,12 +40,7 @@ def decorator(func: Callable) -> Callable: if not hasattr(func, "handlers"): func.handlers = [] - func.handlers.append( - ( - pyrogram.handlers.RawUpdateHandler(func), - group - ) - ) + func.handlers.append((pyrogram.handlers.RawUpdateHandler(func), group)) return func diff --git a/pyrogram/methods/decorators/on_story.py b/pyrogram/methods/decorators/on_story.py index 6b11cf557..b92620563 100644 --- a/pyrogram/methods/decorators/on_story.py +++ b/pyrogram/methods/decorators/on_story.py @@ -24,11 +24,7 @@ class OnStory: - def on_story( - self=None, - filters=None, - group: int = 0 - ) -> Callable: + def on_story(self=None, filters=None, group: int = 0) -> Callable: """Decorator for handling new stories. This does the same thing as :meth:`~pyrogram.Client.add_handler` using the @@ -53,7 +49,7 @@ def decorator(func: Callable) -> Callable: func.handlers.append( ( pyrogram.handlers.StoryHandler(func, self), - group if filters is None else filters + group if filters is None else filters, ) ) diff --git a/pyrogram/methods/decorators/on_user_status.py b/pyrogram/methods/decorators/on_user_status.py index a4328c37f..96b1f7e3a 100644 --- a/pyrogram/methods/decorators/on_user_status.py +++ b/pyrogram/methods/decorators/on_user_status.py @@ -23,11 +23,7 @@ class OnUserStatus: - def on_user_status( - self=None, - filters=None, - group: int = 0 - ) -> Callable: + def on_user_status(self=None, filters=None, group: int = 0) -> Callable: """Decorator for handling user status updates. This does the same thing as :meth:`~pyrogram.Client.add_handler` using the :obj:`~pyrogram.handlers.UserStatusHandler`. @@ -42,7 +38,9 @@ def on_user_status( def decorator(func: Callable) -> Callable: if isinstance(self, pyrogram.Client): - self.add_handler(pyrogram.handlers.UserStatusHandler(func, filters), group) + self.add_handler( + pyrogram.handlers.UserStatusHandler(func, filters), group + ) elif isinstance(self, Filter) or self is None: if not hasattr(func, "handlers"): func.handlers = [] @@ -50,7 +48,7 @@ def decorator(func: Callable) -> Callable: func.handlers.append( ( pyrogram.handlers.UserStatusHandler(func, self), - group if filters is None else filters + group if filters is None else filters, ) ) diff --git a/pyrogram/methods/invite_links/__init__.py b/pyrogram/methods/invite_links/__init__.py index 67c1d1495..23144df18 100644 --- a/pyrogram/methods/invite_links/__init__.py +++ b/pyrogram/methods/invite_links/__init__.py @@ -53,6 +53,6 @@ class InviteLinks( DeclineChatJoinRequest, ApproveAllChatJoinRequests, DeclineAllChatJoinRequests, - GetChatJoinRequests + GetChatJoinRequests, ): pass diff --git a/pyrogram/methods/invite_links/approve_all_chat_join_requests.py b/pyrogram/methods/invite_links/approve_all_chat_join_requests.py index 3cbf778a2..b66373caf 100644 --- a/pyrogram/methods/invite_links/approve_all_chat_join_requests.py +++ b/pyrogram/methods/invite_links/approve_all_chat_join_requests.py @@ -24,9 +24,7 @@ class ApproveAllChatJoinRequests: async def approve_all_chat_join_requests( - self: "pyrogram.Client", - chat_id: Union[int, str], - invite_link: str = None + self: "pyrogram.Client", chat_id: Union[int, str], invite_link: str = None ) -> bool: """Approve all pending join requests in a chat. @@ -47,9 +45,7 @@ async def approve_all_chat_join_requests( """ await self.invoke( raw.functions.messages.HideAllChatJoinRequests( - peer=await self.resolve_peer(chat_id), - approved=True, - link=invite_link + peer=await self.resolve_peer(chat_id), approved=True, link=invite_link ) ) diff --git a/pyrogram/methods/invite_links/approve_chat_join_request.py b/pyrogram/methods/invite_links/approve_chat_join_request.py index 6b5f9b174..24a248892 100644 --- a/pyrogram/methods/invite_links/approve_chat_join_request.py +++ b/pyrogram/methods/invite_links/approve_chat_join_request.py @@ -52,7 +52,7 @@ async def approve_chat_join_request( raw.functions.messages.HideChatJoinRequest( peer=await self.resolve_peer(chat_id), user_id=await self.resolve_peer(user_id), - approved=True + approved=True, ) ) diff --git a/pyrogram/methods/invite_links/create_chat_invite_link.py b/pyrogram/methods/invite_links/create_chat_invite_link.py index ce70a0ad4..f0ebc81ff 100644 --- a/pyrogram/methods/invite_links/create_chat_invite_link.py +++ b/pyrogram/methods/invite_links/create_chat_invite_link.py @@ -31,7 +31,7 @@ async def create_chat_invite_link( name: str = None, expire_date: datetime = None, member_limit: int = None, - creates_join_request: bool = None + creates_join_request: bool = None, ) -> "types.ChatInviteLink": """Create an additional invite link for a chat. @@ -81,7 +81,7 @@ async def create_chat_invite_link( expire_date=utils.datetime_to_timestamp(expire_date), usage_limit=member_limit, title=name, - request_needed=creates_join_request + request_needed=creates_join_request, ) ) diff --git a/pyrogram/methods/invite_links/decline_all_chat_join_requests.py b/pyrogram/methods/invite_links/decline_all_chat_join_requests.py index 2a135c63b..2b6f17961 100644 --- a/pyrogram/methods/invite_links/decline_all_chat_join_requests.py +++ b/pyrogram/methods/invite_links/decline_all_chat_join_requests.py @@ -24,9 +24,7 @@ class DeclineAllChatJoinRequests: async def decline_all_chat_join_requests( - self: "pyrogram.Client", - chat_id: Union[int, str], - invite_link: str = None + self: "pyrogram.Client", chat_id: Union[int, str], invite_link: str = None ) -> bool: """Decline all pending join requests in a chat. @@ -47,9 +45,7 @@ async def decline_all_chat_join_requests( """ await self.invoke( raw.functions.messages.HideAllChatJoinRequests( - peer=await self.resolve_peer(chat_id), - approved=False, - link=invite_link + peer=await self.resolve_peer(chat_id), approved=False, link=invite_link ) ) diff --git a/pyrogram/methods/invite_links/decline_chat_join_request.py b/pyrogram/methods/invite_links/decline_chat_join_request.py index 2379071f4..62d5e8751 100644 --- a/pyrogram/methods/invite_links/decline_chat_join_request.py +++ b/pyrogram/methods/invite_links/decline_chat_join_request.py @@ -52,7 +52,7 @@ async def decline_chat_join_request( raw.functions.messages.HideChatJoinRequest( peer=await self.resolve_peer(chat_id), user_id=await self.resolve_peer(user_id), - approved=False + approved=False, ) ) diff --git a/pyrogram/methods/invite_links/edit_chat_invite_link.py b/pyrogram/methods/invite_links/edit_chat_invite_link.py index a29995e4c..b56aeeb72 100644 --- a/pyrogram/methods/invite_links/edit_chat_invite_link.py +++ b/pyrogram/methods/invite_links/edit_chat_invite_link.py @@ -32,7 +32,7 @@ async def edit_chat_invite_link( name: str = None, expire_date: datetime = None, member_limit: int = None, - creates_join_request: bool = None + creates_join_request: bool = None, ) -> "types.ChatInviteLink": """Edit a non-primary invite link. @@ -84,7 +84,7 @@ async def edit_chat_invite_link( expire_date=utils.datetime_to_timestamp(expire_date), usage_limit=member_limit, title=name, - request_needed=creates_join_request + request_needed=creates_join_request, ) ) diff --git a/pyrogram/methods/invite_links/export_chat_invite_link.py b/pyrogram/methods/invite_links/export_chat_invite_link.py index 8c6badb04..6441084e4 100644 --- a/pyrogram/methods/invite_links/export_chat_invite_link.py +++ b/pyrogram/methods/invite_links/export_chat_invite_link.py @@ -58,8 +58,7 @@ async def export_chat_invite_link( """ r = await self.invoke( raw.functions.messages.ExportChatInvite( - peer=await self.resolve_peer(chat_id), - legacy_revoke_permanent=True + peer=await self.resolve_peer(chat_id), legacy_revoke_permanent=True ) ) diff --git a/pyrogram/methods/invite_links/get_chat_admin_invite_links.py b/pyrogram/methods/invite_links/get_chat_admin_invite_links.py index 921042b2b..c62c028e3 100644 --- a/pyrogram/methods/invite_links/get_chat_admin_invite_links.py +++ b/pyrogram/methods/invite_links/get_chat_admin_invite_links.py @@ -81,7 +81,7 @@ async def get_chat_admin_invite_links( limit=limit, revoked=revoked, offset_date=offset_date, - offset_link=offset_link + offset_link=offset_link, ) ) diff --git a/pyrogram/methods/invite_links/get_chat_admin_invite_links_count.py b/pyrogram/methods/invite_links/get_chat_admin_invite_links_count.py index 9c4b175ca..13b7f1351 100644 --- a/pyrogram/methods/invite_links/get_chat_admin_invite_links_count.py +++ b/pyrogram/methods/invite_links/get_chat_admin_invite_links_count.py @@ -57,7 +57,7 @@ async def get_chat_admin_invite_links_count( peer=await self.resolve_peer(chat_id), admin_id=await self.resolve_peer(admin_id), limit=1, - revoked=revoked + revoked=revoked, ) ) diff --git a/pyrogram/methods/invite_links/get_chat_invite_link.py b/pyrogram/methods/invite_links/get_chat_invite_link.py index 2867f226a..9e5f0d296 100644 --- a/pyrogram/methods/invite_links/get_chat_invite_link.py +++ b/pyrogram/methods/invite_links/get_chat_invite_link.py @@ -47,8 +47,7 @@ async def get_chat_invite_link( """ r = await self.invoke( raw.functions.messages.GetExportedChatInvite( - peer=await self.resolve_peer(chat_id), - link=invite_link + peer=await self.resolve_peer(chat_id), link=invite_link ) ) diff --git a/pyrogram/methods/invite_links/get_chat_invite_link_joiners.py b/pyrogram/methods/invite_links/get_chat_invite_link_joiners.py index 9bc0e54af..3bbde54ea 100644 --- a/pyrogram/methods/invite_links/get_chat_invite_link_joiners.py +++ b/pyrogram/methods/invite_links/get_chat_invite_link_joiners.py @@ -28,7 +28,7 @@ async def get_chat_invite_link_joiners( self: "pyrogram.Client", chat_id: Union[int, str], invite_link: str, - limit: int = 0 + limit: int = 0, ) -> Optional[AsyncGenerator["types.ChatJoiner", None]]: """Get the members who joined the chat with the invite link. @@ -67,7 +67,7 @@ async def get_chat_invite_link_joiners( link=invite_link, limit=limit, offset_date=offset_date, - offset_user=offset_user + offset_user=offset_user, ) ) diff --git a/pyrogram/methods/invite_links/get_chat_invite_link_joiners_count.py b/pyrogram/methods/invite_links/get_chat_invite_link_joiners_count.py index cb032ef4a..1bd3b817d 100644 --- a/pyrogram/methods/invite_links/get_chat_invite_link_joiners_count.py +++ b/pyrogram/methods/invite_links/get_chat_invite_link_joiners_count.py @@ -24,9 +24,7 @@ class GetChatInviteLinkJoinersCount: async def get_chat_invite_link_joiners_count( - self: "pyrogram.Client", - chat_id: Union[int, str], - invite_link: str + self: "pyrogram.Client", chat_id: Union[int, str], invite_link: str ) -> int: """Get the count of the members who joined the chat with the invite link. @@ -50,7 +48,7 @@ async def get_chat_invite_link_joiners_count( link=invite_link, limit=1, offset_date=0, - offset_user=raw.types.InputUserEmpty() + offset_user=raw.types.InputUserEmpty(), ) ) diff --git a/pyrogram/methods/invite_links/get_chat_join_requests.py b/pyrogram/methods/invite_links/get_chat_join_requests.py index 20a20fb1f..4fe272be9 100644 --- a/pyrogram/methods/invite_links/get_chat_join_requests.py +++ b/pyrogram/methods/invite_links/get_chat_join_requests.py @@ -28,7 +28,7 @@ async def get_chat_join_requests( self: "pyrogram.Client", chat_id: Union[int, str], limit: int = 0, - query: str = "" + query: str = "", ) -> Optional[AsyncGenerator["types.ChatJoiner", None]]: """Get the pending join requests of a chat. @@ -68,7 +68,7 @@ async def get_chat_join_requests( offset_date=offset_date, offset_user=offset_user, requested=True, - q=query + q=query, ) ) diff --git a/pyrogram/methods/invite_links/revoke_chat_invite_link.py b/pyrogram/methods/invite_links/revoke_chat_invite_link.py index 144c5a389..1afa17bc2 100644 --- a/pyrogram/methods/invite_links/revoke_chat_invite_link.py +++ b/pyrogram/methods/invite_links/revoke_chat_invite_link.py @@ -52,9 +52,7 @@ async def revoke_chat_invite_link( r = await self.invoke( raw.functions.messages.EditExportedChatInvite( - peer=await self.resolve_peer(chat_id), - link=invite_link, - revoked=True + peer=await self.resolve_peer(chat_id), link=invite_link, revoked=True ) ) diff --git a/pyrogram/methods/messages/__init__.py b/pyrogram/methods/messages/__init__.py index 3007290cf..414d8ce56 100644 --- a/pyrogram/methods/messages/__init__.py +++ b/pyrogram/methods/messages/__init__.py @@ -116,6 +116,6 @@ class Messages( GetDiscussionReplies, GetDiscussionRepliesCount, StreamMedia, - GetCustomEmojiStickers + GetCustomEmojiStickers, ): pass diff --git a/pyrogram/methods/messages/copy_media_group.py b/pyrogram/methods/messages/copy_media_group.py index b0e14afe3..2cb7f9c2a 100644 --- a/pyrogram/methods/messages/copy_media_group.py +++ b/pyrogram/methods/messages/copy_media_group.py @@ -96,7 +96,7 @@ async def copy_media_group( await app.copy_media_group(to_chat, from_chat, 123) await app.copy_media_group(to_chat, from_chat, 123, captions="single caption") - + await app.copy_media_group(to_chat, from_chat, 123, captions=["caption 1", None, ""]) """ @@ -106,7 +106,10 @@ async def copy_media_group( reply_to = None if reply_to_message_id or message_thread_id: - reply_to = types.InputReplyToMessage(reply_to_message_id=reply_to_message_id, message_thread_id=message_thread_id) + reply_to = types.InputReplyToMessage( + reply_to_message_id=reply_to_message_id, + message_thread_id=message_thread_id, + ) for i, message in enumerate(media_group): if message.photo: @@ -126,10 +129,18 @@ async def copy_media_group( media=media, random_id=self.rnd_id(), **await self.parser.parse( - captions[i] if isinstance(captions, list) and i < len(captions) and captions[i] else - captions if isinstance(captions, str) and i == 0 else - message.caption if message.caption and message.caption != "None" and not type( - captions) is str else "") + captions[i] + if isinstance(captions, list) + and i < len(captions) + and captions[i] + else captions + if isinstance(captions, str) and i == 0 + else message.caption + if message.caption + and message.caption != "None" + and not type(captions) is str + else "" + ) ) ) @@ -140,21 +151,29 @@ async def copy_media_group( silent=disable_notification or None, reply_to=reply_to, noforwards=protect_content, - schedule_date=utils.datetime_to_timestamp(schedule_date) + schedule_date=utils.datetime_to_timestamp(schedule_date), ), - sleep_threshold=60 + sleep_threshold=60, ) return await utils.parse_messages( self, raw.types.messages.Messages( - messages=[m.message for m in filter( - lambda u: isinstance(u, (raw.types.UpdateNewMessage, - raw.types.UpdateNewChannelMessage, - raw.types.UpdateNewScheduledMessage)), - r.updates - )], + messages=[ + m.message + for m in filter( + lambda u: isinstance( + u, + ( + raw.types.UpdateNewMessage, + raw.types.UpdateNewChannelMessage, + raw.types.UpdateNewScheduledMessage, + ), + ), + r.updates, + ) + ], users=r.users, - chats=r.chats - ) + chats=r.chats, + ), ) diff --git a/pyrogram/methods/messages/copy_message.py b/pyrogram/methods/messages/copy_message.py index 8629d095c..88a59bf53 100644 --- a/pyrogram/methods/messages/copy_message.py +++ b/pyrogram/methods/messages/copy_message.py @@ -46,8 +46,8 @@ async def copy_message( "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None + "types.ForceReply", + ] = None, ) -> "types.Message": """Copy messages of any kind. @@ -131,5 +131,5 @@ async def copy_message( reply_to_message_id=reply_to_message_id, schedule_date=schedule_date, protect_content=protect_content, - reply_markup=reply_markup + reply_markup=reply_markup, ) diff --git a/pyrogram/methods/messages/delete_messages.py b/pyrogram/methods/messages/delete_messages.py index 91859e82b..6d4c8be1a 100644 --- a/pyrogram/methods/messages/delete_messages.py +++ b/pyrogram/methods/messages/delete_messages.py @@ -27,7 +27,7 @@ async def delete_messages( self: "pyrogram.Client", chat_id: Union[int, str], message_ids: Union[int, Iterable[int]], - revoke: bool = True + revoke: bool = True, ) -> int: """Delete messages, including service messages. @@ -65,21 +65,17 @@ async def delete_messages( await app.delete_messages(chat_id, message_id, revoke=False) """ peer = await self.resolve_peer(chat_id) - message_ids = list(message_ids) if not isinstance(message_ids, int) else [message_ids] + message_ids = ( + list(message_ids) if not isinstance(message_ids, int) else [message_ids] + ) if isinstance(peer, raw.types.InputPeerChannel): r = await self.invoke( - raw.functions.channels.DeleteMessages( - channel=peer, - id=message_ids - ) + raw.functions.channels.DeleteMessages(channel=peer, id=message_ids) ) else: r = await self.invoke( - raw.functions.messages.DeleteMessages( - id=message_ids, - revoke=revoke - ) + raw.functions.messages.DeleteMessages(id=message_ids, revoke=revoke) ) return r.pts_count diff --git a/pyrogram/methods/messages/download_media.py b/pyrogram/methods/messages/download_media.py index ce58a42c6..285e2b37e 100644 --- a/pyrogram/methods/messages/download_media.py +++ b/pyrogram/methods/messages/download_media.py @@ -36,7 +36,7 @@ async def download_media( in_memory: bool = False, block: bool = True, progress: Callable = None, - progress_args: tuple = () + progress_args: tuple = (), ) -> Optional[Union[str, BinaryIO]]: """Download the media from a message. @@ -119,8 +119,17 @@ async def progress(current, total): file_name = file.name file_bytes = bytes(file.getbuffer()) """ - available_media = ("audio", "document", "photo", "sticker", "animation", "video", "voice", "video_note", - "new_chat_photo") + available_media = ( + "audio", + "document", + "photo", + "sticker", + "animation", + "video", + "voice", + "video_note", + "new_chat_photo", + ) if isinstance(message, types.Message) or isinstance(message, types.Story): for kind in available_media: @@ -174,11 +183,19 @@ async def progress(current, total): FileType(file_id_obj.file_type).name.lower(), (date or datetime.now()).strftime("%Y-%m-%d_%H-%M-%S"), self.rnd_id(), - extension + extension, ) downloader = self.handle_download( - (file_id_obj, directory, file_name, in_memory, file_size, progress, progress_args) + ( + file_id_obj, + directory, + file_name, + in_memory, + file_size, + progress, + progress_args, + ) ) if block: diff --git a/pyrogram/methods/messages/edit_inline_caption.py b/pyrogram/methods/messages/edit_inline_caption.py index 69c733341..af9704dfe 100644 --- a/pyrogram/methods/messages/edit_inline_caption.py +++ b/pyrogram/methods/messages/edit_inline_caption.py @@ -28,7 +28,7 @@ async def edit_inline_caption( inline_message_id: str, caption: str, parse_mode: Optional["enums.ParseMode"] = None, - reply_markup: "types.InlineKeyboardMarkup" = None + reply_markup: "types.InlineKeyboardMarkup" = None, ) -> bool: """Edit the caption of inline media messages. @@ -61,5 +61,5 @@ async def edit_inline_caption( inline_message_id=inline_message_id, text=caption, parse_mode=parse_mode, - reply_markup=reply_markup + reply_markup=reply_markup, ) diff --git a/pyrogram/methods/messages/edit_inline_media.py b/pyrogram/methods/messages/edit_inline_media.py index 7ab424a4f..b87fd96dd 100644 --- a/pyrogram/methods/messages/edit_inline_media.py +++ b/pyrogram/methods/messages/edit_inline_media.py @@ -37,7 +37,7 @@ async def edit_inline_media( self: "pyrogram.Client", inline_message_id: str, media: "types.InputMedia", - reply_markup: "types.InlineKeyboardMarkup" = None + reply_markup: "types.InlineKeyboardMarkup" = None, ) -> bool: """Edit inline animation, audio, document, photo or video messages. @@ -90,7 +90,9 @@ async def edit_inline_media( if is_uploaded_file: filename_attribute = [ raw.types.DocumentAttributeFilename( - file_name=media.media.name if is_bytes_io else os.path.basename(media.media) + file_name=media.media.name + if is_bytes_io + else os.path.basename(media.media) ) ] else: @@ -99,99 +101,110 @@ async def edit_inline_media( if isinstance(media, types.InputMediaPhoto): if is_uploaded_file: media = raw.types.InputMediaUploadedPhoto( - file=await self.save_file(media.media), - spoiler=media.has_spoiler + file=await self.save_file(media.media), spoiler=media.has_spoiler ) elif is_external_url: media = raw.types.InputMediaPhotoExternal( - url=media.media, - spoiler=media.has_spoiler + url=media.media, spoiler=media.has_spoiler ) else: media = utils.get_input_media_from_file_id(media.media, FileType.PHOTO) elif isinstance(media, types.InputMediaVideo): if is_uploaded_file: media = raw.types.InputMediaUploadedDocument( - mime_type=(None if is_bytes_io else self.guess_mime_type(media.media)) or "video/mp4", + mime_type=( + None if is_bytes_io else self.guess_mime_type(media.media) + ) + or "video/mp4", thumb=await self.save_file(media.thumb), file=await self.save_file(media.media), spoiler=media.has_spoiler, attributes=[ - raw.types.DocumentAttributeVideo( - supports_streaming=media.supports_streaming or None, - duration=media.duration, - w=media.width, - h=media.height - ) - ] + filename_attribute + raw.types.DocumentAttributeVideo( + supports_streaming=media.supports_streaming or None, + duration=media.duration, + w=media.width, + h=media.height, + ) + ] + + filename_attribute, ) elif is_external_url: media = raw.types.InputMediaDocumentExternal( - url=media.media, - spoiler=media.has_spoiler + url=media.media, spoiler=media.has_spoiler ) else: media = utils.get_input_media_from_file_id(media.media, FileType.VIDEO) elif isinstance(media, types.InputMediaAudio): if is_uploaded_file: media = raw.types.InputMediaUploadedDocument( - mime_type=(None if is_bytes_io else self.guess_mime_type(media.media)) or "audio/mpeg", + mime_type=( + None if is_bytes_io else self.guess_mime_type(media.media) + ) + or "audio/mpeg", thumb=await self.save_file(media.thumb), file=await self.save_file(media.media), attributes=[ - raw.types.DocumentAttributeAudio( - duration=media.duration, - performer=media.performer, - title=media.title - ) - ] + filename_attribute + raw.types.DocumentAttributeAudio( + duration=media.duration, + performer=media.performer, + title=media.title, + ) + ] + + filename_attribute, ) elif is_external_url: - media = raw.types.InputMediaDocumentExternal( - url=media.media - ) + media = raw.types.InputMediaDocumentExternal(url=media.media) else: media = utils.get_input_media_from_file_id(media.media, FileType.AUDIO) elif isinstance(media, types.InputMediaAnimation): if is_uploaded_file: media = raw.types.InputMediaUploadedDocument( - mime_type=(None if is_bytes_io else self.guess_mime_type(media.media)) or "video/mp4", + mime_type=( + None if is_bytes_io else self.guess_mime_type(media.media) + ) + or "video/mp4", thumb=await self.save_file(media.thumb), file=await self.save_file(media.media), spoiler=media.has_spoiler, attributes=[ - raw.types.DocumentAttributeVideo( - supports_streaming=True, - duration=media.duration, - w=media.width, - h=media.height - ), - raw.types.DocumentAttributeAnimated() - ] + filename_attribute, - nosound_video=True + raw.types.DocumentAttributeVideo( + supports_streaming=True, + duration=media.duration, + w=media.width, + h=media.height, + ), + raw.types.DocumentAttributeAnimated(), + ] + + filename_attribute, + nosound_video=True, ) elif is_external_url: media = raw.types.InputMediaDocumentExternal( - url=media.media, - spoiler=media.has_spoiler + url=media.media, spoiler=media.has_spoiler ) else: - media = utils.get_input_media_from_file_id(media.media, FileType.ANIMATION) + media = utils.get_input_media_from_file_id( + media.media, FileType.ANIMATION + ) elif isinstance(media, types.InputMediaDocument): if is_uploaded_file: media = raw.types.InputMediaUploadedDocument( - mime_type=(None if is_bytes_io else self.guess_mime_type(media.media)) or "application/zip", + mime_type=( + None if is_bytes_io else self.guess_mime_type(media.media) + ) + or "application/zip", thumb=await self.save_file(media.thumb), file=await self.save_file(media.media), attributes=filename_attribute, - force_file=True + force_file=True, ) elif is_external_url: - media = raw.types.InputMediaDocumentExternal( - url=media.media - ) + media = raw.types.InputMediaDocumentExternal(url=media.media) else: - media = utils.get_input_media_from_file_id(media.media, FileType.DOCUMENT) + media = utils.get_input_media_from_file_id( + media.media, FileType.DOCUMENT + ) unpacked = utils.unpack_inline_message_id(inline_message_id) dc_id = unpacked.dc_id @@ -201,25 +214,28 @@ async def edit_inline_media( if is_uploaded_file: uploaded_media = await self.invoke( raw.functions.messages.UploadMedia( - peer=raw.types.InputPeerSelf(), - media=media + peer=raw.types.InputPeerSelf(), media=media ) ) - actual_media = raw.types.InputMediaPhoto( - id=raw.types.InputPhoto( - id=uploaded_media.photo.id, - access_hash=uploaded_media.photo.access_hash, - file_reference=uploaded_media.photo.file_reference - ), - spoiler=getattr(media, "has_spoiler", None) - ) if isinstance(media, types.InputMediaPhoto) else raw.types.InputMediaDocument( - id=raw.types.InputDocument( - id=uploaded_media.document.id, - access_hash=uploaded_media.document.access_hash, - file_reference=uploaded_media.document.file_reference - ), - spoiler=getattr(media, "has_spoiler", None) + actual_media = ( + raw.types.InputMediaPhoto( + id=raw.types.InputPhoto( + id=uploaded_media.photo.id, + access_hash=uploaded_media.photo.access_hash, + file_reference=uploaded_media.photo.file_reference, + ), + spoiler=getattr(media, "has_spoiler", None), + ) + if isinstance(media, types.InputMediaPhoto) + else raw.types.InputMediaDocument( + id=raw.types.InputDocument( + id=uploaded_media.document.id, + access_hash=uploaded_media.document.access_hash, + file_reference=uploaded_media.document.file_reference, + ), + spoiler=getattr(media, "has_spoiler", None), + ) ) else: actual_media = media @@ -230,10 +246,12 @@ async def edit_inline_media( raw.functions.messages.EditInlineBotMessage( id=unpacked, media=actual_media, - reply_markup=await reply_markup.write(self) if reply_markup else None, + reply_markup=await reply_markup.write(self) + if reply_markup + else None, **await self.parser.parse(caption, parse_mode) ), - sleep_threshold=self.sleep_threshold + sleep_threshold=self.sleep_threshold, ) except RPCError as e: if i == self.MAX_RETRIES - 1: diff --git a/pyrogram/methods/messages/edit_inline_reply_markup.py b/pyrogram/methods/messages/edit_inline_reply_markup.py index e2ef40e16..40b843553 100644 --- a/pyrogram/methods/messages/edit_inline_reply_markup.py +++ b/pyrogram/methods/messages/edit_inline_reply_markup.py @@ -27,7 +27,7 @@ class EditInlineReplyMarkup: async def edit_inline_reply_markup( self: "pyrogram.Client", inline_message_id: str, - reply_markup: "types.InlineKeyboardMarkup" = None + reply_markup: "types.InlineKeyboardMarkup" = None, ) -> bool: """Edit only the reply markup of inline messages sent via the bot (for inline bots). @@ -65,5 +65,5 @@ async def edit_inline_reply_markup( id=unpacked, reply_markup=await reply_markup.write(self) if reply_markup else None, ), - sleep_threshold=self.sleep_threshold + sleep_threshold=self.sleep_threshold, ) diff --git a/pyrogram/methods/messages/edit_inline_text.py b/pyrogram/methods/messages/edit_inline_text.py index 354c55a33..5ade2fac1 100644 --- a/pyrogram/methods/messages/edit_inline_text.py +++ b/pyrogram/methods/messages/edit_inline_text.py @@ -32,7 +32,7 @@ async def edit_inline_text( text: str, parse_mode: Optional["enums.ParseMode"] = None, disable_web_page_preview: bool = None, - reply_markup: "types.InlineKeyboardMarkup" = None + reply_markup: "types.InlineKeyboardMarkup" = None, ) -> bool: """Edit the text of inline messages. @@ -84,5 +84,5 @@ async def edit_inline_text( reply_markup=await reply_markup.write(self) if reply_markup else None, **await self.parser.parse(text, parse_mode) ), - sleep_threshold=self.sleep_threshold + sleep_threshold=self.sleep_threshold, ) diff --git a/pyrogram/methods/messages/edit_message_caption.py b/pyrogram/methods/messages/edit_message_caption.py index 4fc4bfdb1..8c5846276 100644 --- a/pyrogram/methods/messages/edit_message_caption.py +++ b/pyrogram/methods/messages/edit_message_caption.py @@ -30,7 +30,7 @@ async def edit_message_caption( caption: str, parse_mode: Optional["enums.ParseMode"] = None, caption_entities: List["types.MessageEntity"] = None, - reply_markup: "types.InlineKeyboardMarkup" = None + reply_markup: "types.InlineKeyboardMarkup" = None, ) -> "types.Message": """Edit the caption of media messages. @@ -73,5 +73,5 @@ async def edit_message_caption( text=caption, parse_mode=parse_mode, entities=caption_entities, - reply_markup=reply_markup + reply_markup=reply_markup, ) diff --git a/pyrogram/methods/messages/edit_message_media.py b/pyrogram/methods/messages/edit_message_media.py index 2ab0a5c9a..9ec48e88f 100644 --- a/pyrogram/methods/messages/edit_message_media.py +++ b/pyrogram/methods/messages/edit_message_media.py @@ -35,7 +35,7 @@ async def edit_message_media( message_id: int, media: "types.InputMedia", reply_markup: "types.InlineKeyboardMarkup" = None, - file_name: str = None + file_name: str = None, ) -> "types.Message": """Edit animation, audio, document, photo or video messages. @@ -99,8 +99,8 @@ async def edit_message_media( peer=await self.resolve_peer(chat_id), media=raw.types.InputMediaUploadedPhoto( file=await self.save_file(media.media), - spoiler=media.has_spoiler - ) + spoiler=media.has_spoiler, + ), ) ) @@ -108,14 +108,13 @@ async def edit_message_media( id=raw.types.InputPhoto( id=uploaded_media.photo.id, access_hash=uploaded_media.photo.access_hash, - file_reference=uploaded_media.photo.file_reference + file_reference=uploaded_media.photo.file_reference, ), - spoiler=media.has_spoiler + spoiler=media.has_spoiler, ) elif re.match("^https?://", media.media): media = raw.types.InputMediaPhotoExternal( - url=media.media, - spoiler=media.has_spoiler + url=media.media, spoiler=media.has_spoiler ) else: media = utils.get_input_media_from_file_id(media.media, FileType.PHOTO) @@ -134,13 +133,13 @@ async def edit_message_media( supports_streaming=media.supports_streaming or None, duration=media.duration, w=media.width, - h=media.height + h=media.height, ), raw.types.DocumentAttributeFilename( file_name=file_name or os.path.basename(media.media) - ) - ] - ) + ), + ], + ), ) ) @@ -148,14 +147,13 @@ async def edit_message_media( id=raw.types.InputDocument( id=uploaded_media.document.id, access_hash=uploaded_media.document.access_hash, - file_reference=uploaded_media.document.file_reference + file_reference=uploaded_media.document.file_reference, ), - spoiler=media.has_spoiler + spoiler=media.has_spoiler, ) elif re.match("^https?://", media.media): media = raw.types.InputMediaDocumentExternal( - url=media.media, - spoiler=media.has_spoiler + url=media.media, spoiler=media.has_spoiler ) else: media = utils.get_input_media_from_file_id(media.media, FileType.VIDEO) @@ -172,13 +170,13 @@ async def edit_message_media( raw.types.DocumentAttributeAudio( duration=media.duration, performer=media.performer, - title=media.title + title=media.title, ), raw.types.DocumentAttributeFilename( file_name=file_name or os.path.basename(media.media) - ) - ] - ) + ), + ], + ), ) ) @@ -186,13 +184,11 @@ async def edit_message_media( id=raw.types.InputDocument( id=media.document.id, access_hash=media.document.access_hash, - file_reference=media.document.file_reference + file_reference=media.document.file_reference, ) ) elif re.match("^https?://", media.media): - media = raw.types.InputMediaDocumentExternal( - url=media.media - ) + media = raw.types.InputMediaDocumentExternal(url=media.media) else: media = utils.get_input_media_from_file_id(media.media, FileType.AUDIO) elif isinstance(media, types.InputMediaAnimation): @@ -210,14 +206,14 @@ async def edit_message_media( supports_streaming=True, duration=media.duration, w=media.width, - h=media.height + h=media.height, ), raw.types.DocumentAttributeFilename( file_name=file_name or os.path.basename(media.media) ), - raw.types.DocumentAttributeAnimated() - ] - ) + raw.types.DocumentAttributeAnimated(), + ], + ), ) ) @@ -225,32 +221,34 @@ async def edit_message_media( id=raw.types.InputDocument( id=uploaded_media.document.id, access_hash=uploaded_media.document.access_hash, - file_reference=uploaded_media.document.file_reference + file_reference=uploaded_media.document.file_reference, ), - spoiler=media.has_spoiler + spoiler=media.has_spoiler, ) elif re.match("^https?://", media.media): media = raw.types.InputMediaDocumentExternal( - url=media.media, - spoiler=media.has_spoiler + url=media.media, spoiler=media.has_spoiler ) else: - media = utils.get_input_media_from_file_id(media.media, FileType.ANIMATION) + media = utils.get_input_media_from_file_id( + media.media, FileType.ANIMATION + ) elif isinstance(media, types.InputMediaDocument): if isinstance(media.media, io.BytesIO) or os.path.isfile(media.media): media = await self.invoke( raw.functions.messages.UploadMedia( peer=await self.resolve_peer(chat_id), media=raw.types.InputMediaUploadedDocument( - mime_type=self.guess_mime_type(media.media) or "application/zip", + mime_type=self.guess_mime_type(media.media) + or "application/zip", thumb=await self.save_file(media.thumb), file=await self.save_file(media.media), attributes=[ raw.types.DocumentAttributeFilename( file_name=file_name or os.path.basename(media.media) ) - ] - ) + ], + ), ) ) @@ -258,15 +256,15 @@ async def edit_message_media( id=raw.types.InputDocument( id=media.document.id, access_hash=media.document.access_hash, - file_reference=media.document.file_reference + file_reference=media.document.file_reference, ) ) elif re.match("^https?://", media.media): - media = raw.types.InputMediaDocumentExternal( - url=media.media - ) + media = raw.types.InputMediaDocumentExternal(url=media.media) else: - media = utils.get_input_media_from_file_id(media.media, FileType.DOCUMENT) + media = utils.get_input_media_from_file_id( + media.media, FileType.DOCUMENT + ) r = await self.invoke( raw.functions.messages.EditMessage( @@ -275,14 +273,17 @@ async def edit_message_media( media=media, reply_markup=await reply_markup.write(self) if reply_markup else None, message=message, - entities=entities + entities=entities, ) ) for i in r.updates: - if isinstance(i, (raw.types.UpdateEditMessage, raw.types.UpdateEditChannelMessage)): + if isinstance( + i, (raw.types.UpdateEditMessage, raw.types.UpdateEditChannelMessage) + ): return await types.Message._parse( - self, i.message, + self, + i.message, {i.id: i for i in r.users}, - {i.id: i for i in r.chats} + {i.id: i for i in r.chats}, ) diff --git a/pyrogram/methods/messages/edit_message_reply_markup.py b/pyrogram/methods/messages/edit_message_reply_markup.py index 68b568bee..c729201b3 100644 --- a/pyrogram/methods/messages/edit_message_reply_markup.py +++ b/pyrogram/methods/messages/edit_message_reply_markup.py @@ -70,9 +70,12 @@ async def edit_message_reply_markup( ) for i in r.updates: - if isinstance(i, (raw.types.UpdateEditMessage, raw.types.UpdateEditChannelMessage)): + if isinstance( + i, (raw.types.UpdateEditMessage, raw.types.UpdateEditChannelMessage) + ): return await types.Message._parse( - self, i.message, + self, + i.message, {i.id: i for i in r.users}, - {i.id: i for i in r.chats} + {i.id: i for i in r.chats}, ) diff --git a/pyrogram/methods/messages/edit_message_text.py b/pyrogram/methods/messages/edit_message_text.py index c1e0df093..e912c204b 100644 --- a/pyrogram/methods/messages/edit_message_text.py +++ b/pyrogram/methods/messages/edit_message_text.py @@ -33,7 +33,7 @@ async def edit_message_text( parse_mode: Optional["enums.ParseMode"] = None, entities: List["types.MessageEntity"] = None, disable_web_page_preview: bool = None, - reply_markup: "types.InlineKeyboardMarkup" = None + reply_markup: "types.InlineKeyboardMarkup" = None, ) -> "types.Message": """Edit the text of messages. @@ -91,9 +91,12 @@ async def edit_message_text( ) for i in r.updates: - if isinstance(i, (raw.types.UpdateEditMessage, raw.types.UpdateEditChannelMessage)): + if isinstance( + i, (raw.types.UpdateEditMessage, raw.types.UpdateEditChannelMessage) + ): return await types.Message._parse( - self, i.message, + self, + i.message, {i.id: i for i in r.users}, - {i.id: i for i in r.chats} + {i.id: i for i in r.chats}, ) diff --git a/pyrogram/methods/messages/forward_messages.py b/pyrogram/methods/messages/forward_messages.py index f47e85780..37f44ddca 100644 --- a/pyrogram/methods/messages/forward_messages.py +++ b/pyrogram/methods/messages/forward_messages.py @@ -35,7 +35,7 @@ async def forward_messages( disable_notification: bool = None, schedule_date: datetime = None, protect_content: bool = None, - drop_author: bool = None + drop_author: bool = None, ) -> Union["types.Message", List["types.Message"]]: """Forward messages of any kind. @@ -101,7 +101,7 @@ async def forward_messages( random_id=[self.rnd_id() for _ in message_ids], schedule_date=utils.datetime_to_timestamp(schedule_date), noforwards=protect_content, - drop_author=drop_author + drop_author=drop_author, ) ) @@ -111,14 +111,16 @@ async def forward_messages( chats = {i.id: i for i in r.chats} for i in r.updates: - if isinstance(i, (raw.types.UpdateNewMessage, - raw.types.UpdateNewChannelMessage, - raw.types.UpdateNewScheduledMessage)): + if isinstance( + i, + ( + raw.types.UpdateNewMessage, + raw.types.UpdateNewChannelMessage, + raw.types.UpdateNewScheduledMessage, + ), + ): forwarded_messages.append( - await types.Message._parse( - self, i.message, - users, chats - ) + await types.Message._parse(self, i.message, users, chats) ) return types.List(forwarded_messages) if is_iterable else forwarded_messages[0] diff --git a/pyrogram/methods/messages/get_chat_history.py b/pyrogram/methods/messages/get_chat_history.py index fff96c7c5..b8197ba00 100644 --- a/pyrogram/methods/messages/get_chat_history.py +++ b/pyrogram/methods/messages/get_chat_history.py @@ -44,9 +44,9 @@ async def get_chunk( limit=limit, max_id=max_id, min_id=min_id, - hash=0 + hash=0, ), - sleep_threshold=60 + sleep_threshold=60, ) return await utils.parse_messages(client, messages, replies=0) @@ -61,7 +61,7 @@ async def get_chat_history( offset_id: int = 0, offset_date: datetime = utils.zero_datetime(), min_id: int = 0, - max_id: int = 0 + max_id: int = 0, ) -> Optional[AsyncGenerator["types.Message", None]]: """Get messages from a chat history. @@ -118,7 +118,7 @@ async def get_chat_history( from_message_id=offset_id, from_date=offset_date, min_id=min_id, - max_id=max_id + max_id=max_id, ) if not messages: diff --git a/pyrogram/methods/messages/get_chat_history_count.py b/pyrogram/methods/messages/get_chat_history_count.py index 0982f2887..97bc855e9 100644 --- a/pyrogram/methods/messages/get_chat_history_count.py +++ b/pyrogram/methods/messages/get_chat_history_count.py @@ -27,8 +27,7 @@ class GetChatHistoryCount: async def get_chat_history_count( - self: "pyrogram.Client", - chat_id: Union[int, str] + self: "pyrogram.Client", chat_id: Union[int, str] ) -> int: """Get the total count of messages in a chat. @@ -63,7 +62,7 @@ async def get_chat_history_count( limit=1, max_id=0, min_id=0, - hash=0 + hash=0, ) ) diff --git a/pyrogram/methods/messages/get_custom_emoji_stickers.py b/pyrogram/methods/messages/get_custom_emoji_stickers.py index 7a71f0587..b2335dcf7 100644 --- a/pyrogram/methods/messages/get_custom_emoji_stickers.py +++ b/pyrogram/methods/messages/get_custom_emoji_stickers.py @@ -41,9 +41,7 @@ async def get_custom_emoji_stickers( List of :obj:`~pyrogram.types.Sticker`: On success, a list of sticker objects is returned. """ result = await self.invoke( - raw.functions.messages.GetCustomEmojiDocuments( - document_id=custom_emoji_ids - ) + raw.functions.messages.GetCustomEmojiDocuments(document_id=custom_emoji_ids) ) stickers = [] diff --git a/pyrogram/methods/messages/get_discussion_message.py b/pyrogram/methods/messages/get_discussion_message.py index 76ceff98f..d7d55e59f 100644 --- a/pyrogram/methods/messages/get_discussion_message.py +++ b/pyrogram/methods/messages/get_discussion_message.py @@ -55,8 +55,7 @@ async def get_discussion_message( """ r = await self.invoke( raw.functions.messages.GetDiscussionMessage( - peer=await self.resolve_peer(chat_id), - msg_id=message_id + peer=await self.resolve_peer(chat_id), msg_id=message_id ) ) diff --git a/pyrogram/methods/messages/get_discussion_replies.py b/pyrogram/methods/messages/get_discussion_replies.py index 5ee8667f9..4327ebb34 100644 --- a/pyrogram/methods/messages/get_discussion_replies.py +++ b/pyrogram/methods/messages/get_discussion_replies.py @@ -67,7 +67,7 @@ async def get_discussion_replies( limit=limit, max_id=0, min_id=0, - hash=0 + hash=0, ) ) diff --git a/pyrogram/methods/messages/get_discussion_replies_count.py b/pyrogram/methods/messages/get_discussion_replies_count.py index d035017e1..f4354f858 100644 --- a/pyrogram/methods/messages/get_discussion_replies_count.py +++ b/pyrogram/methods/messages/get_discussion_replies_count.py @@ -56,7 +56,7 @@ async def get_discussion_replies_count( limit=1, max_id=0, min_id=0, - hash=0 + hash=0, ) ) diff --git a/pyrogram/methods/messages/get_media_group.py b/pyrogram/methods/messages/get_media_group.py index 7a332c3dc..e164a01ef 100644 --- a/pyrogram/methods/messages/get_media_group.py +++ b/pyrogram/methods/messages/get_media_group.py @@ -27,9 +27,7 @@ class GetMediaGroup: async def get_media_group( - self: "pyrogram.Client", - chat_id: Union[int, str], - message_id: int + self: "pyrogram.Client", chat_id: Union[int, str], message_id: int ) -> List["types.Message"]: """Get the media group a message belongs to. @@ -44,13 +42,13 @@ async def get_media_group( message_id (``int``): The id of one of the messages that belong to the media group. - + Returns: List of :obj:`~pyrogram.types.Message`: On success, a list of messages of the media group is returned. - + Raises: - ValueError: - In case the passed message_id is negative or equal 0. + ValueError: + In case the passed message_id is negative or equal 0. In case target message doesn't belong to a media group. """ @@ -61,14 +59,20 @@ async def get_media_group( messages = await self.get_messages( chat_id=chat_id, message_ids=[msg_id for msg_id in range(message_id - 9, message_id + 10)], - replies=0 + replies=0, ) # There can be maximum 10 items in a media group. # If/else condition to fix the problem of getting correct `media_group_id` when `message_id` is less than 10. - media_group_id = messages[9].media_group_id if len(messages) == 19 else messages[message_id - 1].media_group_id + media_group_id = ( + messages[9].media_group_id + if len(messages) == 19 + else messages[message_id - 1].media_group_id + ) if media_group_id is None: raise ValueError("The message doesn't belong to a media group") - return types.List(msg for msg in messages if msg.media_group_id == media_group_id) + return types.List( + msg for msg in messages if msg.media_group_id == media_group_id + ) diff --git a/pyrogram/methods/messages/get_messages.py b/pyrogram/methods/messages/get_messages.py index aff7a34b7..f04e64b22 100644 --- a/pyrogram/methods/messages/get_messages.py +++ b/pyrogram/methods/messages/get_messages.py @@ -36,7 +36,7 @@ async def get_messages( chat_id: Union[int, str], message_ids: Union[int, Iterable[int]] = None, reply_to_message_ids: Union[int, Iterable[int]] = None, - replies: int = 1 + replies: int = 1, ) -> Union["types.Message", List["types.Message"]]: """Get one or more messages from a chat by using message identifiers. @@ -91,13 +91,17 @@ async def get_messages( ValueError: In case of invalid arguments. """ ids, ids_type = ( - (message_ids, raw.types.InputMessageID) if message_ids - else (reply_to_message_ids, raw.types.InputMessageReplyTo) if reply_to_message_ids + (message_ids, raw.types.InputMessageID) + if message_ids + else (reply_to_message_ids, raw.types.InputMessageReplyTo) + if reply_to_message_ids else (None, None) ) if ids is None: - raise ValueError("No argument supplied. Either pass message_ids or reply_to_message_ids") + raise ValueError( + "No argument supplied. Either pass message_ids or reply_to_message_ids" + ) peer = await self.resolve_peer(chat_id) diff --git a/pyrogram/methods/messages/inline_session.py b/pyrogram/methods/messages/inline_session.py index a514f5a68..96fd96b8a 100644 --- a/pyrogram/methods/messages/inline_session.py +++ b/pyrogram/methods/messages/inline_session.py @@ -32,25 +32,24 @@ async def get_session(client: "pyrogram.Client", dc_id: int): return client.media_sessions[dc_id] session = client.media_sessions[dc_id] = Session( - client, dc_id, + client, + dc_id, await Auth(client, dc_id, await client.storage.test_mode()).create(), - await client.storage.test_mode(), is_media=True + await client.storage.test_mode(), + is_media=True, ) await session.start() for _ in range(3): exported_auth = await client.invoke( - raw.functions.auth.ExportAuthorization( - dc_id=dc_id - ) + raw.functions.auth.ExportAuthorization(dc_id=dc_id) ) try: await session.invoke( raw.functions.auth.ImportAuthorization( - id=exported_auth.id, - bytes=exported_auth.bytes + id=exported_auth.id, bytes=exported_auth.bytes ) ) except AuthBytesInvalid: diff --git a/pyrogram/methods/messages/read_chat_history.py b/pyrogram/methods/messages/read_chat_history.py index 9688a86d3..c9d6e2172 100644 --- a/pyrogram/methods/messages/read_chat_history.py +++ b/pyrogram/methods/messages/read_chat_history.py @@ -24,9 +24,7 @@ class ReadChatHistory: async def read_chat_history( - self: "pyrogram.Client", - chat_id: Union[int, str], - max_id: int = 0 + self: "pyrogram.Client", chat_id: Union[int, str], max_id: int = 0 ) -> bool: """Mark a chat's message history as read. @@ -59,15 +57,9 @@ async def read_chat_history( peer = await self.resolve_peer(chat_id) if isinstance(peer, raw.types.InputPeerChannel): - q = raw.functions.channels.ReadHistory( - channel=peer, - max_id=max_id - ) + q = raw.functions.channels.ReadHistory(channel=peer, max_id=max_id) else: - q = raw.functions.messages.ReadHistory( - peer=peer, - max_id=max_id - ) + q = raw.functions.messages.ReadHistory(peer=peer, max_id=max_id) await self.invoke(q) diff --git a/pyrogram/methods/messages/retract_vote.py b/pyrogram/methods/messages/retract_vote.py index 9baa552b0..f0bc5ba3c 100644 --- a/pyrogram/methods/messages/retract_vote.py +++ b/pyrogram/methods/messages/retract_vote.py @@ -25,9 +25,7 @@ class RetractVote: async def retract_vote( - self: "pyrogram.Client", - chat_id: Union[int, str], - message_id: int + self: "pyrogram.Client", chat_id: Union[int, str], message_id: int ) -> "types.Poll": """Retract your vote in a poll. @@ -53,9 +51,7 @@ async def retract_vote( """ r = await self.invoke( raw.functions.messages.SendVote( - peer=await self.resolve_peer(chat_id), - msg_id=message_id, - options=[] + peer=await self.resolve_peer(chat_id), msg_id=message_id, options=[] ) ) diff --git a/pyrogram/methods/messages/search_global.py b/pyrogram/methods/messages/search_global.py index f566c9815..c21976040 100644 --- a/pyrogram/methods/messages/search_global.py +++ b/pyrogram/methods/messages/search_global.py @@ -46,7 +46,7 @@ async def search_global( query (``str``, *optional*): Text query string. Use "@" to search for mentions. - + filter (:obj:`~pyrogram.enums.MessagesFilter`, *optional*): Pass a filter in order to search for specific kind of messages only. Defaults to any message (no filter). @@ -92,11 +92,11 @@ async def search_global( offset_rate=offset_date, offset_peer=offset_peer, offset_id=offset_id, - limit=limit + limit=limit, ), - sleep_threshold=60 + sleep_threshold=60, ), - replies=0 + replies=0, ) if not messages: diff --git a/pyrogram/methods/messages/search_global_count.py b/pyrogram/methods/messages/search_global_count.py index 8323a821d..ebd570944 100644 --- a/pyrogram/methods/messages/search_global_count.py +++ b/pyrogram/methods/messages/search_global_count.py @@ -52,7 +52,7 @@ async def search_global_count( offset_rate=0, offset_peer=raw.types.InputPeerEmpty(), offset_id=0, - limit=1 + limit=1, ) ) diff --git a/pyrogram/methods/messages/search_messages.py b/pyrogram/methods/messages/search_messages.py index 40dbb4e45..b131ea54d 100644 --- a/pyrogram/methods/messages/search_messages.py +++ b/pyrogram/methods/messages/search_messages.py @@ -30,7 +30,7 @@ async def get_chunk( filter: "enums.MessagesFilter" = enums.MessagesFilter.EMPTY, offset: int = 0, limit: int = 100, - from_user: Union[int, str] = None + from_user: Union[int, str] = None, ) -> List["types.Message"]: r = await client.invoke( raw.functions.messages.Search( @@ -44,14 +44,10 @@ async def get_chunk( limit=limit, min_id=0, max_id=0, - from_id=( - await client.resolve_peer(from_user) - if from_user - else None - ), - hash=0 + from_id=(await client.resolve_peer(from_user) if from_user else None), + hash=0, ), - sleep_threshold=60 + sleep_threshold=60, ) return await utils.parse_messages(client, r, replies=0) @@ -66,7 +62,7 @@ async def search_messages( offset: int = 0, filter: "enums.MessagesFilter" = enums.MessagesFilter.EMPTY, limit: int = 0, - from_user: Union[int, str] = None + from_user: Union[int, str] = None, ) -> Optional[AsyncGenerator["types.Message", None]]: """Search for text and media messages inside a specific chat. @@ -135,7 +131,7 @@ async def search_messages( filter=filter, offset=offset, limit=limit, - from_user=from_user + from_user=from_user, ) if not messages: diff --git a/pyrogram/methods/messages/search_messages_count.py b/pyrogram/methods/messages/search_messages_count.py index fa9227e26..71109c88c 100644 --- a/pyrogram/methods/messages/search_messages_count.py +++ b/pyrogram/methods/messages/search_messages_count.py @@ -28,7 +28,7 @@ async def search_messages_count( chat_id: Union[int, str], query: str = "", filter: "enums.MessagesFilter" = enums.MessagesFilter.EMPTY, - from_user: Union[int, str] = None + from_user: Union[int, str] = None, ) -> int: """Get the count of messages resulting from a search inside a chat. @@ -70,12 +70,8 @@ async def search_messages_count( limit=1, min_id=0, max_id=0, - from_id=( - await self.resolve_peer(from_user) - if from_user - else None - ), - hash=0 + from_id=(await self.resolve_peer(from_user) if from_user else None), + hash=0, ) ) diff --git a/pyrogram/methods/messages/send_animation.py b/pyrogram/methods/messages/send_animation.py index 2276f4e13..1403e2c96 100644 --- a/pyrogram/methods/messages/send_animation.py +++ b/pyrogram/methods/messages/send_animation.py @@ -59,10 +59,10 @@ async def send_animation( "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", "types.ReplyKeyboardRemove", - "types.ForceReply" + "types.ForceReply", ] = None, progress: Callable = None, - progress_args: tuple = () + progress_args: tuple = (), ) -> Optional["types.Message"]: """Send animation files (animation or H.264/MPEG-4 AVC video without sound). @@ -128,7 +128,7 @@ async def send_animation( reply_to_message_id (``int``, *optional*): If the message is a reply, ID of the original message. - + reply_to_story_id (``int``, *optional*): Unique identifier for the target story. @@ -211,14 +211,16 @@ async def progress(current, total): reply_to_chat_id=reply_to_chat_id, quote_text=quote_text, quote_entities=quote_entities, - parse_mode=parse_mode + parse_mode=parse_mode, ) try: if isinstance(animation, str): if os.path.isfile(animation): thumb = await self.save_file(thumb) - file = await self.save_file(animation, progress=progress, progress_args=progress_args) + file = await self.save_file( + animation, progress=progress, progress_args=progress_args + ) media = raw.types.InputMediaUploadedDocument( mime_type=self.guess_mime_type(animation) or "video/mp4", file=file, @@ -229,25 +231,31 @@ async def progress(current, total): supports_streaming=True, duration=duration, w=width, - h=height + h=height, ), - raw.types.DocumentAttributeFilename(file_name=file_name or os.path.basename(animation)), - raw.types.DocumentAttributeAnimated() - ] + raw.types.DocumentAttributeFilename( + file_name=file_name or os.path.basename(animation) + ), + raw.types.DocumentAttributeAnimated(), + ], ) elif re.match("^https?://", animation): media = raw.types.InputMediaDocumentExternal( - url=animation, - spoiler=has_spoiler + url=animation, spoiler=has_spoiler ) else: - media = utils.get_input_media_from_file_id(animation, FileType.ANIMATION) + media = utils.get_input_media_from_file_id( + animation, FileType.ANIMATION + ) media.spoiler = has_spoiler else: thumb = await self.save_file(thumb) - file = await self.save_file(animation, progress=progress, progress_args=progress_args) + file = await self.save_file( + animation, progress=progress, progress_args=progress_args + ) media = raw.types.InputMediaUploadedDocument( - mime_type=self.guess_mime_type(file_name or animation.name) or "video/mp4", + mime_type=self.guess_mime_type(file_name or animation.name) + or "video/mp4", file=file, thumb=thumb, spoiler=has_spoiler, @@ -256,11 +264,13 @@ async def progress(current, total): supports_streaming=True, duration=duration, w=width, - h=height + h=height, + ), + raw.types.DocumentAttributeFilename( + file_name=file_name or animation.name ), - raw.types.DocumentAttributeFilename(file_name=file_name or animation.name), - raw.types.DocumentAttributeAnimated() - ] + raw.types.DocumentAttributeAnimated(), + ], ) while True: @@ -274,22 +284,34 @@ async def progress(current, total): random_id=self.rnd_id(), schedule_date=utils.datetime_to_timestamp(schedule_date), noforwards=protect_content, - reply_markup=await reply_markup.write(self) if reply_markup else None, - **await utils.parse_text_entities(self, caption, parse_mode, caption_entities) + reply_markup=await reply_markup.write(self) + if reply_markup + else None, + **await utils.parse_text_entities( + self, caption, parse_mode, caption_entities + ) ) ) except FilePartMissing as e: await self.save_file(animation, file_id=file.id, file_part=e.value) else: for i in r.updates: - if isinstance(i, (raw.types.UpdateNewMessage, - raw.types.UpdateNewChannelMessage, - raw.types.UpdateNewScheduledMessage)): + if isinstance( + i, + ( + raw.types.UpdateNewMessage, + raw.types.UpdateNewChannelMessage, + raw.types.UpdateNewScheduledMessage, + ), + ): message = await types.Message._parse( - self, i.message, + self, + i.message, {i.id: i for i in r.users}, {i.id: i for i in r.chats}, - is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage) + is_scheduled=isinstance( + i, raw.types.UpdateNewScheduledMessage + ), ) if unsave: @@ -300,8 +322,7 @@ async def progress(current, total): await self.invoke( raw.functions.messages.SaveGif( - id=document_id, - unsave=True + id=document_id, unsave=True ) ) diff --git a/pyrogram/methods/messages/send_audio.py b/pyrogram/methods/messages/send_audio.py index 9b2a9b64c..cab97577d 100644 --- a/pyrogram/methods/messages/send_audio.py +++ b/pyrogram/methods/messages/send_audio.py @@ -57,10 +57,10 @@ async def send_audio( "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", "types.ReplyKeyboardRemove", - "types.ForceReply" + "types.ForceReply", ] = None, progress: Callable = None, - progress_args: tuple = () + progress_args: tuple = (), ) -> Optional["types.Message"]: """Send audio files. @@ -121,7 +121,7 @@ async def send_audio( reply_to_message_id (``int``, *optional*): If the message is a reply, ID of the original message. - + reply_to_story_id (``int``, *optional*): Unique identifier for the target story. @@ -205,48 +205,51 @@ async def progress(current, total): reply_to_chat_id=reply_to_chat_id, quote_text=quote_text, quote_entities=quote_entities, - parse_mode=parse_mode + parse_mode=parse_mode, ) try: if isinstance(audio, str): if os.path.isfile(audio): thumb = await self.save_file(thumb) - file = await self.save_file(audio, progress=progress, progress_args=progress_args) + file = await self.save_file( + audio, progress=progress, progress_args=progress_args + ) media = raw.types.InputMediaUploadedDocument( mime_type=self.guess_mime_type(audio) or "audio/mpeg", file=file, thumb=thumb, attributes=[ raw.types.DocumentAttributeAudio( - duration=duration, - performer=performer, - title=title + duration=duration, performer=performer, title=title ), - raw.types.DocumentAttributeFilename(file_name=file_name or os.path.basename(audio)) - ] + raw.types.DocumentAttributeFilename( + file_name=file_name or os.path.basename(audio) + ), + ], ) elif re.match("^https?://", audio): - media = raw.types.InputMediaDocumentExternal( - url=audio - ) + media = raw.types.InputMediaDocumentExternal(url=audio) else: media = utils.get_input_media_from_file_id(audio, FileType.AUDIO) else: thumb = await self.save_file(thumb) - file = await self.save_file(audio, progress=progress, progress_args=progress_args) + file = await self.save_file( + audio, progress=progress, progress_args=progress_args + ) media = raw.types.InputMediaUploadedDocument( - mime_type=self.guess_mime_type(file_name or audio.name) or "audio/mpeg", + mime_type=self.guess_mime_type(file_name or audio.name) + or "audio/mpeg", file=file, thumb=thumb, attributes=[ raw.types.DocumentAttributeAudio( - duration=duration, - performer=performer, - title=title + duration=duration, performer=performer, title=title + ), + raw.types.DocumentAttributeFilename( + file_name=file_name or audio.name ), - raw.types.DocumentAttributeFilename(file_name=file_name or audio.name) - ] + ], ) while True: @@ -260,22 +263,34 @@ async def progress(current, total): random_id=self.rnd_id(), schedule_date=utils.datetime_to_timestamp(schedule_date), noforwards=protect_content, - reply_markup=await reply_markup.write(self) if reply_markup else None, - **await utils.parse_text_entities(self, caption, parse_mode, caption_entities) + reply_markup=await reply_markup.write(self) + if reply_markup + else None, + **await utils.parse_text_entities( + self, caption, parse_mode, caption_entities + ) ) ) except FilePartMissing as e: await self.save_file(audio, file_id=file.id, file_part=e.value) else: for i in r.updates: - if isinstance(i, (raw.types.UpdateNewMessage, - raw.types.UpdateNewChannelMessage, - raw.types.UpdateNewScheduledMessage)): + if isinstance( + i, + ( + raw.types.UpdateNewMessage, + raw.types.UpdateNewChannelMessage, + raw.types.UpdateNewScheduledMessage, + ), + ): return await types.Message._parse( - self, i.message, + self, + i.message, {i.id: i for i in r.users}, {i.id: i for i in r.chats}, - is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage) + is_scheduled=isinstance( + i, raw.types.UpdateNewScheduledMessage + ), ) except StopTransmission: return None diff --git a/pyrogram/methods/messages/send_cached_media.py b/pyrogram/methods/messages/send_cached_media.py index 9361ed327..eb70a9ff1 100644 --- a/pyrogram/methods/messages/send_cached_media.py +++ b/pyrogram/methods/messages/send_cached_media.py @@ -48,8 +48,8 @@ async def send_cached_media( "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None + "types.ForceReply", + ] = None, ) -> Optional["types.Message"]: """Send any media stored on the Telegram servers using a file_id. @@ -93,7 +93,7 @@ async def send_cached_media( reply_to_message_id (``int``, *optional*): If the message is a reply, ID of the original message. - + reply_to_story_id (``int``, *optional*): Unique identifier for the target story. @@ -112,7 +112,7 @@ async def send_cached_media( schedule_date (:py:obj:`~datetime.datetime`, *optional*): Date when the message will be automatically sent. - + protect_content (``bool``, *optional*): Protects the contents of the sent message from forwarding and saving. @@ -138,7 +138,7 @@ async def send_cached_media( reply_to_chat_id=reply_to_chat_id, quote_text=quote_text, quote_entities=quote_entities, - parse_mode=parse_mode + parse_mode=parse_mode, ) media = utils.get_input_media_from_file_id(file_id) @@ -157,17 +157,25 @@ async def send_cached_media( schedule_date=utils.datetime_to_timestamp(schedule_date), noforwards=protect_content, reply_markup=await reply_markup.write(self) if reply_markup else None, - **await utils.parse_text_entities(self, caption, parse_mode, caption_entities) + **await utils.parse_text_entities( + self, caption, parse_mode, caption_entities + ) ) ) for i in r.updates: - if isinstance(i, (raw.types.UpdateNewMessage, - raw.types.UpdateNewChannelMessage, - raw.types.UpdateNewScheduledMessage)): + if isinstance( + i, + ( + raw.types.UpdateNewMessage, + raw.types.UpdateNewChannelMessage, + raw.types.UpdateNewScheduledMessage, + ), + ): return await types.Message._parse( - self, i.message, + self, + i.message, {i.id: i for i in r.users}, {i.id: i for i in r.chats}, - is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage) + is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage), ) diff --git a/pyrogram/methods/messages/send_chat_action.py b/pyrogram/methods/messages/send_chat_action.py index 57ebdd510..8bd41b411 100644 --- a/pyrogram/methods/messages/send_chat_action.py +++ b/pyrogram/methods/messages/send_chat_action.py @@ -28,7 +28,7 @@ async def send_chat_action( self: "pyrogram.Client", chat_id: Union[int, str], action: "enums.ChatAction", - message_thread_id: int = None + message_thread_id: int = None, ) -> bool: """Tell the other party that something is happening on your side. @@ -83,6 +83,6 @@ async def send_chat_action( raw.functions.messages.SetTyping( peer=await self.resolve_peer(chat_id), action=action, - top_msg_id=message_thread_id + top_msg_id=message_thread_id, ) ) diff --git a/pyrogram/methods/messages/send_contact.py b/pyrogram/methods/messages/send_contact.py index 883a6e41f..3afd34038 100644 --- a/pyrogram/methods/messages/send_contact.py +++ b/pyrogram/methods/messages/send_contact.py @@ -46,8 +46,8 @@ async def send_contact( "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None + "types.ForceReply", + ] = None, ) -> "types.Message": """Send phone contacts. @@ -128,7 +128,7 @@ async def send_contact( reply_to_chat_id=reply_to_chat_id, quote_text=quote_text, quote_entities=quote_entities, - parse_mode=parse_mode + parse_mode=parse_mode, ) r = await self.invoke( @@ -138,7 +138,7 @@ async def send_contact( phone_number=phone_number, first_name=first_name, last_name=last_name or "", - vcard=vcard or "" + vcard=vcard or "", ), message="", silent=disable_notification or None, @@ -146,17 +146,23 @@ async def send_contact( random_id=self.rnd_id(), schedule_date=utils.datetime_to_timestamp(schedule_date), noforwards=protect_content, - reply_markup=await reply_markup.write(self) if reply_markup else None + reply_markup=await reply_markup.write(self) if reply_markup else None, ) ) for i in r.updates: - if isinstance(i, (raw.types.UpdateNewMessage, - raw.types.UpdateNewChannelMessage, - raw.types.UpdateNewScheduledMessage)): + if isinstance( + i, + ( + raw.types.UpdateNewMessage, + raw.types.UpdateNewChannelMessage, + raw.types.UpdateNewScheduledMessage, + ), + ): return await types.Message._parse( - self, i.message, + self, + i.message, {i.id: i for i in r.users}, {i.id: i for i in r.chats}, - is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage) + is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage), ) diff --git a/pyrogram/methods/messages/send_dice.py b/pyrogram/methods/messages/send_dice.py index b852af602..4fd82ebe7 100644 --- a/pyrogram/methods/messages/send_dice.py +++ b/pyrogram/methods/messages/send_dice.py @@ -44,8 +44,8 @@ async def send_dice( "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None + "types.ForceReply", + ] = None, ) -> Optional["types.Message"]: """Send a dice with a random value from 1 to 6. @@ -75,7 +75,7 @@ async def send_dice( reply_to_message_id (``int``, *optional*): If the message is a reply, ID of the original message. - + reply_to_story_id (``int``, *optional*): Unique identifier for the target story. @@ -132,7 +132,7 @@ async def send_dice( reply_to_chat_id=reply_to_chat_id, quote_text=quote_text, quote_entities=quote_entities, - parse_mode=parse_mode + parse_mode=parse_mode, ) r = await self.invoke( @@ -145,17 +145,23 @@ async def send_dice( schedule_date=utils.datetime_to_timestamp(schedule_date), noforwards=protect_content, reply_markup=await reply_markup.write(self) if reply_markup else None, - message="" + message="", ) ) for i in r.updates: - if isinstance(i, (raw.types.UpdateNewMessage, - raw.types.UpdateNewChannelMessage, - raw.types.UpdateNewScheduledMessage)): + if isinstance( + i, + ( + raw.types.UpdateNewMessage, + raw.types.UpdateNewChannelMessage, + raw.types.UpdateNewScheduledMessage, + ), + ): return await types.Message._parse( - self, i.message, + self, + i.message, {i.id: i for i in r.users}, {i.id: i for i in r.chats}, - is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage) + is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage), ) diff --git a/pyrogram/methods/messages/send_document.py b/pyrogram/methods/messages/send_document.py index 41bd27280..d562ec02a 100644 --- a/pyrogram/methods/messages/send_document.py +++ b/pyrogram/methods/messages/send_document.py @@ -55,10 +55,10 @@ async def send_document( "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", "types.ReplyKeyboardRemove", - "types.ForceReply" + "types.ForceReply", ] = None, progress: Callable = None, - progress_args: tuple = () + progress_args: tuple = (), ) -> Optional["types.Message"]: """Send generic files. @@ -113,7 +113,7 @@ async def send_document( reply_to_message_id (``int``, *optional*): If the message is a reply, ID of the original message. - + reply_to_story_id (``int``, *optional*): Unique identifier for the target story. @@ -192,39 +192,48 @@ async def progress(current, total): reply_to_chat_id=reply_to_chat_id, quote_text=quote_text, quote_entities=quote_entities, - parse_mode=parse_mode + parse_mode=parse_mode, ) try: if isinstance(document, str): if os.path.isfile(document): thumb = await self.save_file(thumb) - file = await self.save_file(document, progress=progress, progress_args=progress_args) + file = await self.save_file( + document, progress=progress, progress_args=progress_args + ) media = raw.types.InputMediaUploadedDocument( mime_type=self.guess_mime_type(document) or "application/zip", file=file, force_file=force_document or None, thumb=thumb, attributes=[ - raw.types.DocumentAttributeFilename(file_name=file_name or os.path.basename(document)) - ] + raw.types.DocumentAttributeFilename( + file_name=file_name or os.path.basename(document) + ) + ], ) elif re.match("^https?://", document): - media = raw.types.InputMediaDocumentExternal( - url=document - ) + media = raw.types.InputMediaDocumentExternal(url=document) else: - media = utils.get_input_media_from_file_id(document, FileType.DOCUMENT) + media = utils.get_input_media_from_file_id( + document, FileType.DOCUMENT + ) else: thumb = await self.save_file(thumb) - file = await self.save_file(document, progress=progress, progress_args=progress_args) + file = await self.save_file( + document, progress=progress, progress_args=progress_args + ) media = raw.types.InputMediaUploadedDocument( - mime_type=self.guess_mime_type(file_name or document.name) or "application/zip", + mime_type=self.guess_mime_type(file_name or document.name) + or "application/zip", file=file, thumb=thumb, attributes=[ - raw.types.DocumentAttributeFilename(file_name=file_name or document.name) - ] + raw.types.DocumentAttributeFilename( + file_name=file_name or document.name + ) + ], ) while True: @@ -238,22 +247,34 @@ async def progress(current, total): random_id=self.rnd_id(), schedule_date=utils.datetime_to_timestamp(schedule_date), noforwards=protect_content, - reply_markup=await reply_markup.write(self) if reply_markup else None, - **await utils.parse_text_entities(self, caption, parse_mode, caption_entities) + reply_markup=await reply_markup.write(self) + if reply_markup + else None, + **await utils.parse_text_entities( + self, caption, parse_mode, caption_entities + ) ) ) except FilePartMissing as e: await self.save_file(document, file_id=file.id, file_part=e.value) else: for i in r.updates: - if isinstance(i, (raw.types.UpdateNewMessage, - raw.types.UpdateNewChannelMessage, - raw.types.UpdateNewScheduledMessage)): + if isinstance( + i, + ( + raw.types.UpdateNewMessage, + raw.types.UpdateNewChannelMessage, + raw.types.UpdateNewScheduledMessage, + ), + ): return await types.Message._parse( - self, i.message, + self, + i.message, {i.id: i for i in r.users}, {i.id: i for i in r.chats}, - is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage) + is_scheduled=isinstance( + i, raw.types.UpdateNewScheduledMessage + ), ) except StopTransmission: return None diff --git a/pyrogram/methods/messages/send_location.py b/pyrogram/methods/messages/send_location.py index 0465f2354..5f37805eb 100644 --- a/pyrogram/methods/messages/send_location.py +++ b/pyrogram/methods/messages/send_location.py @@ -44,8 +44,8 @@ async def send_location( "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None + "types.ForceReply", + ] = None, ) -> "types.Message": """Send points on the map. @@ -120,17 +120,14 @@ async def send_location( reply_to_chat_id=reply_to_chat_id, quote_text=quote_text, quote_entities=quote_entities, - parse_mode=parse_mode + parse_mode=parse_mode, ) r = await self.invoke( raw.functions.messages.SendMedia( peer=await self.resolve_peer(chat_id), media=raw.types.InputMediaGeoPoint( - geo_point=raw.types.InputGeoPoint( - lat=latitude, - long=longitude - ) + geo_point=raw.types.InputGeoPoint(lat=latitude, long=longitude) ), message="", silent=disable_notification or None, @@ -138,17 +135,23 @@ async def send_location( random_id=self.rnd_id(), schedule_date=utils.datetime_to_timestamp(schedule_date), noforwards=protect_content, - reply_markup=await reply_markup.write(self) if reply_markup else None + reply_markup=await reply_markup.write(self) if reply_markup else None, ) ) for i in r.updates: - if isinstance(i, (raw.types.UpdateNewMessage, - raw.types.UpdateNewChannelMessage, - raw.types.UpdateNewScheduledMessage)): + if isinstance( + i, + ( + raw.types.UpdateNewMessage, + raw.types.UpdateNewChannelMessage, + raw.types.UpdateNewScheduledMessage, + ), + ): return await types.Message._parse( - self, i.message, + self, + i.message, {i.id: i for i in r.users}, {i.id: i for i in r.chats}, - is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage) + is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage), ) diff --git a/pyrogram/methods/messages/send_media_group.py b/pyrogram/methods/messages/send_media_group.py index 2a34aea2d..6fbb217f8 100644 --- a/pyrogram/methods/messages/send_media_group.py +++ b/pyrogram/methods/messages/send_media_group.py @@ -39,13 +39,15 @@ class SendMediaGroup: async def send_media_group( self: "pyrogram.Client", chat_id: Union[int, str], - media: List[Union[ - "types.InputMediaPhoto", - "types.InputMediaVideo", - "types.InputMediaAudio", - "types.InputMediaDocument", - "types.InputMediaAnimation" - ]], + media: List[ + Union[ + "types.InputMediaPhoto", + "types.InputMediaVideo", + "types.InputMediaAudio", + "types.InputMediaDocument", + "types.InputMediaAnimation", + ] + ], disable_notification: bool = None, message_thread_id: int = None, reply_to_message_id: int = None, @@ -81,7 +83,7 @@ async def send_media_group( reply_to_message_id (``int``, *optional*): If the message is a reply, ID of the original message. - + reply_to_story_id (``int``, *optional*): Unique identifier for the target story. @@ -137,7 +139,7 @@ async def send_media_group( reply_to_chat_id=reply_to_chat_id, quote_text=quote_text, quote_entities=quote_entities, - parse_mode=parse_mode + parse_mode=parse_mode, ) for i in media: @@ -149,8 +151,8 @@ async def send_media_group( peer=await self.resolve_peer(chat_id), media=raw.types.InputMediaUploadedPhoto( file=await self.save_file(i.media), - spoiler=i.has_spoiler - ) + spoiler=i.has_spoiler, + ), ) ) @@ -158,18 +160,17 @@ async def send_media_group( id=raw.types.InputPhoto( id=media.photo.id, access_hash=media.photo.access_hash, - file_reference=media.photo.file_reference + file_reference=media.photo.file_reference, ), - spoiler=i.has_spoiler + spoiler=i.has_spoiler, ) elif re.match("^https?://", i.media): media = await self.invoke( raw.functions.messages.UploadMedia( peer=await self.resolve_peer(chat_id), media=raw.types.InputMediaPhotoExternal( - url=i.media, - spoiler=i.has_spoiler - ) + url=i.media, spoiler=i.has_spoiler + ), ) ) @@ -177,20 +178,22 @@ async def send_media_group( id=raw.types.InputPhoto( id=media.photo.id, access_hash=media.photo.access_hash, - file_reference=media.photo.file_reference + file_reference=media.photo.file_reference, ), - spoiler=i.has_spoiler + spoiler=i.has_spoiler, ) else: - media = utils.get_input_media_from_file_id(i.media, FileType.PHOTO) + media = utils.get_input_media_from_file_id( + i.media, FileType.PHOTO + ) else: media = await self.invoke( raw.functions.messages.UploadMedia( peer=await self.resolve_peer(chat_id), media=raw.types.InputMediaUploadedPhoto( file=await self.save_file(i.media), - spoiler=i.has_spoiler - ) + spoiler=i.has_spoiler, + ), ) ) @@ -198,20 +201,20 @@ async def send_media_group( id=raw.types.InputPhoto( id=media.photo.id, access_hash=media.photo.access_hash, - file_reference=media.photo.file_reference + file_reference=media.photo.file_reference, ), - spoiler=i.has_spoiler + spoiler=i.has_spoiler, ) - elif ( - isinstance(i, types.InputMediaVideo) - or - isinstance(i, types.InputMediaAnimation) + elif isinstance(i, types.InputMediaVideo) or isinstance( + i, types.InputMediaAnimation ): if isinstance(i.media, str): is_animation = False if os.path.isfile(i.media): videoInfo = MediaInfo.parse(i.media) - if not any([track.track_type == 'Audio' for track in videoInfo.tracks]): + if not any( + [track.track_type == "Audio" for track in videoInfo.tracks] + ): is_animation = True media = await self.invoke( raw.functions.messages.UploadMedia( @@ -220,19 +223,26 @@ async def send_media_group( file=await self.save_file(i.media), thumb=await self.save_file(i.thumb), spoiler=i.has_spoiler, - mime_type=self.guess_mime_type(i.media) or "video/mp4", + mime_type=self.guess_mime_type(i.media) + or "video/mp4", nosound_video=is_animation, attributes=[ raw.types.DocumentAttributeVideo( - supports_streaming=True if is_animation else (i.supports_streaming or None), + supports_streaming=True + if is_animation + else (i.supports_streaming or None), duration=i.duration, w=i.width, - h=i.height + h=i.height, ), - raw.types.DocumentAttributeFilename(file_name=os.path.basename(i.media)), - raw.types.DocumentAttributeAnimated() if is_animation else None - ] - ) + raw.types.DocumentAttributeFilename( + file_name=os.path.basename(i.media) + ), + raw.types.DocumentAttributeAnimated() + if is_animation + else None, + ], + ), ) ) @@ -240,18 +250,17 @@ async def send_media_group( id=raw.types.InputDocument( id=media.document.id, access_hash=media.document.access_hash, - file_reference=media.document.file_reference + file_reference=media.document.file_reference, ), - spoiler=i.has_spoiler + spoiler=i.has_spoiler, ) elif re.match("^https?://", i.media): media = await self.invoke( raw.functions.messages.UploadMedia( peer=await self.resolve_peer(chat_id), media=raw.types.InputMediaDocumentExternal( - url=i.media, - spoiler=i.has_spoiler - ) + url=i.media, spoiler=i.has_spoiler + ), ) ) @@ -259,12 +268,14 @@ async def send_media_group( id=raw.types.InputDocument( id=media.document.id, access_hash=media.document.access_hash, - file_reference=media.document.file_reference + file_reference=media.document.file_reference, ), - spoiler=i.has_spoiler + spoiler=i.has_spoiler, ) else: - media = utils.get_input_media_from_file_id(i.media, FileType.VIDEO) + media = utils.get_input_media_from_file_id( + i.media, FileType.VIDEO + ) else: media = await self.invoke( raw.functions.messages.UploadMedia( @@ -273,17 +284,22 @@ async def send_media_group( file=await self.save_file(i.media), thumb=await self.save_file(i.thumb), spoiler=i.has_spoiler, - mime_type=self.guess_mime_type(getattr(i.media, "name", "video.mp4")) or "video/mp4", + mime_type=self.guess_mime_type( + getattr(i.media, "name", "video.mp4") + ) + or "video/mp4", attributes=[ raw.types.DocumentAttributeVideo( supports_streaming=i.supports_streaming or None, duration=i.duration, w=i.width, - h=i.height + h=i.height, ), - raw.types.DocumentAttributeFilename(file_name=getattr(i.media, "name", "video.mp4")) - ] - ) + raw.types.DocumentAttributeFilename( + file_name=getattr(i.media, "name", "video.mp4") + ), + ], + ), ) ) @@ -291,9 +307,9 @@ async def send_media_group( id=raw.types.InputDocument( id=media.document.id, access_hash=media.document.access_hash, - file_reference=media.document.file_reference + file_reference=media.document.file_reference, ), - spoiler=i.has_spoiler + spoiler=i.has_spoiler, ) elif isinstance(i, types.InputMediaAudio): if isinstance(i.media, str): @@ -302,18 +318,21 @@ async def send_media_group( raw.functions.messages.UploadMedia( peer=await self.resolve_peer(chat_id), media=raw.types.InputMediaUploadedDocument( - mime_type=self.guess_mime_type(i.media) or "audio/mpeg", + mime_type=self.guess_mime_type(i.media) + or "audio/mpeg", file=await self.save_file(i.media), thumb=await self.save_file(i.thumb), attributes=[ raw.types.DocumentAttributeAudio( duration=i.duration, performer=i.performer, - title=i.title + title=i.title, ), - raw.types.DocumentAttributeFilename(file_name=os.path.basename(i.media)) - ] - ) + raw.types.DocumentAttributeFilename( + file_name=os.path.basename(i.media) + ), + ], + ), ) ) @@ -321,16 +340,14 @@ async def send_media_group( id=raw.types.InputDocument( id=media.document.id, access_hash=media.document.access_hash, - file_reference=media.document.file_reference + file_reference=media.document.file_reference, ) ) elif re.match("^https?://", i.media): media = await self.invoke( raw.functions.messages.UploadMedia( peer=await self.resolve_peer(chat_id), - media=raw.types.InputMediaDocumentExternal( - url=i.media - ) + media=raw.types.InputMediaDocumentExternal(url=i.media), ) ) @@ -338,28 +355,35 @@ async def send_media_group( id=raw.types.InputDocument( id=media.document.id, access_hash=media.document.access_hash, - file_reference=media.document.file_reference + file_reference=media.document.file_reference, ) ) else: - media = utils.get_input_media_from_file_id(i.media, FileType.AUDIO) + media = utils.get_input_media_from_file_id( + i.media, FileType.AUDIO + ) else: media = await self.invoke( raw.functions.messages.UploadMedia( peer=await self.resolve_peer(chat_id), media=raw.types.InputMediaUploadedDocument( - mime_type=self.guess_mime_type(getattr(i.media, "name", "audio.mp3")) or "audio/mpeg", + mime_type=self.guess_mime_type( + getattr(i.media, "name", "audio.mp3") + ) + or "audio/mpeg", file=await self.save_file(i.media), thumb=await self.save_file(i.thumb), attributes=[ raw.types.DocumentAttributeAudio( duration=i.duration, performer=i.performer, - title=i.title + title=i.title, ), - raw.types.DocumentAttributeFilename(file_name=getattr(i.media, "name", "audio.mp3")) - ] - ) + raw.types.DocumentAttributeFilename( + file_name=getattr(i.media, "name", "audio.mp3") + ), + ], + ), ) ) @@ -367,7 +391,7 @@ async def send_media_group( id=raw.types.InputDocument( id=media.document.id, access_hash=media.document.access_hash, - file_reference=media.document.file_reference + file_reference=media.document.file_reference, ) ) elif isinstance(i, types.InputMediaDocument): @@ -377,13 +401,16 @@ async def send_media_group( raw.functions.messages.UploadMedia( peer=await self.resolve_peer(chat_id), media=raw.types.InputMediaUploadedDocument( - mime_type=self.guess_mime_type(i.media) or "application/zip", + mime_type=self.guess_mime_type(i.media) + or "application/zip", file=await self.save_file(i.media), thumb=await self.save_file(i.thumb), attributes=[ - raw.types.DocumentAttributeFilename(file_name=os.path.basename(i.media)) - ] - ) + raw.types.DocumentAttributeFilename( + file_name=os.path.basename(i.media) + ) + ], + ), ) ) @@ -391,16 +418,14 @@ async def send_media_group( id=raw.types.InputDocument( id=media.document.id, access_hash=media.document.access_hash, - file_reference=media.document.file_reference + file_reference=media.document.file_reference, ) ) elif re.match("^https?://", i.media): media = await self.invoke( raw.functions.messages.UploadMedia( peer=await self.resolve_peer(chat_id), - media=raw.types.InputMediaDocumentExternal( - url=i.media - ) + media=raw.types.InputMediaDocumentExternal(url=i.media), ) ) @@ -408,11 +433,13 @@ async def send_media_group( id=raw.types.InputDocument( id=media.document.id, access_hash=media.document.access_hash, - file_reference=media.document.file_reference + file_reference=media.document.file_reference, ) ) else: - media = utils.get_input_media_from_file_id(i.media, FileType.DOCUMENT) + media = utils.get_input_media_from_file_id( + i.media, FileType.DOCUMENT + ) else: media = await self.invoke( raw.functions.messages.UploadMedia( @@ -420,13 +447,16 @@ async def send_media_group( media=raw.types.InputMediaUploadedDocument( mime_type=self.guess_mime_type( getattr(i.media, "name", "file.zip") - ) or "application/zip", + ) + or "application/zip", file=await self.save_file(i.media), thumb=await self.save_file(i.thumb), attributes=[ - raw.types.DocumentAttributeFilename(file_name=getattr(i.media, "name", "file.zip")) - ] - ) + raw.types.DocumentAttributeFilename( + file_name=getattr(i.media, "name", "file.zip") + ) + ], + ), ) ) @@ -434,17 +464,19 @@ async def send_media_group( id=raw.types.InputDocument( id=media.document.id, access_hash=media.document.access_hash, - file_reference=media.document.file_reference + file_reference=media.document.file_reference, ) ) else: - raise ValueError(f"{i.__class__.__name__} is not a supported type for send_media_group") + raise ValueError( + f"{i.__class__.__name__} is not a supported type for send_media_group" + ) multi_media.append( raw.types.InputSingleMedia( media=media, random_id=self.rnd_id(), - **await self.parser.parse(i.caption, i.parse_mode) + **await self.parser.parse(i.caption, i.parse_mode), ) ) @@ -455,21 +487,29 @@ async def send_media_group( silent=disable_notification or None, reply_to=reply_to, schedule_date=utils.datetime_to_timestamp(schedule_date), - noforwards=protect_content + noforwards=protect_content, ), - sleep_threshold=60 + sleep_threshold=60, ) return await utils.parse_messages( self, raw.types.messages.Messages( - messages=[m.message for m in filter( - lambda u: isinstance(u, (raw.types.UpdateNewMessage, - raw.types.UpdateNewChannelMessage, - raw.types.UpdateNewScheduledMessage)), - r.updates - )], + messages=[ + m.message + for m in filter( + lambda u: isinstance( + u, + ( + raw.types.UpdateNewMessage, + raw.types.UpdateNewChannelMessage, + raw.types.UpdateNewScheduledMessage, + ), + ), + r.updates, + ) + ], users=r.users, - chats=r.chats - ) + chats=r.chats, + ), ) diff --git a/pyrogram/methods/messages/send_message.py b/pyrogram/methods/messages/send_message.py index 039deec85..f4231c7c6 100644 --- a/pyrogram/methods/messages/send_message.py +++ b/pyrogram/methods/messages/send_message.py @@ -47,8 +47,8 @@ async def send_message( "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None + "types.ForceReply", + ] = None, ) -> "types.Message": """Send text messages. @@ -84,7 +84,7 @@ async def send_message( reply_to_message_id (``int``, *optional*): If the message is a reply, ID of the original message. - + reply_to_story_id (``int``, *optional*): Unique identifier for the target story. @@ -152,7 +152,9 @@ async def send_message( ])) """ - message, entities = (await utils.parse_text_entities(self, text, parse_mode, entities)).values() + message, entities = ( + await utils.parse_text_entities(self, text, parse_mode, entities) + ).values() reply_to = await utils.get_reply_to( client=self, @@ -163,7 +165,7 @@ async def send_message( reply_to_chat_id=reply_to_chat_id, quote_text=quote_text, quote_entities=quote_entities, - parse_mode=parse_mode + parse_mode=parse_mode, ) r = await self.invoke( @@ -178,7 +180,7 @@ async def send_message( message=message, entities=entities, noforwards=protect_content, - invert_media=invert_media + invert_media=invert_media, ) ) @@ -193,29 +195,32 @@ async def send_message( return types.Message( id=r.id, - chat=types.Chat( - id=peer_id, - type=enums.ChatType.PRIVATE, - client=self - ), + chat=types.Chat(id=peer_id, type=enums.ChatType.PRIVATE, client=self), text=message, date=utils.timestamp_to_datetime(r.date), outgoing=r.out, reply_markup=reply_markup, entities=[ - types.MessageEntity._parse(None, entity, {}) - for entity in entities - ] if entities else None, - client=self + types.MessageEntity._parse(None, entity, {}) for entity in entities + ] + if entities + else None, + client=self, ) for i in r.updates: - if isinstance(i, (raw.types.UpdateNewMessage, - raw.types.UpdateNewChannelMessage, - raw.types.UpdateNewScheduledMessage)): + if isinstance( + i, + ( + raw.types.UpdateNewMessage, + raw.types.UpdateNewChannelMessage, + raw.types.UpdateNewScheduledMessage, + ), + ): return await types.Message._parse( - self, i.message, + self, + i.message, {i.id: i for i in r.users}, {i.id: i for i in r.chats}, - is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage) + is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage), ) diff --git a/pyrogram/methods/messages/send_photo.py b/pyrogram/methods/messages/send_photo.py index a2b18b4ff..3f72c8406 100644 --- a/pyrogram/methods/messages/send_photo.py +++ b/pyrogram/methods/messages/send_photo.py @@ -53,10 +53,10 @@ async def send_photo( "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", "types.ReplyKeyboardRemove", - "types.ForceReply" + "types.ForceReply", ] = None, progress: Callable = None, - progress_args: tuple = () + progress_args: tuple = (), ) -> Optional["types.Message"]: """Send photos. @@ -104,7 +104,7 @@ async def send_photo( reply_to_message_id (``int``, *optional*): If the message is a reply, ID of the original message. - + reply_to_story_id (``int``, *optional*): Unique identifier for the target story. @@ -183,13 +183,15 @@ async def send_photo( reply_to_chat_id=reply_to_chat_id, quote_text=quote_text, quote_entities=quote_entities, - parse_mode=parse_mode + parse_mode=parse_mode, ) try: if isinstance(photo, str): if os.path.isfile(photo): - file = await self.save_file(photo, progress=progress, progress_args=progress_args) + file = await self.save_file( + photo, progress=progress, progress_args=progress_args + ) media = raw.types.InputMediaUploadedPhoto( file=file, ttl_seconds=ttl_seconds, @@ -197,19 +199,19 @@ async def send_photo( ) elif re.match("^https?://", photo): media = raw.types.InputMediaPhotoExternal( - url=photo, - ttl_seconds=ttl_seconds, - spoiler=has_spoiler + url=photo, ttl_seconds=ttl_seconds, spoiler=has_spoiler ) else: - media = utils.get_input_media_from_file_id(photo, FileType.PHOTO, ttl_seconds=ttl_seconds) + media = utils.get_input_media_from_file_id( + photo, FileType.PHOTO, ttl_seconds=ttl_seconds + ) media.spoiler = has_spoiler else: - file = await self.save_file(photo, progress=progress, progress_args=progress_args) + file = await self.save_file( + photo, progress=progress, progress_args=progress_args + ) media = raw.types.InputMediaUploadedPhoto( - file=file, - ttl_seconds=ttl_seconds, - spoiler=has_spoiler + file=file, ttl_seconds=ttl_seconds, spoiler=has_spoiler ) while True: @@ -223,22 +225,34 @@ async def send_photo( random_id=self.rnd_id(), schedule_date=utils.datetime_to_timestamp(schedule_date), noforwards=protect_content, - reply_markup=await reply_markup.write(self) if reply_markup else None, - **await utils.parse_text_entities(self, caption, parse_mode, caption_entities) + reply_markup=await reply_markup.write(self) + if reply_markup + else None, + **await utils.parse_text_entities( + self, caption, parse_mode, caption_entities + ) ) ) except FilePartMissing as e: await self.save_file(photo, file_id=file.id, file_part=e.value) else: for i in r.updates: - if isinstance(i, (raw.types.UpdateNewMessage, - raw.types.UpdateNewChannelMessage, - raw.types.UpdateNewScheduledMessage)): + if isinstance( + i, + ( + raw.types.UpdateNewMessage, + raw.types.UpdateNewChannelMessage, + raw.types.UpdateNewScheduledMessage, + ), + ): return await types.Message._parse( - self, i.message, + self, + i.message, {i.id: i for i in r.users}, {i.id: i for i in r.chats}, - is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage) + is_scheduled=isinstance( + i, raw.types.UpdateNewScheduledMessage + ), ) except pyrogram.StopTransmission: return None diff --git a/pyrogram/methods/messages/send_poll.py b/pyrogram/methods/messages/send_poll.py index bceb8a8b0..78da0af3f 100644 --- a/pyrogram/methods/messages/send_poll.py +++ b/pyrogram/methods/messages/send_poll.py @@ -54,8 +54,8 @@ async def send_poll( "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None + "types.ForceReply", + ] = None, ) -> "types.Message": """Send a new poll. @@ -170,12 +170,14 @@ async def send_poll( reply_to_chat_id=reply_to_chat_id, quote_text=quote_text, quote_entities=quote_entities, - parse_mode=parse_mode + parse_mode=parse_mode, ) - solution, solution_entities = (await utils.parse_text_entities( - self, explanation, explanation_parse_mode, explanation_entities - )).values() + solution, solution_entities = ( + await utils.parse_text_entities( + self, explanation, explanation_parse_mode, explanation_entities + ) + ).values() r = await self.invoke( raw.functions.messages.SendMedia( @@ -193,11 +195,13 @@ async def send_poll( multiple_choice=allows_multiple_answers, quiz=type == enums.PollType.QUIZ or False, close_period=open_period, - close_date=utils.datetime_to_timestamp(close_date) + close_date=utils.datetime_to_timestamp(close_date), ), - correct_answers=[bytes([correct_option_id])] if correct_option_id is not None else None, + correct_answers=[bytes([correct_option_id])] + if correct_option_id is not None + else None, solution=solution, - solution_entities=solution_entities or [] + solution_entities=solution_entities or [], ), message="", silent=disable_notification, @@ -205,17 +209,23 @@ async def send_poll( random_id=self.rnd_id(), schedule_date=utils.datetime_to_timestamp(schedule_date), noforwards=protect_content, - reply_markup=await reply_markup.write(self) if reply_markup else None + reply_markup=await reply_markup.write(self) if reply_markup else None, ) ) for i in r.updates: - if isinstance(i, (raw.types.UpdateNewMessage, - raw.types.UpdateNewChannelMessage, - raw.types.UpdateNewScheduledMessage)): + if isinstance( + i, + ( + raw.types.UpdateNewMessage, + raw.types.UpdateNewChannelMessage, + raw.types.UpdateNewScheduledMessage, + ), + ): return await types.Message._parse( - self, i.message, + self, + i.message, {i.id: i for i in r.users}, {i.id: i for i in r.chats}, - is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage) + is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage), ) diff --git a/pyrogram/methods/messages/send_reaction.py b/pyrogram/methods/messages/send_reaction.py index 3045adc35..e510cb1ec 100644 --- a/pyrogram/methods/messages/send_reaction.py +++ b/pyrogram/methods/messages/send_reaction.py @@ -31,7 +31,7 @@ async def send_reaction( story_id: int = None, emoji: Union[int, str, List[Union[int, str]]] = None, big: bool = False, - add_to_recent: bool = False + add_to_recent: bool = False, ) -> "types.MessageReactions": """Use this method to send reactions on a message/stories. Service messages can't be reacted to. @@ -61,7 +61,7 @@ async def send_reaction( Pass True to set the reaction with a big animation. For message reactions only. Defaults to False. - + add_to_recent (``bool``, *optional*): Pass True if the reaction should appear in the recently used reactions. This option is applicable only for users. @@ -84,12 +84,16 @@ async def send_reaction( await app.send_reaction(chat_id, story_id=story_id) """ if isinstance(emoji, list): - reaction = [ + reaction = ( + [ raw.types.ReactionCustomEmoji(document_id=i) if isinstance(i, int) else raw.types.ReactionEmoji(emoticon=i) for i in emoji - ] if emoji else None + ] + if emoji + else None + ) else: if isinstance(emoji, int): reaction = [raw.types.ReactionCustomEmoji(document_id=emoji)] @@ -102,19 +106,19 @@ async def send_reaction( msg_id=message_id, reaction=reaction, big=big, - add_to_recent=add_to_recent + add_to_recent=add_to_recent, ) ) for i in r.updates: - if isinstance(i, raw.types.UpdateMessageReactions): - return types.MessageReactions._parse(self, i.reactions) + if isinstance(i, raw.types.UpdateMessageReactions): + return types.MessageReactions._parse(self, i.reactions) elif story_id is not None: await self.invoke( raw.functions.stories.SendReaction( peer=await self.resolve_peer(chat_id), story_id=story_id, reaction=raw.types.ReactionEmoji(emoticon=emoji) if emoji else None, - add_to_recent=add_to_recent + add_to_recent=add_to_recent, ) ) return True diff --git a/pyrogram/methods/messages/send_sticker.py b/pyrogram/methods/messages/send_sticker.py index 25bc8a7d0..4c7b413bf 100644 --- a/pyrogram/methods/messages/send_sticker.py +++ b/pyrogram/methods/messages/send_sticker.py @@ -51,10 +51,10 @@ async def send_sticker( "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", "types.ReplyKeyboardRemove", - "types.ForceReply" + "types.ForceReply", ] = None, progress: Callable = None, - progress_args: tuple = () + progress_args: tuple = (), ) -> Optional["types.Message"]: """Send static .webp or animated .tgs stickers. @@ -84,7 +84,7 @@ async def send_sticker( reply_to_message_id (``int``, *optional*): If the message is a reply, ID of the original message. - + reply_to_story_id (``int``, *optional*): Unique identifier for the target story. @@ -163,34 +163,40 @@ async def send_sticker( reply_to_chat_id=reply_to_chat_id, quote_text=quote_text, quote_entities=quote_entities, - parse_mode=parse_mode + parse_mode=parse_mode, ) try: if isinstance(sticker, str): if os.path.isfile(sticker): - file = await self.save_file(sticker, progress=progress, progress_args=progress_args) + file = await self.save_file( + sticker, progress=progress, progress_args=progress_args + ) media = raw.types.InputMediaUploadedDocument( mime_type=self.guess_mime_type(sticker) or "image/webp", file=file, attributes=[ - raw.types.DocumentAttributeFilename(file_name=os.path.basename(sticker)) - ] + raw.types.DocumentAttributeFilename( + file_name=os.path.basename(sticker) + ) + ], ) elif re.match("^https?://", sticker): - media = raw.types.InputMediaDocumentExternal( - url=sticker - ) + media = raw.types.InputMediaDocumentExternal(url=sticker) else: - media = utils.get_input_media_from_file_id(sticker, FileType.STICKER) + media = utils.get_input_media_from_file_id( + sticker, FileType.STICKER + ) else: - file = await self.save_file(sticker, progress=progress, progress_args=progress_args) + file = await self.save_file( + sticker, progress=progress, progress_args=progress_args + ) media = raw.types.InputMediaUploadedDocument( mime_type=self.guess_mime_type(sticker.name) or "image/webp", file=file, attributes=[ raw.types.DocumentAttributeFilename(file_name=sticker.name) - ] + ], ) while True: @@ -204,22 +210,32 @@ async def send_sticker( random_id=self.rnd_id(), schedule_date=utils.datetime_to_timestamp(schedule_date), noforwards=protect_content, - reply_markup=await reply_markup.write(self) if reply_markup else None, - message="" + reply_markup=await reply_markup.write(self) + if reply_markup + else None, + message="", ) ) except FilePartMissing as e: await self.save_file(sticker, file_id=file.id, file_part=e.value) else: for i in r.updates: - if isinstance(i, (raw.types.UpdateNewMessage, - raw.types.UpdateNewChannelMessage, - raw.types.UpdateNewScheduledMessage)): + if isinstance( + i, + ( + raw.types.UpdateNewMessage, + raw.types.UpdateNewChannelMessage, + raw.types.UpdateNewScheduledMessage, + ), + ): return await types.Message._parse( - self, i.message, + self, + i.message, {i.id: i for i in r.users}, {i.id: i for i in r.chats}, - is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage) + is_scheduled=isinstance( + i, raw.types.UpdateNewScheduledMessage + ), ) except StopTransmission: return None diff --git a/pyrogram/methods/messages/send_venue.py b/pyrogram/methods/messages/send_venue.py index 5d6d61863..7eec8f526 100644 --- a/pyrogram/methods/messages/send_venue.py +++ b/pyrogram/methods/messages/send_venue.py @@ -48,8 +48,8 @@ async def send_venue( "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None + "types.ForceReply", + ] = None, ) -> "types.Message": """Send information about a venue. @@ -139,22 +139,19 @@ async def send_venue( reply_to_chat_id=reply_to_chat_id, quote_text=quote_text, quote_entities=quote_entities, - parse_mode=parse_mode + parse_mode=parse_mode, ) r = await self.invoke( raw.functions.messages.SendMedia( peer=await self.resolve_peer(chat_id), media=raw.types.InputMediaVenue( - geo_point=raw.types.InputGeoPoint( - lat=latitude, - long=longitude - ), + geo_point=raw.types.InputGeoPoint(lat=latitude, long=longitude), title=title, address=address, provider="", venue_id=foursquare_id, - venue_type=foursquare_type + venue_type=foursquare_type, ), message="", silent=disable_notification or None, @@ -162,17 +159,23 @@ async def send_venue( random_id=self.rnd_id(), schedule_date=utils.datetime_to_timestamp(schedule_date), noforwards=protect_content, - reply_markup=await reply_markup.write(self) if reply_markup else None + reply_markup=await reply_markup.write(self) if reply_markup else None, ) ) for i in r.updates: - if isinstance(i, (raw.types.UpdateNewMessage, - raw.types.UpdateNewChannelMessage, - raw.types.UpdateNewScheduledMessage)): + if isinstance( + i, + ( + raw.types.UpdateNewMessage, + raw.types.UpdateNewChannelMessage, + raw.types.UpdateNewScheduledMessage, + ), + ): return await types.Message._parse( - self, i.message, + self, + i.message, {i.id: i for i in r.users}, {i.id: i for i in r.chats}, - is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage) + is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage), ) diff --git a/pyrogram/methods/messages/send_video.py b/pyrogram/methods/messages/send_video.py index 43fafa4ff..a40be277a 100644 --- a/pyrogram/methods/messages/send_video.py +++ b/pyrogram/methods/messages/send_video.py @@ -60,10 +60,10 @@ async def send_video( "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", "types.ReplyKeyboardRemove", - "types.ForceReply" + "types.ForceReply", ] = None, progress: Callable = None, - progress_args: tuple = () + progress_args: tuple = (), ) -> Optional["types.Message"]: """Send video files. @@ -134,7 +134,7 @@ async def send_video( reply_to_message_id (``int``, *optional*): If the message is a reply, ID of the original message. - + reply_to_story_id (``int``, *optional*): Unique identifier for the target story. @@ -216,14 +216,16 @@ async def progress(current, total): reply_to_chat_id=reply_to_chat_id, quote_text=quote_text, quote_entities=quote_entities, - parse_mode=parse_mode + parse_mode=parse_mode, ) try: if isinstance(video, str): if os.path.isfile(video): thumb = await self.save_file(thumb) - file = await self.save_file(video, progress=progress, progress_args=progress_args) + file = await self.save_file( + video, progress=progress, progress_args=progress_args + ) media = raw.types.InputMediaUploadedDocument( mime_type=self.guess_mime_type(video) or "video/mp4", file=file, @@ -235,25 +237,30 @@ async def progress(current, total): supports_streaming=supports_streaming or None, duration=duration, w=width, - h=height + h=height, + ), + raw.types.DocumentAttributeFilename( + file_name=file_name or os.path.basename(video) ), - raw.types.DocumentAttributeFilename(file_name=file_name or os.path.basename(video)) - ] + ], ) elif re.match("^https?://", video): media = raw.types.InputMediaDocumentExternal( - url=video, - ttl_seconds=ttl_seconds, - spoiler=has_spoiler + url=video, ttl_seconds=ttl_seconds, spoiler=has_spoiler ) else: - media = utils.get_input_media_from_file_id(video, FileType.VIDEO, ttl_seconds=ttl_seconds) + media = utils.get_input_media_from_file_id( + video, FileType.VIDEO, ttl_seconds=ttl_seconds + ) media.spoiler = has_spoiler else: thumb = await self.save_file(thumb) - file = await self.save_file(video, progress=progress, progress_args=progress_args) + file = await self.save_file( + video, progress=progress, progress_args=progress_args + ) media = raw.types.InputMediaUploadedDocument( - mime_type=self.guess_mime_type(file_name or video.name) or "video/mp4", + mime_type=self.guess_mime_type(file_name or video.name) + or "video/mp4", file=file, ttl_seconds=ttl_seconds, spoiler=has_spoiler, @@ -263,10 +270,12 @@ async def progress(current, total): supports_streaming=supports_streaming or None, duration=duration, w=width, - h=height + h=height, + ), + raw.types.DocumentAttributeFilename( + file_name=file_name or video.name ), - raw.types.DocumentAttributeFilename(file_name=file_name or video.name) - ] + ], ) while True: @@ -280,22 +289,34 @@ async def progress(current, total): random_id=self.rnd_id(), schedule_date=utils.datetime_to_timestamp(schedule_date), noforwards=protect_content, - reply_markup=await reply_markup.write(self) if reply_markup else None, - **await utils.parse_text_entities(self, caption, parse_mode, caption_entities) + reply_markup=await reply_markup.write(self) + if reply_markup + else None, + **await utils.parse_text_entities( + self, caption, parse_mode, caption_entities + ) ) ) except FilePartMissing as e: await self.save_file(video, file_id=file.id, file_part=e.value) else: for i in r.updates: - if isinstance(i, (raw.types.UpdateNewMessage, - raw.types.UpdateNewChannelMessage, - raw.types.UpdateNewScheduledMessage)): + if isinstance( + i, + ( + raw.types.UpdateNewMessage, + raw.types.UpdateNewChannelMessage, + raw.types.UpdateNewScheduledMessage, + ), + ): return await types.Message._parse( - self, i.message, + self, + i.message, {i.id: i for i in r.users}, {i.id: i for i in r.chats}, - is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage) + is_scheduled=isinstance( + i, raw.types.UpdateNewScheduledMessage + ), ) except StopTransmission: return None diff --git a/pyrogram/methods/messages/send_video_note.py b/pyrogram/methods/messages/send_video_note.py index 4fbe0d47a..a9b391a29 100644 --- a/pyrogram/methods/messages/send_video_note.py +++ b/pyrogram/methods/messages/send_video_note.py @@ -54,10 +54,10 @@ async def send_video_note( "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", "types.ReplyKeyboardRemove", - "types.ForceReply" + "types.ForceReply", ] = None, progress: Callable = None, - progress_args: tuple = () + progress_args: tuple = (), ) -> Optional["types.Message"]: """Send video messages. @@ -99,7 +99,7 @@ async def send_video_note( reply_to_message_id (``int``, *optional*): If the message is a reply, ID of the original message. - + reply_to_story_id (``int``, *optional*): Unique identifier for the target story. @@ -186,14 +186,16 @@ async def send_video_note( reply_to_chat_id=reply_to_chat_id, quote_text=quote_text, quote_entities=quote_entities, - parse_mode=parse_mode + parse_mode=parse_mode, ) try: if isinstance(video_note, str): if os.path.isfile(video_note): thumb = await self.save_file(thumb) - file = await self.save_file(video_note, progress=progress, progress_args=progress_args) + file = await self.save_file( + video_note, progress=progress, progress_args=progress_args + ) media = raw.types.InputMediaUploadedDocument( mime_type=self.guess_mime_type(video_note) or "video/mp4", file=file, @@ -203,28 +205,29 @@ async def send_video_note( round_message=True, duration=duration, w=length, - h=length + h=length, ) ], - ttl_seconds=ttl_seconds + ttl_seconds=ttl_seconds, ) else: - media = utils.get_input_media_from_file_id(video_note, FileType.VIDEO_NOTE) + media = utils.get_input_media_from_file_id( + video_note, FileType.VIDEO_NOTE + ) else: thumb = await self.save_file(thumb) - file = await self.save_file(video_note, progress=progress, progress_args=progress_args) + file = await self.save_file( + video_note, progress=progress, progress_args=progress_args + ) media = raw.types.InputMediaUploadedDocument( mime_type=self.guess_mime_type(video_note.name) or "video/mp4", file=file, thumb=thumb, attributes=[ raw.types.DocumentAttributeVideo( - round_message=True, - duration=duration, - w=length, - h=length + round_message=True, duration=duration, w=length, h=length ) - ] + ], ) while True: @@ -238,22 +241,32 @@ async def send_video_note( random_id=self.rnd_id(), schedule_date=utils.datetime_to_timestamp(schedule_date), noforwards=protect_content, - reply_markup=await reply_markup.write(self) if reply_markup else None, - message="" + reply_markup=await reply_markup.write(self) + if reply_markup + else None, + message="", ) ) except FilePartMissing as e: await self.save_file(video_note, file_id=file.id, file_part=e.value) else: for i in r.updates: - if isinstance(i, (raw.types.UpdateNewMessage, - raw.types.UpdateNewChannelMessage, - raw.types.UpdateNewScheduledMessage)): + if isinstance( + i, + ( + raw.types.UpdateNewMessage, + raw.types.UpdateNewChannelMessage, + raw.types.UpdateNewScheduledMessage, + ), + ): return await types.Message._parse( - self, i.message, + self, + i.message, {i.id: i for i in r.users}, {i.id: i for i in r.chats}, - is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage) + is_scheduled=isinstance( + i, raw.types.UpdateNewScheduledMessage + ), ) except StopTransmission: return None diff --git a/pyrogram/methods/messages/send_voice.py b/pyrogram/methods/messages/send_voice.py index d300cc2e3..d205332b3 100644 --- a/pyrogram/methods/messages/send_voice.py +++ b/pyrogram/methods/messages/send_voice.py @@ -53,10 +53,10 @@ async def send_voice( "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", "types.ReplyKeyboardRemove", - "types.ForceReply" + "types.ForceReply", ] = None, progress: Callable = None, - progress_args: tuple = () + progress_args: tuple = (), ) -> Optional["types.Message"]: """Send audio files. @@ -99,10 +99,10 @@ async def send_voice( reply_to_message_id (``int``, *optional*): If the message is a reply, ID of the original message - + reply_to_story_id (``int``, *optional*): Unique identifier for the target story. - + reply_to_story_id (``int``, *optional*): Unique identifier for the target story. @@ -178,40 +178,38 @@ async def send_voice( reply_to_chat_id=reply_to_chat_id, quote_text=quote_text, quote_entities=quote_entities, - parse_mode=parse_mode + parse_mode=parse_mode, ) try: if isinstance(voice, str): if os.path.isfile(voice): - file = await self.save_file(voice, progress=progress, progress_args=progress_args) + file = await self.save_file( + voice, progress=progress, progress_args=progress_args + ) media = raw.types.InputMediaUploadedDocument( mime_type=self.guess_mime_type(voice) or "audio/mpeg", file=file, attributes=[ raw.types.DocumentAttributeAudio( - voice=True, - duration=duration + voice=True, duration=duration ) - ] + ], ) elif re.match("^https?://", voice): - media = raw.types.InputMediaDocumentExternal( - url=voice - ) + media = raw.types.InputMediaDocumentExternal(url=voice) else: media = utils.get_input_media_from_file_id(voice, FileType.VOICE) else: - file = await self.save_file(voice, progress=progress, progress_args=progress_args) + file = await self.save_file( + voice, progress=progress, progress_args=progress_args + ) media = raw.types.InputMediaUploadedDocument( mime_type=self.guess_mime_type(voice.name) or "audio/mpeg", file=file, attributes=[ - raw.types.DocumentAttributeAudio( - voice=True, - duration=duration - ) - ] + raw.types.DocumentAttributeAudio(voice=True, duration=duration) + ], ) while True: @@ -225,22 +223,34 @@ async def send_voice( random_id=self.rnd_id(), schedule_date=utils.datetime_to_timestamp(schedule_date), noforwards=protect_content, - reply_markup=await reply_markup.write(self) if reply_markup else None, - **await utils.parse_text_entities(self, caption, parse_mode, caption_entities) + reply_markup=await reply_markup.write(self) + if reply_markup + else None, + **await utils.parse_text_entities( + self, caption, parse_mode, caption_entities + ) ) ) except FilePartMissing as e: await self.save_file(voice, file_id=file.id, file_part=e.value) else: for i in r.updates: - if isinstance(i, (raw.types.UpdateNewMessage, - raw.types.UpdateNewChannelMessage, - raw.types.UpdateNewScheduledMessage)): + if isinstance( + i, + ( + raw.types.UpdateNewMessage, + raw.types.UpdateNewChannelMessage, + raw.types.UpdateNewScheduledMessage, + ), + ): return await types.Message._parse( - self, i.message, + self, + i.message, {i.id: i for i in r.users}, {i.id: i for i in r.chats}, - is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage) + is_scheduled=isinstance( + i, raw.types.UpdateNewScheduledMessage + ), ) except StopTransmission: return None diff --git a/pyrogram/methods/messages/send_web_page.py b/pyrogram/methods/messages/send_web_page.py index 5a9aec9fe..47afab4d5 100644 --- a/pyrogram/methods/messages/send_web_page.py +++ b/pyrogram/methods/messages/send_web_page.py @@ -24,6 +24,7 @@ from pyrogram import raw, utils, enums from pyrogram import types + class SendWebPage: async def send_web_page( self: "pyrogram.Client", @@ -47,8 +48,8 @@ async def send_web_page( "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", "types.ReplyKeyboardRemove", - "types.ForceReply" - ] = None + "types.ForceReply", + ] = None, ) -> "types.Message": """Send text Web Page Preview. @@ -90,7 +91,7 @@ async def send_web_page( reply_to_message_id (``int``, *optional*): If the message is a reply, ID of the original message. - + reply_to_story_id (``int``, *optional*): Unique identifier for the target story. @@ -127,7 +128,9 @@ async def send_web_page( """ - message, entities = (await utils.parse_text_entities(self, text, parse_mode, entities)).values() + message, entities = ( + await utils.parse_text_entities(self, text, parse_mode, entities) + ).values() reply_to = await utils.get_reply_to( client=self, @@ -138,13 +141,11 @@ async def send_web_page( reply_to_chat_id=reply_to_chat_id, quote_text=quote_text, quote_entities=quote_entities, - parse_mode=parse_mode + parse_mode=parse_mode, ) media = raw.types.InputMediaWebPage( - url=url, - force_large_media=large_media, - force_small_media=not large_media + url=url, force_large_media=large_media, force_small_media=not large_media ) r = await self.invoke( raw.functions.messages.SendMedia( @@ -158,7 +159,7 @@ async def send_web_page( media=media, invert_media=invert_media, entities=entities, - noforwards=protect_content + noforwards=protect_content, ) ) @@ -172,29 +173,32 @@ async def send_web_page( ) return types.Message( id=r.id, - chat=types.Chat( - id=peer_id, - type=enums.ChatType.PRIVATE, - client=self - ), + chat=types.Chat(id=peer_id, type=enums.ChatType.PRIVATE, client=self), text=message, date=utils.timestamp_to_datetime(r.date), outgoing=r.out, reply_markup=reply_markup, entities=[ - types.MessageEntity._parse(None, entity, {}) - for entity in entities - ] if entities else None, - client=self + types.MessageEntity._parse(None, entity, {}) for entity in entities + ] + if entities + else None, + client=self, ) for i in r.updates: - if isinstance(i, (raw.types.UpdateNewMessage, - raw.types.UpdateNewChannelMessage, - raw.types.UpdateNewScheduledMessage)): + if isinstance( + i, + ( + raw.types.UpdateNewMessage, + raw.types.UpdateNewChannelMessage, + raw.types.UpdateNewScheduledMessage, + ), + ): return await types.Message._parse( - self, i.message, + self, + i.message, {i.id: i for i in r.users}, {i.id: i for i in r.chats}, - is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage) + is_scheduled=isinstance(i, raw.types.UpdateNewScheduledMessage), ) diff --git a/pyrogram/methods/messages/stop_poll.py b/pyrogram/methods/messages/stop_poll.py index c809be347..4940c7a14 100644 --- a/pyrogram/methods/messages/stop_poll.py +++ b/pyrogram/methods/messages/stop_poll.py @@ -28,7 +28,7 @@ async def stop_poll( self: "pyrogram.Client", chat_id: Union[int, str], message_id: int, - reply_markup: "types.InlineKeyboardMarkup" = None + reply_markup: "types.InlineKeyboardMarkup" = None, ) -> "types.Poll": """Stop a poll which was sent by you. @@ -65,13 +65,10 @@ async def stop_poll( id=message_id, media=raw.types.InputMediaPoll( poll=raw.types.Poll( - id=int(poll.id), - closed=True, - question="", - answers=[] + id=int(poll.id), closed=True, question="", answers=[] ) ), - reply_markup=await reply_markup.write(self) if reply_markup else None + reply_markup=await reply_markup.write(self) if reply_markup else None, ) ) diff --git a/pyrogram/methods/messages/stream_media.py b/pyrogram/methods/messages/stream_media.py index b432badb4..b88af0a3e 100644 --- a/pyrogram/methods/messages/stream_media.py +++ b/pyrogram/methods/messages/stream_media.py @@ -29,7 +29,7 @@ async def stream_media( self: "pyrogram.Client", message: Union["types.Message", str], limit: int = 0, - offset: int = 0 + offset: int = 0, ) -> Optional[Union[str, BinaryIO]]: """Stream the media from a message chunk by chunk. @@ -73,8 +73,17 @@ async def stream_media( async for chunk in app.stream_media(message, offset=-3): print(len(chunk)) """ - available_media = ("audio", "document", "photo", "sticker", "animation", "video", "voice", "video_note", - "new_chat_photo") + available_media = ( + "audio", + "document", + "photo", + "sticker", + "animation", + "video", + "voice", + "video_note", + "new_chat_photo", + ) if isinstance(message, types.Message): for kind in available_media: @@ -97,7 +106,9 @@ async def stream_media( if offset < 0: if file_size == 0: - raise ValueError("Negative offsets are not supported for file ids, pass a Message object instead") + raise ValueError( + "Negative offsets are not supported for file ids, pass a Message object instead" + ) chunks = math.ceil(file_size / 1024 / 1024) offset += chunks diff --git a/pyrogram/methods/messages/vote_poll.py b/pyrogram/methods/messages/vote_poll.py index 76b00d34b..25fa0c266 100644 --- a/pyrogram/methods/messages/vote_poll.py +++ b/pyrogram/methods/messages/vote_poll.py @@ -28,7 +28,7 @@ async def vote_poll( self: "pyrogram.Client", chat_id: Union[int, str], message_id: id, - options: Union[int, List[int]] + options: Union[int, List[int]], ) -> "types.Poll": """Vote a poll. @@ -63,7 +63,7 @@ async def vote_poll( raw.functions.messages.SendVote( peer=await self.resolve_peer(chat_id), msg_id=message_id, - options=[poll.options[option].data for option in options] + options=[poll.options[option].data for option in options], ) ) diff --git a/pyrogram/methods/password/__init__.py b/pyrogram/methods/password/__init__.py index e8d42926a..4c16a20d9 100644 --- a/pyrogram/methods/password/__init__.py +++ b/pyrogram/methods/password/__init__.py @@ -21,9 +21,5 @@ from .remove_cloud_password import RemoveCloudPassword -class Password( - RemoveCloudPassword, - ChangeCloudPassword, - EnableCloudPassword -): +class Password(RemoveCloudPassword, ChangeCloudPassword, EnableCloudPassword): pass diff --git a/pyrogram/methods/password/change_cloud_password.py b/pyrogram/methods/password/change_cloud_password.py index 29540d653..c34a7321f 100644 --- a/pyrogram/methods/password/change_cloud_password.py +++ b/pyrogram/methods/password/change_cloud_password.py @@ -28,7 +28,7 @@ async def change_cloud_password( self: "pyrogram.Client", current_password: str, new_password: str, - new_hint: str = "" + new_hint: str = "", ) -> bool: """Change your Two-Step Verification password (Cloud Password) with a new one. @@ -72,10 +72,8 @@ async def change_cloud_password( raw.functions.account.UpdatePasswordSettings( password=compute_password_check(r, current_password), new_settings=raw.types.account.PasswordInputSettings( - new_algo=r.new_algo, - new_password_hash=new_hash, - hint=new_hint - ) + new_algo=r.new_algo, new_password_hash=new_hash, hint=new_hint + ), ) ) diff --git a/pyrogram/methods/password/enable_cloud_password.py b/pyrogram/methods/password/enable_cloud_password.py index 8f5e59c57..14ae7549b 100644 --- a/pyrogram/methods/password/enable_cloud_password.py +++ b/pyrogram/methods/password/enable_cloud_password.py @@ -25,10 +25,7 @@ class EnableCloudPassword: async def enable_cloud_password( - self: "pyrogram.Client", - password: str, - hint: str = "", - email: str = None + self: "pyrogram.Client", password: str, hint: str = "", email: str = None ) -> bool: """Enable the Two-Step Verification security feature (Cloud Password) on your account. @@ -80,8 +77,8 @@ async def enable_cloud_password( new_algo=r.new_algo, new_password_hash=new_hash, hint=hint, - email=email - ) + email=email, + ), ) ) diff --git a/pyrogram/methods/password/remove_cloud_password.py b/pyrogram/methods/password/remove_cloud_password.py index 0ec16e12c..1ada1b289 100644 --- a/pyrogram/methods/password/remove_cloud_password.py +++ b/pyrogram/methods/password/remove_cloud_password.py @@ -22,10 +22,7 @@ class RemoveCloudPassword: - async def remove_cloud_password( - self: "pyrogram.Client", - password: str - ) -> bool: + async def remove_cloud_password(self: "pyrogram.Client", password: str) -> bool: """Turn off the Two-Step Verification security feature (Cloud Password) on your account. .. include:: /_includes/usable-by/users.rst @@ -56,8 +53,8 @@ async def remove_cloud_password( new_settings=raw.types.account.PasswordInputSettings( new_algo=raw.types.PasswordKdfAlgoUnknown(), new_password_hash=b"", - hint="" - ) + hint="", + ), ) ) diff --git a/pyrogram/methods/pyromod/__init__.py b/pyrogram/methods/pyromod/__init__.py index 933c132f0..45e484418 100644 --- a/pyrogram/methods/pyromod/__init__.py +++ b/pyrogram/methods/pyromod/__init__.py @@ -18,9 +18,13 @@ from .ask import Ask from .get_listener_matching_with_data import GetListenerMatchingWithData -from .get_listener_matching_with_identifier_pattern import GetListenerMatchingWithIdentifierPattern +from .get_listener_matching_with_identifier_pattern import ( + GetListenerMatchingWithIdentifierPattern, +) from .get_many_listeners_matching_with_data import GetManyListenersMatchingWithData -from .get_many_listeners_matching_with_identifier_pattern import GetManyListenersMatchingWithIdentifierPattern +from .get_many_listeners_matching_with_identifier_pattern import ( + GetManyListenersMatchingWithIdentifierPattern, +) from .listen import Listen from .register_next_step_handler import RegisterNextStepHandler from .remove_listerner import RemoveListener @@ -29,6 +33,7 @@ from .wait_for_callback_query import WaitForCallbackQuery from .wait_for_message import WaitForMessage + class Pyromod( Ask, GetListenerMatchingWithData, @@ -41,6 +46,6 @@ class Pyromod( StopListener, StopListening, WaitForCallbackQuery, - WaitForMessage + WaitForMessage, ): pass diff --git a/pyrogram/methods/pyromod/ask.py b/pyrogram/methods/pyromod/ask.py index e88b29337..2e03ac617 100644 --- a/pyrogram/methods/pyromod/ask.py +++ b/pyrogram/methods/pyromod/ask.py @@ -22,6 +22,7 @@ from pyrogram.filters import Filter from typing import List, Optional, Union + class Ask: async def ask( self: "pyrogram.Client", diff --git a/pyrogram/methods/pyromod/get_listener_matching_with_data.py b/pyrogram/methods/pyromod/get_listener_matching_with_data.py index 690b15b16..54bd59f5a 100644 --- a/pyrogram/methods/pyromod/get_listener_matching_with_data.py +++ b/pyrogram/methods/pyromod/get_listener_matching_with_data.py @@ -22,11 +22,12 @@ from typing import Optional from pyrogram.types import Identifier, Listener + class GetListenerMatchingWithData: def get_listener_matching_with_data( self: "pyrogram.Client", data: Identifier, - listener_type: "pyrogram.enums.ListenerTypes" + listener_type: "pyrogram.enums.ListenerTypes", ) -> Optional[Listener]: """Gets a listener that matches the given data. diff --git a/pyrogram/methods/pyromod/get_listener_matching_with_identifier_pattern.py b/pyrogram/methods/pyromod/get_listener_matching_with_identifier_pattern.py index c045e7a5d..678406fdf 100644 --- a/pyrogram/methods/pyromod/get_listener_matching_with_identifier_pattern.py +++ b/pyrogram/methods/pyromod/get_listener_matching_with_identifier_pattern.py @@ -22,11 +22,12 @@ from typing import Optional from pyrogram.types import Identifier, Listener + class GetListenerMatchingWithIdentifierPattern: def get_listener_matching_with_identifier_pattern( self: "pyrogram.Client", pattern: Identifier, - listener_type: "pyrogram.enums.ListenerTypes" + listener_type: "pyrogram.enums.ListenerTypes", ) -> Optional[Listener]: """Gets a listener that matches the given identifier pattern. diff --git a/pyrogram/methods/pyromod/get_many_listeners_matching_with_data.py b/pyrogram/methods/pyromod/get_many_listeners_matching_with_data.py index b3675a9a7..b70a5b868 100644 --- a/pyrogram/methods/pyromod/get_many_listeners_matching_with_data.py +++ b/pyrogram/methods/pyromod/get_many_listeners_matching_with_data.py @@ -22,6 +22,7 @@ from typing import List from pyrogram.types import Identifier, Listener + class GetManyListenersMatchingWithData: def get_many_listeners_matching_with_data( self: "pyrogram.Client", diff --git a/pyrogram/methods/pyromod/get_many_listeners_matching_with_identifier_pattern.py b/pyrogram/methods/pyromod/get_many_listeners_matching_with_identifier_pattern.py index 4299ea656..9721978ad 100644 --- a/pyrogram/methods/pyromod/get_many_listeners_matching_with_identifier_pattern.py +++ b/pyrogram/methods/pyromod/get_many_listeners_matching_with_identifier_pattern.py @@ -22,6 +22,7 @@ from typing import List from pyrogram.types import Identifier, Listener + class GetManyListenersMatchingWithIdentifierPattern: def get_many_listeners_matching_with_identifier_pattern( self: "pyrogram.Client", diff --git a/pyrogram/methods/pyromod/listen.py b/pyrogram/methods/pyromod/listen.py index cfc5fc53c..02515a245 100644 --- a/pyrogram/methods/pyromod/listen.py +++ b/pyrogram/methods/pyromod/listen.py @@ -27,6 +27,7 @@ from pyrogram.types import Identifier, Listener from pyrogram.utils import PyromodConfig + class Listen: async def listen( self: "pyrogram.Client", diff --git a/pyrogram/methods/pyromod/register_next_step_handler.py b/pyrogram/methods/pyromod/register_next_step_handler.py index 90e9095d9..36ff75348 100644 --- a/pyrogram/methods/pyromod/register_next_step_handler.py +++ b/pyrogram/methods/pyromod/register_next_step_handler.py @@ -23,6 +23,7 @@ from typing import Callable, List, Optional, Union from pyrogram.types import Identifier, Listener + class RegisterNextStepHandler: def register_next_step_handler( self: "pyrogram.Client", diff --git a/pyrogram/methods/pyromod/remove_listerner.py b/pyrogram/methods/pyromod/remove_listerner.py index 9171c96d0..8bf304e1f 100644 --- a/pyrogram/methods/pyromod/remove_listerner.py +++ b/pyrogram/methods/pyromod/remove_listerner.py @@ -20,11 +20,9 @@ import pyrogram from pyrogram.types import Listener + class RemoveListener: - def remove_listener( - self: "pyrogram.Client", - listener: Listener - ): + def remove_listener(self: "pyrogram.Client", listener: Listener): """Removes a listener from the :meth:`~pyrogram.Client.listeners` dictionary. .. include:: /_includes/usable-by/users-bots.rst diff --git a/pyrogram/methods/pyromod/stop_listener.py b/pyrogram/methods/pyromod/stop_listener.py index 2df3ee24a..14680f83e 100644 --- a/pyrogram/methods/pyromod/stop_listener.py +++ b/pyrogram/methods/pyromod/stop_listener.py @@ -24,11 +24,9 @@ from pyrogram.types import Listener from pyrogram.utils import PyromodConfig + class StopListener: - async def stop_listener( - self: "pyrogram.Client", - listener: Listener - ): + async def stop_listener(self: "pyrogram.Client", listener: Listener): """Stops a listener, calling stopped_handler if applicable or raising ListenerStopped if throw_exceptions is True. .. include:: /_includes/usable-by/users-bots.rst diff --git a/pyrogram/methods/pyromod/stop_listening.py b/pyrogram/methods/pyromod/stop_listening.py index c2e57fda0..78cca83d3 100644 --- a/pyrogram/methods/pyromod/stop_listening.py +++ b/pyrogram/methods/pyromod/stop_listening.py @@ -22,6 +22,7 @@ from typing import List, Union from pyrogram.types import Identifier + class StopListening: async def stop_listening( self: "pyrogram.Client", diff --git a/pyrogram/methods/pyromod/wait_for_callback_query.py b/pyrogram/methods/pyromod/wait_for_callback_query.py index fd66da818..751a63ec5 100644 --- a/pyrogram/methods/pyromod/wait_for_callback_query.py +++ b/pyrogram/methods/pyromod/wait_for_callback_query.py @@ -31,7 +31,7 @@ async def wait_for_callback_query( self: "pyrogram.Client", chat_id: Union[int, str], filters: Filter = None, - timeout: int = None + timeout: int = None, ) -> "types.CallbackQuery": """Wait for callback query. @@ -73,12 +73,7 @@ async def wait_for_callback_query( conversation_handler = self.dispatcher.conversation_handler future = self.loop.create_future() - future.add_done_callback( - partial( - conversation_handler.delete_waiter, - chat_id - ) - ) + future.add_done_callback(partial(conversation_handler.delete_waiter, chat_id)) waiter = dict(future=future, filters=filters, update_type=types.CallbackQuery) conversation_handler.waiters[chat_id] = waiter return await asyncio.wait_for(future, timeout=timeout) diff --git a/pyrogram/methods/pyromod/wait_for_message.py b/pyrogram/methods/pyromod/wait_for_message.py index d2c93285e..cdbff6b22 100644 --- a/pyrogram/methods/pyromod/wait_for_message.py +++ b/pyrogram/methods/pyromod/wait_for_message.py @@ -25,12 +25,13 @@ from pyrogram import types from pyrogram.filters import Filter + class WaitForMessage: async def wait_for_message( self: "pyrogram.Client", chat_id: Union[int, str], filters: Filter = None, - timeout: int = None + timeout: int = None, ) -> "types.Message": """Wait for message. @@ -72,12 +73,7 @@ async def wait_for_message( conversation_handler = self.dispatcher.conversation_handler future = self.loop.create_future() - future.add_done_callback( - partial( - conversation_handler.delete_waiter, - chat_id - ) - ) + future.add_done_callback(partial(conversation_handler.delete_waiter, chat_id)) waiter = dict(future=future, filters=filters, update_type=types.Message) conversation_handler.waiters[chat_id] = waiter - return await asyncio.wait_for(future, timeout=timeout) \ No newline at end of file + return await asyncio.wait_for(future, timeout=timeout) diff --git a/pyrogram/methods/stickers/__init__.py b/pyrogram/methods/stickers/__init__.py index 19c6163c3..d97ca9321 100644 --- a/pyrogram/methods/stickers/__init__.py +++ b/pyrogram/methods/stickers/__init__.py @@ -20,9 +20,6 @@ from .create_sticker_set import CreateStickerSet from .get_sticker_set import GetStickerSet -class Stickers( - AddStickerToSet, - CreateStickerSet, - GetStickerSet -): + +class Stickers(AddStickerToSet, CreateStickerSet, GetStickerSet): pass diff --git a/pyrogram/methods/stickers/add_sticker_to_set.py b/pyrogram/methods/stickers/add_sticker_to_set.py index 3cfc42536..87357db10 100644 --- a/pyrogram/methods/stickers/add_sticker_to_set.py +++ b/pyrogram/methods/stickers/add_sticker_to_set.py @@ -24,6 +24,7 @@ from pyrogram import types from pyrogram.file_id import FileId + class AddStickerToSet: async def add_sticker_to_set( self: "pyrogram.Client", @@ -65,20 +66,17 @@ async def add_sticker_to_set( media = raw.types.InputDocument( id=decoded.media_id, access_hash=decoded.access_hash, - file_reference=decoded.file_reference + file_reference=decoded.file_reference, ) else: raise ValueError(f"file_id is invalid!") r = await self.invoke( raw.functions.stickers.AddStickerToSet( - stickerset=raw.types.InputStickerSetShortName(short_name=set_short_name), - sticker=[ - raw.types.InputStickerSetItem( - document=media, - emoji=emoji - ) - ] + stickerset=raw.types.InputStickerSetShortName( + short_name=set_short_name + ), + sticker=[raw.types.InputStickerSetItem(document=media, emoji=emoji)], ) ) diff --git a/pyrogram/methods/stickers/create_sticker_set.py b/pyrogram/methods/stickers/create_sticker_set.py index 744ca0347..0ddc8a1fb 100644 --- a/pyrogram/methods/stickers/create_sticker_set.py +++ b/pyrogram/methods/stickers/create_sticker_set.py @@ -37,7 +37,7 @@ async def create_sticker_set( masks: bool = None, animated: bool = None, videos: bool = None, - emojis: bool = None + emojis: bool = None, ) -> Optional["types.Message"]: """Create a new stickerset. @@ -96,7 +96,7 @@ async def create_sticker_set( media = raw.types.InputDocument( id=decoded.media_id, access_hash=decoded.access_hash, - file_reference=decoded.file_reference + file_reference=decoded.file_reference, ) else: raise ValueError(f"file_id is invalid!") @@ -106,16 +106,11 @@ async def create_sticker_set( user_id=await self.resolve_peer(user_id), title=title, short_name=short_name, - stickers=[ - raw.types.InputStickerSetItem( - document=media, - emoji=emoji - ) - ], + stickers=[raw.types.InputStickerSetItem(document=media, emoji=emoji)], masks=masks, animated=animated, videos=videos, - emojis=emojis + emojis=emojis, ) ) diff --git a/pyrogram/methods/stickers/get_sticker_set.py b/pyrogram/methods/stickers/get_sticker_set.py index ef229c65c..519522515 100644 --- a/pyrogram/methods/stickers/get_sticker_set.py +++ b/pyrogram/methods/stickers/get_sticker_set.py @@ -23,8 +23,7 @@ class GetStickerSet: async def get_sticker_set( - self: "pyrogram.Client", - set_short_name: str + self: "pyrogram.Client", set_short_name: str ) -> "types.StickerSet": """Get info about a stickerset. @@ -44,8 +43,10 @@ async def get_sticker_set( """ r = await self.invoke( raw.functions.messages.GetStickerSet( - stickerset=raw.types.InputStickerSetShortName(short_name=set_short_name), - hash=0 + stickerset=raw.types.InputStickerSetShortName( + short_name=set_short_name + ), + hash=0, ) ) diff --git a/pyrogram/methods/users/__init__.py b/pyrogram/methods/users/__init__.py index be4d6037d..934a2980b 100644 --- a/pyrogram/methods/users/__init__.py +++ b/pyrogram/methods/users/__init__.py @@ -62,6 +62,6 @@ class Users( UpdateProfile, GetDefaultEmojiStatuses, SetEmojiStatus, - SendStory + SendStory, ): pass diff --git a/pyrogram/methods/users/block_user.py b/pyrogram/methods/users/block_user.py index 6782ada89..27243343b 100644 --- a/pyrogram/methods/users/block_user.py +++ b/pyrogram/methods/users/block_user.py @@ -23,10 +23,7 @@ class BlockUser: - async def block_user( - self: "pyrogram.Client", - user_id: Union[int, str] - ) -> bool: + async def block_user(self: "pyrogram.Client", user_id: Union[int, str]) -> bool: """Block a user. .. include:: /_includes/usable-by/users.rst @@ -48,8 +45,6 @@ async def block_user( """ return bool( await self.invoke( - raw.functions.contacts.Block( - id=await self.resolve_peer(user_id) - ) + raw.functions.contacts.Block(id=await self.resolve_peer(user_id)) ) ) diff --git a/pyrogram/methods/users/delete_profile_photos.py b/pyrogram/methods/users/delete_profile_photos.py index 2b52d02f5..41efccab6 100644 --- a/pyrogram/methods/users/delete_profile_photos.py +++ b/pyrogram/methods/users/delete_profile_photos.py @@ -26,8 +26,7 @@ class DeleteProfilePhotos: async def delete_profile_photos( - self: "pyrogram.Client", - photo_ids: Union[str, List[str]] + self: "pyrogram.Client", photo_ids: Union[str, List[str]] ) -> bool: """Delete your own profile photos. @@ -54,10 +53,10 @@ async def delete_profile_photos( await app.delete_profile_photos([p.file_id for p in photos[1:]]) """ photo_ids = photo_ids if isinstance(photo_ids, list) else [photo_ids] - input_photos = [utils.get_input_media_from_file_id(i, FileType.PHOTO).id for i in photo_ids] + input_photos = [ + utils.get_input_media_from_file_id(i, FileType.PHOTO).id for i in photo_ids + ] - return bool(await self.invoke( - raw.functions.photos.DeletePhotos( - id=input_photos - ) - )) + return bool( + await self.invoke(raw.functions.photos.DeletePhotos(id=input_photos)) + ) diff --git a/pyrogram/methods/users/delete_stories.py b/pyrogram/methods/users/delete_stories.py index 2b2898d07..893102229 100644 --- a/pyrogram/methods/users/delete_stories.py +++ b/pyrogram/methods/users/delete_stories.py @@ -25,11 +25,12 @@ log = logging.getLogger(__name__) + class DeleteStories: async def delete_stories( self: "pyrogram.Client", story_ids: Union[int, Iterable[int]], - chat_id: Union[int, str] = None + chat_id: Union[int, str] = None, ) -> bool: """Delete one or more story by using story identifiers. @@ -59,16 +60,14 @@ async def delete_stories( is_iterable = not isinstance(story_ids, int) ids = list(story_ids) if is_iterable else [story_ids] - + if chat_id: peer = await self.resolve_peer(chat_id) else: peer = await self.resolve_peer("me") try: - await self.invoke( - raw.functions.stories.DeleteStories(peer=peer,id=ids) - ) + await self.invoke(raw.functions.stories.DeleteStories(peer=peer, id=ids)) except Exception as e: print(e) return False diff --git a/pyrogram/methods/users/edit_story.py b/pyrogram/methods/users/edit_story.py index 8b78025ba..3339ff9b8 100644 --- a/pyrogram/methods/users/edit_story.py +++ b/pyrogram/methods/users/edit_story.py @@ -24,6 +24,7 @@ from pyrogram import enums, raw, types, utils from pyrogram.file_id import FileType + class EditStory: def _split(self, message, entities, *args, **kwargs): return message, entities @@ -35,15 +36,15 @@ async def edit_story( privacy: "enums.StoriesPrivacyRules" = None, allowed_users: List[int] = None, denied_users: List[int] = None, - #allowed_chats: List[int] = None, - #denied_chats: List[int] = None, + # allowed_chats: List[int] = None, + # denied_chats: List[int] = None, animation: str = None, photo: str = None, video: str = None, caption: str = None, parse_mode: "enums.ParseMode" = None, caption_entities: List["types.MessageEntity"] = None, - media_areas: List["types.InputMediaArea"] = None + media_areas: List["types.InputMediaArea"] = None, ) -> "types.Story": """Edit story. @@ -52,7 +53,7 @@ async def edit_story( Parameters: story_id (``int``): Unique identifier (int) of the target story. - + chat_id (``int``, *optional*): Unique identifier (int) of the target channel. You can also use channel public link in form of *t.me/* (str). @@ -134,20 +135,17 @@ async def edit_story( file=file, attributes=[ raw.types.DocumentAttributeVideo( - supports_streaming=True, - duration=0, - w=0, - h=0 + supports_streaming=True, duration=0, w=0, h=0 ), - raw.types.DocumentAttributeAnimated() - ] + raw.types.DocumentAttributeAnimated(), + ], ) elif re.match("^https?://", animation): - media = raw.types.InputMediaDocumentExternal( - url=animation - ) + media = raw.types.InputMediaDocumentExternal(url=animation) else: - media = utils.get_input_media_from_file_id(animation, FileType.ANIMATION) + media = utils.get_input_media_from_file_id( + animation, FileType.ANIMATION + ) else: file = await self.save_file(animation) media = raw.types.InputMediaUploadedDocument( @@ -155,32 +153,23 @@ async def edit_story( file=file, attributes=[ raw.types.DocumentAttributeVideo( - supports_streaming=True, - duration=0, - w=0, - h=0 + supports_streaming=True, duration=0, w=0, h=0 ), - raw.types.DocumentAttributeAnimated() - ] + raw.types.DocumentAttributeAnimated(), + ], ) elif photo: if isinstance(photo, str): if os.path.isfile(photo): file = await self.save_file(photo) - media = raw.types.InputMediaUploadedPhoto( - file=file - ) + media = raw.types.InputMediaUploadedPhoto(file=file) elif re.match("^https?://", photo): - media = raw.types.InputMediaPhotoExternal( - url=photo - ) + media = raw.types.InputMediaPhotoExternal(url=photo) else: media = utils.get_input_media_from_file_id(photo, FileType.PHOTO) else: file = await self.save_file(photo) - media = raw.types.InputMediaUploadedPhoto( - file=file - ) + media = raw.types.InputMediaUploadedPhoto(file=file) elif video: if isinstance(video, str): if os.path.isfile(video): @@ -190,17 +179,12 @@ async def edit_story( file=file, attributes=[ raw.types.DocumentAttributeVideo( - supports_streaming=True, - duration=0, - w=0, - h=0 + supports_streaming=True, duration=0, w=0, h=0 ) - ] + ], ) elif re.match("^https?://", video): - media = raw.types.InputMediaDocumentExternal( - url=video - ) + media = raw.types.InputMediaDocumentExternal(url=video) else: media = utils.get_input_media_from_file_id(video, FileType.VIDEO) else: @@ -210,26 +194,27 @@ async def edit_story( file=file, attributes=[ raw.types.DocumentAttributeVideo( - supports_streaming=True, - duration=0, - w=0, - h=0 + supports_streaming=True, duration=0, w=0, h=0 ) - ] + ], ) text = None entities = None if caption: - text, entities = self._split(**await utils.parse_text_entities(self, caption, parse_mode, caption_entities)) + text, entities = self._split( + **await utils.parse_text_entities( + self, caption, parse_mode, caption_entities + ) + ) - ''' + """ if allowed_chats and len(allowed_chats) > 0: chats = [int(str(chat_id)[3:]) if str(chat_id).startswith("-100") else chat_id for chat_id in allowed_chats] privacy_rules.append(raw.types.InputPrivacyValueAllowChatParticipants(chats=chats)) if denied_chats and len(denied_chats) > 0: chats = [int(str(chat_id)[3:]) if str(chat_id).startswith("-100") else chat_id for chat_id in denied_chats] privacy_rules.append(raw.types.InputPrivacyValueDisallowChatParticipants(chats=chats)) - ''' + """ if allowed_users and len(allowed_users) > 0: users = [await self.resolve_peer(user_id) for user_id in allowed_users] privacy_rules.append(raw.types.InputPrivacyValueAllowUsers(users=users)) @@ -246,9 +231,8 @@ async def edit_story( caption=text, entities=entities, media_areas=[ - await media_area.write(self) - for media_area in media_areas - ] + await media_area.write(self) for media_area in media_areas + ], ) ) return await types.Story._parse(self, r.updates[0].story, r.updates[0].peer) diff --git a/pyrogram/methods/users/export_story_link.py b/pyrogram/methods/users/export_story_link.py index dec8e24c7..c82e91120 100644 --- a/pyrogram/methods/users/export_story_link.py +++ b/pyrogram/methods/users/export_story_link.py @@ -25,6 +25,7 @@ log = logging.getLogger(__name__) + class ExportStoryLink: async def export_story_link( self: "pyrogram.Client", diff --git a/pyrogram/methods/users/forward_story.py b/pyrogram/methods/users/forward_story.py index ab37bf649..3f374c5d9 100644 --- a/pyrogram/methods/users/forward_story.py +++ b/pyrogram/methods/users/forward_story.py @@ -21,6 +21,7 @@ import pyrogram from pyrogram import enums, types + class ForwardStory: def _split(self, message, entities, *args, **kwargs): return message, entities @@ -33,14 +34,14 @@ async def forward_story( privacy: "enums.StoriesPrivacyRules" = None, allowed_users: List[int] = None, denied_users: List[int] = None, - #allowed_chats: List[int] = None, - #denied_chats: List[int] = None, + # allowed_chats: List[int] = None, + # denied_chats: List[int] = None, pinned: bool = None, protect_content: bool = None, caption: str = None, parse_mode: "enums.ParseMode" = None, caption_entities: List["types.MessageEntity"] = None, - period: int = None + period: int = None, ) -> "types.Story": """Forward a story. @@ -105,7 +106,7 @@ async def forward_story( Raises: ValueError: In case of invalid arguments. """ - + return await self.send_story( chat_id=chat_id, privacy=privacy, @@ -118,5 +119,5 @@ async def forward_story( parse_mode=parse_mode, period=period, forward_from_chat_id=from_chat_id, - forward_from_story_id=from_story_id + forward_from_story_id=from_story_id, ) diff --git a/pyrogram/methods/users/get_all_stories.py b/pyrogram/methods/users/get_all_stories.py index 343729269..fc0d7a799 100644 --- a/pyrogram/methods/users/get_all_stories.py +++ b/pyrogram/methods/users/get_all_stories.py @@ -25,9 +25,10 @@ log = logging.getLogger(__name__) + class GetAllStories: async def get_all_stories( - self: "pyrogram.Client" + self: "pyrogram.Client", ) -> Optional[AsyncGenerator["types.Story", None]]: """Get all active stories. diff --git a/pyrogram/methods/users/get_chat_photos.py b/pyrogram/methods/users/get_chat_photos.py index 94552b275..e3f217fdf 100644 --- a/pyrogram/methods/users/get_chat_photos.py +++ b/pyrogram/methods/users/get_chat_photos.py @@ -56,9 +56,7 @@ async def get_chat_photos( if isinstance(peer_id, raw.types.InputPeerChannel): r = await self.invoke( - raw.functions.channels.GetFullChannel( - channel=peer_id - ) + raw.functions.channels.GetFullChannel(channel=peer_id) ) current = types.Photo._parse(self, r.full_chat.chat_photo) or [] @@ -77,16 +75,20 @@ async def get_chat_photos( limit=limit, max_id=0, min_id=0, - hash=0 + hash=0, ) - ) + ), ) extra = [message.new_chat_photo for message in r] if extra: if current: - photos = ([current] + extra) if current.file_id != extra[0].file_id else extra + photos = ( + ([current] + extra) + if current.file_id != extra[0].file_id + else extra + ) else: photos = extra else: @@ -113,10 +115,7 @@ async def get_chat_photos( while True: r = await self.invoke( raw.functions.photos.GetUserPhotos( - user_id=peer_id, - offset=offset, - max_id=0, - limit=limit + user_id=peer_id, offset=offset, max_id=0, limit=limit ) ) diff --git a/pyrogram/methods/users/get_chat_photos_count.py b/pyrogram/methods/users/get_chat_photos_count.py index 74d0081cf..14561ab09 100644 --- a/pyrogram/methods/users/get_chat_photos_count.py +++ b/pyrogram/methods/users/get_chat_photos_count.py @@ -24,8 +24,7 @@ class GetChatPhotosCount: async def get_chat_photos_count( - self: "pyrogram.Client", - chat_id: Union[int, str] + self: "pyrogram.Client", chat_id: Union[int, str] ) -> int: """Get the total count of photos for a chat. @@ -62,10 +61,7 @@ async def get_chat_photos_count( else: r = await self.invoke( raw.functions.photos.GetUserPhotos( - user_id=peer_id, - offset=0, - max_id=0, - limit=1 + user_id=peer_id, offset=0, max_id=0, limit=1 ) ) diff --git a/pyrogram/methods/users/get_common_chats.py b/pyrogram/methods/users/get_common_chats.py index b4cba4fd0..cf94127a5 100644 --- a/pyrogram/methods/users/get_common_chats.py +++ b/pyrogram/methods/users/get_common_chats.py @@ -25,8 +25,7 @@ class GetCommonChats: async def get_common_chats( - self: "pyrogram.Client", - user_id: Union[int, str] + self: "pyrogram.Client", user_id: Union[int, str] ) -> List["types.Chat"]: """Get the common chats you have with a user. diff --git a/pyrogram/methods/users/get_default_emoji_statuses.py b/pyrogram/methods/users/get_default_emoji_statuses.py index cd3768b9a..f28e65ce4 100644 --- a/pyrogram/methods/users/get_default_emoji_statuses.py +++ b/pyrogram/methods/users/get_default_emoji_statuses.py @@ -40,8 +40,6 @@ async def get_default_emoji_statuses( default_emoji_statuses = await app.get_default_emoji_statuses() print(default_emoji_statuses) """ - r = await self.invoke( - raw.functions.account.GetDefaultEmojiStatuses(hash=0) - ) + r = await self.invoke(raw.functions.account.GetDefaultEmojiStatuses(hash=0)) return types.List([types.EmojiStatus._parse(self, i) for i in r.statuses]) diff --git a/pyrogram/methods/users/get_me.py b/pyrogram/methods/users/get_me.py index a8df3ae9f..cfff17155 100644 --- a/pyrogram/methods/users/get_me.py +++ b/pyrogram/methods/users/get_me.py @@ -22,9 +22,7 @@ class GetMe: - async def get_me( - self: "pyrogram.Client" - ) -> "types.User": + async def get_me(self: "pyrogram.Client") -> "types.User": """Get your own user identity. .. include:: /_includes/usable-by/users-bots.rst @@ -39,9 +37,7 @@ async def get_me( print(me) """ r = await self.invoke( - raw.functions.users.GetFullUser( - id=raw.types.InputUserSelf() - ) + raw.functions.users.GetFullUser(id=raw.types.InputUserSelf()) ) users = {u.id: u for u in r.users} diff --git a/pyrogram/methods/users/get_peer_stories.py b/pyrogram/methods/users/get_peer_stories.py index 939ca812c..aa2b0b802 100644 --- a/pyrogram/methods/users/get_peer_stories.py +++ b/pyrogram/methods/users/get_peer_stories.py @@ -25,10 +25,10 @@ log = logging.getLogger(__name__) + class GetPeerStories: async def get_peer_stories( - self: "pyrogram.Client", - chat_id: Union[int, str] + self: "pyrogram.Client", chat_id: Union[int, str] ) -> Optional[AsyncGenerator["types.Story", None]]: """Get all active stories from an user/channel by using user identifiers. @@ -57,7 +57,6 @@ async def get_peer_stories( peer = await self.resolve_peer(chat_id) - rpc = raw.functions.stories.GetPeerStories(peer=peer) r = await self.invoke(rpc, sleep_threshold=-1) diff --git a/pyrogram/methods/users/get_stories.py b/pyrogram/methods/users/get_stories.py index 97ea8a6d6..db6b70268 100644 --- a/pyrogram/methods/users/get_stories.py +++ b/pyrogram/methods/users/get_stories.py @@ -25,6 +25,7 @@ log = logging.getLogger(__name__) + class GetStories: async def get_stories( self: "pyrogram.Client", @@ -73,5 +74,7 @@ async def get_stories( r = await self.invoke(rpc, sleep_threshold=-1) if is_iterable: - return types.List([await types.Story._parse(self, story, peer) for story in r.stories]) + return types.List( + [await types.Story._parse(self, story, peer) for story in r.stories] + ) return await types.Story._parse(self, r.stories[0], peer) diff --git a/pyrogram/methods/users/get_stories_history.py b/pyrogram/methods/users/get_stories_history.py index a89b18454..6e2e4dda8 100644 --- a/pyrogram/methods/users/get_stories_history.py +++ b/pyrogram/methods/users/get_stories_history.py @@ -25,12 +25,10 @@ log = logging.getLogger(__name__) + class GetUserStoriesHistory: async def get_stories_history( - self: "pyrogram.Client", - chat_id: int = None, - limit: int = 0, - offset_id: int = 0 + self: "pyrogram.Client", chat_id: int = None, limit: int = 0, offset_id: int = 0 ) -> Optional[AsyncGenerator["types.Story", None]]: """Get stories history. @@ -61,13 +59,15 @@ async def get_stories_history( Raises: ValueError: In case of invalid arguments. """ - + if chat_id: peer = await self.resolve_peer(chat_id) else: peer = await self.resolve_peer("me") - rpc = raw.functions.stories.GetStoriesArchive(peer=peer, offset_id=offset_id, limit=limit) + rpc = raw.functions.stories.GetStoriesArchive( + peer=peer, offset_id=offset_id, limit=limit + ) r = await self.invoke(rpc, sleep_threshold=-1) diff --git a/pyrogram/methods/users/get_users.py b/pyrogram/methods/users/get_users.py index 3f11df34a..02d53b2f2 100644 --- a/pyrogram/methods/users/get_users.py +++ b/pyrogram/methods/users/get_users.py @@ -26,8 +26,7 @@ class GetUsers: async def get_users( - self: "pyrogram.Client", - user_ids: Union[int, str, Iterable[Union[int, str]]] + self: "pyrogram.Client", user_ids: Union[int, str, Iterable[Union[int, str]]] ) -> Union["types.User", List["types.User"]]: """Get information about a user. You can retrieve up to 200 users at once. @@ -58,11 +57,7 @@ async def get_users( user_ids = list(user_ids) if is_iterable else [user_ids] user_ids = await asyncio.gather(*[self.resolve_peer(i) for i in user_ids]) - r = await self.invoke( - raw.functions.users.GetUsers( - id=user_ids - ) - ) + r = await self.invoke(raw.functions.users.GetUsers(id=user_ids)) users = types.List() diff --git a/pyrogram/methods/users/send_story.py b/pyrogram/methods/users/send_story.py index 8808a66cf..ca2d7614e 100644 --- a/pyrogram/methods/users/send_story.py +++ b/pyrogram/methods/users/send_story.py @@ -24,14 +24,13 @@ from pyrogram import enums, raw, types, utils from pyrogram.file_id import FileType + class SendStory: def _split(self, message, entities, *args, **kwargs): return message, entities async def _upload_video( - self: "pyrogram.Client", - file_name: str, - video: Union[str, BinaryIO] + self: "pyrogram.Client", file_name: str, video: Union[str, BinaryIO] ): file = await self.save_file(video) return raw.types.InputMediaUploadedDocument( @@ -39,22 +38,19 @@ async def _upload_video( file=file, attributes=[ raw.types.DocumentAttributeVideo( - supports_streaming=True, - duration=0, - w=0, - h=0 + supports_streaming=True, duration=0, w=0, h=0 ) - ] + ], ) async def send_story( self: "pyrogram.Client", - chat_id: Union[int,str] = None, + chat_id: Union[int, str] = None, privacy: "enums.StoriesPrivacyRules" = None, allowed_users: List[int] = None, denied_users: List[int] = None, - #allowed_chats: List[int] = None, - #denied_chats: List[int] = None, + # allowed_chats: List[int] = None, + # denied_chats: List[int] = None, photo: Union[str, BinaryIO] = None, video: Union[str, BinaryIO] = None, file_name: str = None, @@ -66,7 +62,7 @@ async def send_story( period: int = None, forward_from_chat_id: Union[int, str] = None, forward_from_story_id: int = None, - media_areas: List["types.InputMediaArea"] = None + media_areas: List["types.InputMediaArea"] = None, ) -> "types.Story": """Send new story. @@ -136,7 +132,7 @@ async def send_story( Unique identifier (int) or username (str) of the source chat where the original story was sent. For your personal story you can simply use "me" or "self". For a contact that exists in your Telegram address book you can use his phone number (str). - + forward_from_story_id (``int``, *optional*): Single story id. @@ -162,26 +158,22 @@ async def send_story( if privacy: privacy_rules = [types.StoriesPrivacyRules(type=privacy)] else: - privacy_rules = [types.StoriesPrivacyRules(type=enums.StoriesPrivacyRules.PUBLIC)] + privacy_rules = [ + types.StoriesPrivacyRules(type=enums.StoriesPrivacyRules.PUBLIC) + ] if photo: if isinstance(photo, str): if os.path.isfile(photo): file = await self.save_file(photo) - media = raw.types.InputMediaUploadedPhoto( - file=file - ) + media = raw.types.InputMediaUploadedPhoto(file=file) elif re.match("^https?://", photo): - media = raw.types.InputMediaPhotoExternal( - url=photo - ) + media = raw.types.InputMediaPhotoExternal(url=photo) else: media = utils.get_input_media_from_file_id(photo, FileType.PHOTO) else: file = await self.save_file(photo) - media = raw.types.InputMediaUploadedPhoto( - file=file - ) + media = raw.types.InputMediaUploadedPhoto(file=file) elif video: if isinstance(video, str): if os.path.isfile(video): @@ -191,36 +183,37 @@ async def send_story( file=file, attributes=[ raw.types.DocumentAttributeVideo( - supports_streaming=True, - duration=0, - w=0, - h=0 + supports_streaming=True, duration=0, w=0, h=0 ) - ] + ], ) elif re.match("^https?://", video): - media = raw.types.InputMediaDocumentExternal( - url=video - ) + media = raw.types.InputMediaDocumentExternal(url=video) else: video = await self.download_media(video, in_memory=True) - media = await self._upload_video(file_name,video) + media = await self._upload_video(file_name, video) else: - media = await self._upload_video(file_name,video) + media = await self._upload_video(file_name, video) else: if forward_from_chat_id is None: - raise ValueError("You need to pass one of the following parameter photo/video/forward_from_chat_id!") - - text, entities = self._split(**await utils.parse_text_entities(self, caption, parse_mode, caption_entities)) + raise ValueError( + "You need to pass one of the following parameter photo/video/forward_from_chat_id!" + ) + + text, entities = self._split( + **await utils.parse_text_entities( + self, caption, parse_mode, caption_entities + ) + ) - ''' + """ if allowed_chats and len(allowed_chats) > 0: chats = [await self.resolve_peer(chat_id) for chat_id in allowed_chats] privacy_rules.append(raw.types.InputPrivacyValueAllowChatParticipants(chats=chats)) if denied_chats and len(denied_chats) > 0: chats = [await self.resolve_peer(chat_id) for chat_id in denied_chats] privacy_rules.append(raw.types.InputPrivacyValueDisallowChatParticipants(chats=chats)) - ''' + """ if allowed_users and len(allowed_users) > 0: users = [await self.resolve_peer(user_id) for user_id in allowed_users] privacy_rules.append(raw.types.InputPrivacyValueAllowUsers(users=users)) @@ -233,7 +226,9 @@ async def send_story( forward_from_chat = await self.resolve_peer(forward_from_chat_id) media = raw.types.InputMediaEmpty() if forward_from_story_id is None: - raise ValueError("You need to pass forward_from_story_id to forward story!") + raise ValueError( + "You need to pass forward_from_story_id to forward story!" + ) r = await self.invoke( raw.functions.stories.SendStory( @@ -247,12 +242,15 @@ async def send_story( entities=entities, period=period, fwd_from_id=forward_from_chat, - fwd_from_story=forward_from_story_id if forward_from_chat_id is not None else None, - fwd_modified=True if forward_from_chat_id is not None and caption is not None else False, - media_areas=[ - await media_area.write(self) - for media_area in media_areas - ] if media_areas is not None else None + fwd_from_story=forward_from_story_id + if forward_from_chat_id is not None + else None, + fwd_modified=True + if forward_from_chat_id is not None and caption is not None + else False, + media_areas=[await media_area.write(self) for media_area in media_areas] + if media_areas is not None + else None, ) ) return await types.Story._parse(self, r.updates[0].story, r.updates[0].peer) diff --git a/pyrogram/methods/users/set_emoji_status.py b/pyrogram/methods/users/set_emoji_status.py index 2d8c77cc0..d7f397f12 100644 --- a/pyrogram/methods/users/set_emoji_status.py +++ b/pyrogram/methods/users/set_emoji_status.py @@ -24,8 +24,7 @@ class SetEmojiStatus: async def set_emoji_status( - self: "pyrogram.Client", - emoji_status: Optional["types.EmojiStatus"] = None + self: "pyrogram.Client", emoji_status: Optional["types.EmojiStatus"] = None ) -> bool: """Set the emoji status. diff --git a/pyrogram/methods/users/set_profile_photo.py b/pyrogram/methods/users/set_profile_photo.py index e08e669c4..f793e0a32 100644 --- a/pyrogram/methods/users/set_profile_photo.py +++ b/pyrogram/methods/users/set_profile_photo.py @@ -68,8 +68,7 @@ async def set_profile_photo( return bool( await self.invoke( raw.functions.photos.UploadProfilePhoto( - file=await self.save_file(photo), - video=await self.save_file(video) + file=await self.save_file(photo), video=await self.save_file(video) ) ) ) diff --git a/pyrogram/methods/users/set_username.py b/pyrogram/methods/users/set_username.py index d336628ee..a2f33743b 100644 --- a/pyrogram/methods/users/set_username.py +++ b/pyrogram/methods/users/set_username.py @@ -23,10 +23,7 @@ class SetUsername: - async def set_username( - self: "pyrogram.Client", - username: Optional[str] - ) -> bool: + async def set_username(self: "pyrogram.Client", username: Optional[str]) -> bool: """Set your own username. This method only works for users, not bots. Bot usernames must be changed via Bot Support or by recreating @@ -50,8 +47,6 @@ async def set_username( return bool( await self.invoke( - raw.functions.account.UpdateUsername( - username=username or "" - ) + raw.functions.account.UpdateUsername(username=username or "") ) ) diff --git a/pyrogram/methods/users/unblock_user.py b/pyrogram/methods/users/unblock_user.py index df28cb245..079022819 100644 --- a/pyrogram/methods/users/unblock_user.py +++ b/pyrogram/methods/users/unblock_user.py @@ -23,10 +23,7 @@ class UnblockUser: - async def unblock_user( - self: "pyrogram.Client", - user_id: Union[int, str] - ) -> bool: + async def unblock_user(self: "pyrogram.Client", user_id: Union[int, str]) -> bool: """Unblock a user. .. include:: /_includes/usable-by/users.rst @@ -48,8 +45,6 @@ async def unblock_user( """ return bool( await self.invoke( - raw.functions.contacts.Unblock( - id=await self.resolve_peer(user_id) - ) + raw.functions.contacts.Unblock(id=await self.resolve_peer(user_id)) ) ) diff --git a/pyrogram/methods/users/update_profile.py b/pyrogram/methods/users/update_profile.py index 507472144..2f25514a4 100644 --- a/pyrogram/methods/users/update_profile.py +++ b/pyrogram/methods/users/update_profile.py @@ -25,7 +25,7 @@ async def update_profile( self: "pyrogram.Client", first_name: str = None, last_name: str = None, - bio: str = None + bio: str = None, ) -> bool: """Update your profile details such as first name, last name and bio. @@ -64,9 +64,7 @@ async def update_profile( return bool( await self.invoke( raw.functions.account.UpdateProfile( - first_name=first_name, - last_name=last_name, - about=bio + first_name=first_name, last_name=last_name, about=bio ) ) ) diff --git a/pyrogram/methods/utilities/__init__.py b/pyrogram/methods/utilities/__init__.py index e34fc7a3c..cfba6d31a 100644 --- a/pyrogram/methods/utilities/__init__.py +++ b/pyrogram/methods/utilities/__init__.py @@ -36,6 +36,6 @@ class Utilities( RunSync, Start, Stop, - StopTransmission + StopTransmission, ): pass diff --git a/pyrogram/methods/utilities/add_handler.py b/pyrogram/methods/utilities/add_handler.py index 136647d98..80c2fd2af 100644 --- a/pyrogram/methods/utilities/add_handler.py +++ b/pyrogram/methods/utilities/add_handler.py @@ -22,11 +22,7 @@ class AddHandler: - def add_handler( - self: "pyrogram.Client", - handler: "Handler", - group: int = 0 - ): + def add_handler(self: "pyrogram.Client", handler: "Handler", group: int = 0): """Register an update handler. You can register multiple handlers, but at most one handler within a group will be used for a single update. diff --git a/pyrogram/methods/utilities/compose.py b/pyrogram/methods/utilities/compose.py index e05773b8e..8bdf6c719 100644 --- a/pyrogram/methods/utilities/compose.py +++ b/pyrogram/methods/utilities/compose.py @@ -23,10 +23,7 @@ from .idle import idle -async def compose( - clients: List["pyrogram.Client"], - sequential: bool = False -): +async def compose(clients: List["pyrogram.Client"], sequential: bool = False): """Run multiple clients at once. This method can be used to run multiple clients at once and can be found directly in the ``pyrogram`` package. diff --git a/pyrogram/methods/utilities/export_session_string.py b/pyrogram/methods/utilities/export_session_string.py index 6529484d9..698f8ebab 100644 --- a/pyrogram/methods/utilities/export_session_string.py +++ b/pyrogram/methods/utilities/export_session_string.py @@ -20,9 +20,7 @@ class ExportSessionString: - async def export_session_string( - self: "pyrogram.Client" - ): + async def export_session_string(self: "pyrogram.Client"): """Export the current authorized session as a serialized string. Session strings are useful for storing in-memory authorized sessions in a portable, serialized string. diff --git a/pyrogram/methods/utilities/idle.py b/pyrogram/methods/utilities/idle.py index 00db22a2e..7ed2c565d 100644 --- a/pyrogram/methods/utilities/idle.py +++ b/pyrogram/methods/utilities/idle.py @@ -25,7 +25,8 @@ # Signal number to name signals = { - k: v for v, k in signal.__dict__.items() + k: v + for v, k in signal.__dict__.items() if v.startswith("SIG") and not v.startswith("SIG_") } diff --git a/pyrogram/methods/utilities/remove_handler.py b/pyrogram/methods/utilities/remove_handler.py index 9f1c974e6..142a5376c 100644 --- a/pyrogram/methods/utilities/remove_handler.py +++ b/pyrogram/methods/utilities/remove_handler.py @@ -22,11 +22,7 @@ class RemoveHandler: - def remove_handler( - self: "pyrogram.Client", - handler: "Handler", - group: int = 0 - ): + def remove_handler(self: "pyrogram.Client", handler: "Handler", group: int = 0): """Remove a previously-registered update handler. Make sure to provide the right group where the handler was added in. You can use the return value of the diff --git a/pyrogram/methods/utilities/restart.py b/pyrogram/methods/utilities/restart.py index 44fd6745e..5a1d37a4b 100644 --- a/pyrogram/methods/utilities/restart.py +++ b/pyrogram/methods/utilities/restart.py @@ -20,10 +20,7 @@ class Restart: - async def restart( - self: "pyrogram.Client", - block: bool = True - ): + async def restart(self: "pyrogram.Client", block: bool = True): """Restart the Client. This method will first call :meth:`~pyrogram.Client.stop` and then :meth:`~pyrogram.Client.start` in a row in diff --git a/pyrogram/methods/utilities/run.py b/pyrogram/methods/utilities/run.py index ec1bece32..b653cd151 100644 --- a/pyrogram/methods/utilities/run.py +++ b/pyrogram/methods/utilities/run.py @@ -24,10 +24,7 @@ class Run: - def run( - self: "pyrogram.Client", - coroutine=None - ): + def run(self: "pyrogram.Client", coroutine=None): """Start the client, idle the main script and finally stop the client. When calling this method without any argument it acts as a convenience method that calls diff --git a/pyrogram/methods/utilities/run_sync.py b/pyrogram/methods/utilities/run_sync.py index 864321ec2..106411d5d 100755 --- a/pyrogram/methods/utilities/run_sync.py +++ b/pyrogram/methods/utilities/run_sync.py @@ -18,10 +18,13 @@ from pyrogram import utils from typing import Any, Callable, TypeVar + class RunSync: Result = TypeVar("Result") - async def run_sync(self, func: Callable[..., Result], *args: Any, **kwargs: Any) -> Result: + async def run_sync( + self, func: Callable[..., Result], *args: Any, **kwargs: Any + ) -> Result: """Runs the given sync function (optionally with arguments) on a separate thread. Parameters: diff --git a/pyrogram/methods/utilities/start.py b/pyrogram/methods/utilities/start.py index d8314da18..1ebe8d3d7 100644 --- a/pyrogram/methods/utilities/start.py +++ b/pyrogram/methods/utilities/start.py @@ -25,9 +25,7 @@ class Start: - async def start( - self: "pyrogram.Client" - ): + async def start(self: "pyrogram.Client"): """Start the client. This method connects the client to Telegram and, in case of new sessions, automatically manages the @@ -62,7 +60,9 @@ async def main(): await self.authorize() if not await self.storage.is_bot() and self.takeout: - self.takeout_id = (await self.invoke(raw.functions.account.InitTakeoutSession())).id + self.takeout_id = ( + await self.invoke(raw.functions.account.InitTakeoutSession()) + ).id log.info("Takeout session %s initiated", self.takeout_id) await self.invoke(raw.functions.updates.GetState()) diff --git a/pyrogram/methods/utilities/stop.py b/pyrogram/methods/utilities/stop.py index 1b28add04..38ff64ba1 100644 --- a/pyrogram/methods/utilities/stop.py +++ b/pyrogram/methods/utilities/stop.py @@ -20,10 +20,7 @@ class Stop: - async def stop( - self: "pyrogram.Client", - block: bool = True - ): + async def stop(self: "pyrogram.Client", block: bool = True): """Stop the Client. This method disconnects the client from Telegram and stops the underlying tasks. diff --git a/pyrogram/nav/__init__.py b/pyrogram/nav/__init__.py index 812f62562..4da4a6b7b 100644 --- a/pyrogram/nav/__init__.py +++ b/pyrogram/nav/__init__.py @@ -17,4 +17,4 @@ # You should have received a copy of the GNU Lesser General Public License # along with Pyrofork. If not, see . -from .pagination import Pagination \ No newline at end of file +from .pagination import Pagination diff --git a/pyrogram/nav/pagination.py b/pyrogram/nav/pagination.py index 595118857..50a6415a5 100644 --- a/pyrogram/nav/pagination.py +++ b/pyrogram/nav/pagination.py @@ -20,6 +20,7 @@ import math from pyrogram.helpers import array_chunk + class Pagination: def __init__(self, objects, page_data=None, item_data=None, item_title=None): def default_page_callback(x): @@ -91,4 +92,4 @@ def create(self, page, lines=5, columns=1): if last_page > 1: kb_lines.append(nav) - return kb_lines \ No newline at end of file + return kb_lines diff --git a/pyrogram/parser/html.py b/pyrogram/parser/html.py index 46722a8c4..3198f2325 100644 --- a/pyrogram/parser/html.py +++ b/pyrogram/parser/html.py @@ -150,7 +150,7 @@ async def parse(self, text: str): return { "message": utils.remove_surrogates(parser.text), - "entities": sorted(entities, key=lambda e: e.offset) or None + "entities": sorted(entities, key=lambda e: e.offset) or None, } @staticmethod @@ -175,7 +175,9 @@ def parse_one(entity): elif entity_type == MessageEntityType.PRE: name = entity_type.name.lower() language = getattr(entity, "language", "") or "" - start_tag = f'<{name} language="{language}">' if language else f"<{name}>" + start_tag = ( + f'<{name} language="{language}">' if language else f"<{name}>" + ) end_tag = f"" elif entity_type in ( MessageEntityType.CODE, @@ -237,7 +239,12 @@ def recursive(entity_i: int) -> int: last_offset = entities_offsets[-1][1] # no need to sort, but still add entities starting from the end for entity, offset in reversed(entities_offsets): - text = text[:offset] + entity + html.escape(text[offset:last_offset]) + text[last_offset:] + text = ( + text[:offset] + + entity + + html.escape(text[offset:last_offset]) + + text[last_offset:] + ) last_offset = offset return utils.remove_surrogates(text) diff --git a/pyrogram/parser/markdown.py b/pyrogram/parser/markdown.py index ae6d3cb6e..9a5a3bb00 100644 --- a/pyrogram/parser/markdown.py +++ b/pyrogram/parser/markdown.py @@ -35,21 +35,27 @@ PRE_DELIM = "```" BLOCKQUOTE_DELIM = ">" -MARKDOWN_RE = re.compile(r"({d})|\[(.+?)\]\((.+?)\)".format( - d="|".join( - ["".join(i) for i in [ - [rf"\{j}" for j in i] - for i in [ - PRE_DELIM, - CODE_DELIM, - STRIKE_DELIM, - UNDERLINE_DELIM, - ITALIC_DELIM, - BOLD_DELIM, - SPOILER_DELIM +MARKDOWN_RE = re.compile( + r"({d})|\[(.+?)\]\((.+?)\)".format( + d="|".join( + [ + "".join(i) + for i in [ + [rf"\{j}" for j in i] + for i in [ + PRE_DELIM, + CODE_DELIM, + STRIKE_DELIM, + UNDERLINE_DELIM, + ITALIC_DELIM, + BOLD_DELIM, + SPOILER_DELIM, + ] + ] ] - ]] - ))) + ) + ) +) OPENING_TAG = "<{}>" CLOSING_TAG = "" @@ -62,8 +68,8 @@ def __init__(self, client: Optional["pyrogram.Client"]): self.html = HTML(client) def blockquote_parser(self, text): - text = re.sub(r'\n>', '\n>', re.sub(r'^>', '>', text)) - lines = text.split('\n') + text = re.sub(r"\n>", "\n>", re.sub(r"^>", ">", text)) + lines = text.split("\n") result = [] in_blockquote = False @@ -71,8 +77,8 @@ def blockquote_parser(self, text): for line in lines: if line.startswith(BLOCKQUOTE_DELIM): if not in_blockquote: - line = re.sub(r'^> ', OPENING_TAG.format("blockquote"), line) - line = re.sub(r'^>', OPENING_TAG.format("blockquote"), line) + line = re.sub(r"^> ", OPENING_TAG.format("blockquote"), line) + line = re.sub(r"^>", OPENING_TAG.format("blockquote"), line) in_blockquote = True result.append(line.strip()) else: @@ -84,11 +90,11 @@ def blockquote_parser(self, text): result.append(line) if in_blockquote: - line = result[len(result)-1] + CLOSING_TAG.format("blockquote") - result.pop(len(result)-1) + line = result[len(result) - 1] + CLOSING_TAG.format("blockquote") + result.pop(len(result) - 1) result.append(line) - return '\n'.join(result) + return "\n".join(result) async def parse(self, text: str, strict: bool = False): if strict: @@ -110,7 +116,9 @@ async def parse(self, text: str, strict: bool = False): continue if text_url: - text = utils.replace_once(text, full, URL_MARKUP.format(url, text_url), start) + text = utils.replace_once( + text, full, URL_MARKUP.format(url, text_url), start + ) continue if delim == BOLD_DELIM: @@ -138,9 +146,11 @@ async def parse(self, text: str, strict: bool = False): tag = CLOSING_TAG.format(tag) if delim == PRE_DELIM and delim in delims: - delim_and_language = text[text.find(PRE_DELIM):].split("\n")[0] - language = delim_and_language[len(PRE_DELIM):] - text = utils.replace_once(text, delim_and_language, f'
', start)
+                delim_and_language = text[text.find(PRE_DELIM) :].split("\n")[0]
+                language = delim_and_language[len(PRE_DELIM) :]
+                text = utils.replace_once(
+                    text, delim_and_language, f'
', start
+                )
                 continue
 
             text = utils.replace_once(text, delim, tag, start)
@@ -181,12 +191,22 @@ def unparse(text: str, entities: list):
                 for line in lines:
                     if len(line) == 0 and last_length == end:
                         continue
-                    start_offset = start+last_length
-                    last_length = last_length+len(line)
-                    end_offset = start_offset+last_length
-                    entities_offsets.append((start_tag, start_offset,))
-                    entities_offsets.append((end_tag, end_offset,))
-                    last_length = last_length+1
+                    start_offset = start + last_length
+                    last_length = last_length + len(line)
+                    end_offset = start_offset + last_length
+                    entities_offsets.append(
+                        (
+                            start_tag,
+                            start_offset,
+                        )
+                    )
+                    entities_offsets.append(
+                        (
+                            end_tag,
+                            end_offset,
+                        )
+                    )
+                    last_length = last_length + 1
                 continue
             elif entity_type == MessageEntityType.SPOILER:
                 start_tag = end_tag = SPOILER_DELIM
@@ -201,16 +221,24 @@ def unparse(text: str, entities: list):
             else:
                 continue
 
-            entities_offsets.append((start_tag, start,))
-            entities_offsets.append((end_tag, end,))
+            entities_offsets.append(
+                (
+                    start_tag,
+                    start,
+                )
+            )
+            entities_offsets.append(
+                (
+                    end_tag,
+                    end,
+                )
+            )
 
         entities_offsets = map(
             lambda x: x[1],
             sorted(
-                enumerate(entities_offsets),
-                key=lambda x: (x[1][1], x[0]),
-                reverse=True
-            )
+                enumerate(entities_offsets), key=lambda x: (x[1][1], x[0]), reverse=True
+            ),
         )
 
         for entity, offset in entities_offsets:
diff --git a/pyrogram/parser/utils.py b/pyrogram/parser/utils.py
index 0d6040289..25d3d1392 100644
--- a/pyrogram/parser/utils.py
+++ b/pyrogram/parser/utils.py
@@ -26,9 +26,10 @@
 def add_surrogates(text):
     # Replace each SMP code point with a surrogate pair
     return SMP_RE.sub(
-        lambda match:  # Split SMP in two surrogates
-        "".join(chr(i) for i in unpack(" "GzipPacked":
         # Return the Object itself instead of a GzipPacked wrapping it
-        return cast(GzipPacked, TLObject.read(
-            BytesIO(
-                decompress(
-                    Bytes.read(data)
-                )
-            )
-        ))
+        return cast(GzipPacked, TLObject.read(BytesIO(decompress(Bytes.read(data)))))
 
     def write(self, *args: Any) -> bytes:
         b = BytesIO()
 
         b.write(Int(self.ID, False))
 
-        b.write(
-            Bytes(
-                compress(
-                    self.packed_data.write()
-                )
-            )
-        )
+        b.write(Bytes(compress(self.packed_data.write())))
 
         return b.getvalue()
diff --git a/pyrogram/raw/core/list.py b/pyrogram/raw/core/list.py
index a7bbc16b2..1e0e7797e 100644
--- a/pyrogram/raw/core/list.py
+++ b/pyrogram/raw/core/list.py
@@ -23,4 +23,6 @@
 
 class List(TList[Any], TLObject):
     def __repr__(self) -> str:
-        return f"pyrogram.raw.core.List([{','.join(TLObject.__repr__(i) for i in self)}])"
+        return (
+            f"pyrogram.raw.core.List([{','.join(TLObject.__repr__(i) for i in self)}])"
+        )
diff --git a/pyrogram/raw/core/primitives/bytes.py b/pyrogram/raw/core/primitives/bytes.py
index eace1feb9..141e26b86 100644
--- a/pyrogram/raw/core/primitives/bytes.py
+++ b/pyrogram/raw/core/primitives/bytes.py
@@ -41,15 +41,8 @@ def __new__(cls, value: bytes) -> bytes:  # type: ignore
         length = len(value)
 
         if length <= 253:
-            return (
-                bytes([length])
-                + value
-                + bytes(-(length + 1) % 4)
-            )
+            return bytes([length]) + value + bytes(-(length + 1) % 4)
         else:
             return (
-                bytes([254])
-                + length.to_bytes(3, "little")
-                + value
-                + bytes(-length % 4)
+                bytes([254]) + length.to_bytes(3, "little") + value + bytes(-length % 4)
             )
diff --git a/pyrogram/raw/core/primitives/vector.py b/pyrogram/raw/core/primitives/vector.py
index 7676ab6ae..3fb02ee1a 100644
--- a/pyrogram/raw/core/primitives/vector.py
+++ b/pyrogram/raw/core/primitives/vector.py
@@ -34,10 +34,7 @@ class Vector(bytes, TLObject):
     def read_bare(b: BytesIO, size: int) -> Union[int, Any]:
         if size == 4:
             # cek
-            e = int.from_bytes(
-                b.read(4),
-                "little"
-            )
+            e = int.from_bytes(b.read(4), "little")
             # bak
             b.seek(-4, 1)
             # cond
@@ -63,9 +60,7 @@ def read(cls, data: BytesIO, t: Any = None, *args: Any) -> List:
         data.seek(-left, 1)
 
         return List(
-            t.read(data) if t
-            else Vector.read_bare(data, size)
-            for _ in range(count)
+            t.read(data) if t else Vector.read_bare(data, size) for _ in range(count)
         )
 
     def __new__(cls, value: list, t: Any = None) -> bytes:  # type: ignore
diff --git a/pyrogram/raw/core/tl_object.py b/pyrogram/raw/core/tl_object.py
index ff67566ea..6291ed9fc 100644
--- a/pyrogram/raw/core/tl_object.py
+++ b/pyrogram/raw/core/tl_object.py
@@ -30,7 +30,9 @@ class TLObject:
 
     @classmethod
     def read(cls, b: BytesIO, *args: Any) -> Any:
-        return cast(TLObject, objects[int.from_bytes(b.read(4), "little")]).read(b, *args)
+        return cast(TLObject, objects[int.from_bytes(b.read(4), "little")]).read(
+            b, *args
+        )
 
     def write(self, *args: Any) -> bytes:
         pass
@@ -46,7 +48,7 @@ def default(obj: "TLObject") -> Union[str, Dict[str, str]]:
                 attr: getattr(obj, attr)
                 for attr in obj.__slots__
                 if getattr(obj, attr) is not None
-            }
+            },
         }
 
     def __str__(self) -> str:
@@ -62,7 +64,7 @@ def __repr__(self) -> str:
                 f"{attr}={repr(getattr(self, attr))}"
                 for attr in self.__slots__
                 if getattr(self, attr) is not None
-            )
+            ),
         )
 
     def __eq__(self, other: Any) -> bool:
diff --git a/pyrogram/session/auth.py b/pyrogram/session/auth.py
index bc0f785da..285a14935 100644
--- a/pyrogram/session/auth.py
+++ b/pyrogram/session/auth.py
@@ -49,12 +49,7 @@ def __init__(self, client: "pyrogram.Client", dc_id: int, test_mode: bool):
 
     @staticmethod
     def pack(data: TLObject) -> bytes:
-        return (
-            bytes(8)
-            + Long(MsgId())
-            + Int(len(data.write()))
-            + data.write()
-        )
+        return bytes(8) + Long(MsgId()) + Int(len(data.write())) + data.write()
 
     @staticmethod
     def unpack(b: BytesIO):
@@ -78,7 +73,9 @@ async def create(self):
         # The server may close the connection at any time, causing the auth key creation to fail.
         # If that happens, just try again up to MAX_RETRIES times.
         while True:
-            self.connection = Connection(self.dc_id, self.test_mode, self.ipv6, self.alt_port, self.proxy)
+            self.connection = Connection(
+                self.dc_id, self.test_mode, self.ipv6, self.alt_port, self.proxy
+            )
 
             try:
                 log.info("Start creating a new auth key on DC%s", self.dc_id)
@@ -90,7 +87,10 @@ async def create(self):
                 log.debug("Send req_pq: %s", nonce)
                 res_pq = await self.invoke(raw.functions.ReqPqMulti(nonce=nonce))
                 log.debug("Got ResPq: %s", res_pq.server_nonce)
-                log.debug("Server public key fingerprints: %s", res_pq.server_public_key_fingerprints)
+                log.debug(
+                    "Server public key fingerprints: %s",
+                    res_pq.server_public_key_fingerprints,
+                )
 
                 for i in res_pq.server_public_key_fingerprints:
                     if i in rsa.server_public_keys:
@@ -108,7 +108,12 @@ async def create(self):
                 start = time.time()
                 g = prime.decompose(pq)
                 p, q = sorted((g, pq // g))  # p < q
-                log.debug("Done PQ factorization (%ss): %s %s", round(time.time() - start, 3), p, q)
+                log.debug(
+                    "Done PQ factorization (%ss): %s %s",
+                    round(time.time() - start, 3),
+                    p,
+                    q,
+                )
 
                 # Step 4
                 server_nonce = res_pq.server_nonce
@@ -124,7 +129,7 @@ async def create(self):
                 ).write()
 
                 sha = sha1(data).digest()
-                padding = urandom(- (len(data) + len(sha)) % 255)
+                padding = urandom(-(len(data) + len(sha)) % 255)
                 data_with_hash = sha + data + padding
                 encrypted_data = rsa.encrypt(data_with_hash, public_key_fingerprint)
 
@@ -139,7 +144,7 @@ async def create(self):
                         p=p.to_bytes(4, "big"),
                         q=q.to_bytes(4, "big"),
                         public_key_fingerprint=public_key_fingerprint,
-                        encrypted_data=encrypted_data
+                        encrypted_data=encrypted_data,
                     )
                 )
 
@@ -155,12 +160,15 @@ async def create(self):
 
                 tmp_aes_iv = (
                     sha1(server_nonce + new_nonce).digest()[12:]
-                    + sha1(new_nonce + new_nonce).digest() + new_nonce[:4]
+                    + sha1(new_nonce + new_nonce).digest()
+                    + new_nonce[:4]
                 )
 
                 server_nonce = int.from_bytes(server_nonce, "little", signed=True)
 
-                answer_with_hash = aes.ige256_decrypt(encrypted_answer, tmp_aes_key, tmp_aes_iv)
+                answer_with_hash = aes.ige256_decrypt(
+                    encrypted_answer, tmp_aes_key, tmp_aes_iv
+                )
                 answer = answer_with_hash[20:]
 
                 server_dh_inner_data = TLObject.read(BytesIO(answer))
@@ -180,23 +188,22 @@ async def create(self):
                 retry_id = 0
 
                 data = raw.types.ClientDHInnerData(
-                    nonce=nonce,
-                    server_nonce=server_nonce,
-                    retry_id=retry_id,
-                    g_b=g_b
+                    nonce=nonce, server_nonce=server_nonce, retry_id=retry_id, g_b=g_b
                 ).write()
 
                 sha = sha1(data).digest()
-                padding = urandom(- (len(data) + len(sha)) % 16)
+                padding = urandom(-(len(data) + len(sha)) % 16)
                 data_with_hash = sha + data + padding
-                encrypted_data = aes.ige256_encrypt(data_with_hash, tmp_aes_key, tmp_aes_iv)
+                encrypted_data = aes.ige256_encrypt(
+                    data_with_hash, tmp_aes_key, tmp_aes_iv
+                )
 
                 log.debug("Send set_client_DH_params")
                 set_client_dh_params_answer = await self.invoke(
                     raw.functions.SetClientDHParams(
                         nonce=nonce,
                         server_nonce=server_nonce,
-                        encrypted_data=encrypted_data
+                        encrypted_data=encrypted_data,
                     )
                 )
 
@@ -213,21 +220,30 @@ async def create(self):
                 # Security checks
                 #######################
 
-                SecurityCheckMismatch.check(dh_prime == prime.CURRENT_DH_PRIME, "dh_prime == prime.CURRENT_DH_PRIME")
+                SecurityCheckMismatch.check(
+                    dh_prime == prime.CURRENT_DH_PRIME,
+                    "dh_prime == prime.CURRENT_DH_PRIME",
+                )
                 log.debug("DH parameters check: OK")
 
                 # https://core.telegram.org/mtproto/security_guidelines#g-a-and-g-b-validation
                 g_b = int.from_bytes(g_b, "big")
-                SecurityCheckMismatch.check(1 < g < dh_prime - 1, "1 < g < dh_prime - 1")
-                SecurityCheckMismatch.check(1 < g_a < dh_prime - 1, "1 < g_a < dh_prime - 1")
-                SecurityCheckMismatch.check(1 < g_b < dh_prime - 1, "1 < g_b < dh_prime - 1")
+                SecurityCheckMismatch.check(
+                    1 < g < dh_prime - 1, "1 < g < dh_prime - 1"
+                )
+                SecurityCheckMismatch.check(
+                    1 < g_a < dh_prime - 1, "1 < g_a < dh_prime - 1"
+                )
+                SecurityCheckMismatch.check(
+                    1 < g_b < dh_prime - 1, "1 < g_b < dh_prime - 1"
+                )
                 SecurityCheckMismatch.check(
                     2 ** (2048 - 64) < g_a < dh_prime - 2 ** (2048 - 64),
-                    "2 ** (2048 - 64) < g_a < dh_prime - 2 ** (2048 - 64)"
+                    "2 ** (2048 - 64) < g_a < dh_prime - 2 ** (2048 - 64)",
                 )
                 SecurityCheckMismatch.check(
                     2 ** (2048 - 64) < g_b < dh_prime - 2 ** (2048 - 64),
-                    "2 ** (2048 - 64) < g_b < dh_prime - 2 ** (2048 - 64)"
+                    "2 ** (2048 - 64) < g_b < dh_prime - 2 ** (2048 - 64)",
                 )
                 log.debug("g_a and g_b validation: OK")
 
@@ -235,28 +251,32 @@ async def create(self):
                 answer = server_dh_inner_data.write()  # Call .write() to remove padding
                 SecurityCheckMismatch.check(
                     answer_with_hash[:20] == sha1(answer).digest(),
-                    "answer_with_hash[:20] == sha1(answer).digest()"
+                    "answer_with_hash[:20] == sha1(answer).digest()",
                 )
                 log.debug("SHA1 hash values check: OK")
 
                 # https://core.telegram.org/mtproto/security_guidelines#checking-nonce-server-nonce-and-new-nonce-fields
                 # 1st message
-                SecurityCheckMismatch.check(nonce == res_pq.nonce, "nonce == res_pq.nonce")
+                SecurityCheckMismatch.check(
+                    nonce == res_pq.nonce, "nonce == res_pq.nonce"
+                )
                 # 2nd message
                 server_nonce = int.from_bytes(server_nonce, "little", signed=True)
-                SecurityCheckMismatch.check(nonce == server_dh_params.nonce, "nonce == server_dh_params.nonce")
+                SecurityCheckMismatch.check(
+                    nonce == server_dh_params.nonce, "nonce == server_dh_params.nonce"
+                )
                 SecurityCheckMismatch.check(
                     server_nonce == server_dh_params.server_nonce,
-                    "server_nonce == server_dh_params.server_nonce"
+                    "server_nonce == server_dh_params.server_nonce",
                 )
                 # 3rd message
                 SecurityCheckMismatch.check(
                     nonce == set_client_dh_params_answer.nonce,
-                    "nonce == set_client_dh_params_answer.nonce"
+                    "nonce == set_client_dh_params_answer.nonce",
                 )
                 SecurityCheckMismatch.check(
                     server_nonce == set_client_dh_params_answer.server_nonce,
-                    "server_nonce == set_client_dh_params_answer.server_nonce"
+                    "server_nonce == set_client_dh_params_answer.server_nonce",
                 )
                 server_nonce = server_nonce.to_bytes(16, "little", signed=True)
                 log.debug("Nonce fields check: OK")
@@ -266,7 +286,10 @@ async def create(self):
 
                 log.debug("Server salt: %s", int.from_bytes(server_salt, "little"))
 
-                log.info("Done auth key exchange: %s", set_client_dh_params_answer.__class__.__name__)
+                log.info(
+                    "Done auth key exchange: %s",
+                    set_client_dh_params_answer.__class__.__name__,
+                )
             except Exception as e:
                 log.info("Retrying due to %s: %s", type(e).__name__, e)
 
diff --git a/pyrogram/session/internals/data_center.py b/pyrogram/session/internals/data_center.py
index 43db631c7..143f9d895 100644
--- a/pyrogram/session/internals/data_center.py
+++ b/pyrogram/session/internals/data_center.py
@@ -33,13 +33,10 @@ class DataCenter:
         3: "149.154.175.100",
         4: "149.154.167.91",
         5: "91.108.56.130",
-        203: "91.105.192.100"
+        203: "91.105.192.100",
     }
 
-    PROD_MEDIA = {
-        2: "149.154.167.151",
-        4: "149.154.164.250"
-    }
+    PROD_MEDIA = {2: "149.154.167.151", 4: "149.154.164.250"}
 
     TEST_IPV6 = {
         1: "2001:b28:f23d:f001::e",
@@ -53,15 +50,17 @@ class DataCenter:
         3: "2001:b28:f23d:f003::a",
         4: "2001:67c:4e8:f004::a",
         5: "2001:b28:f23f:f005::a",
-        203: "2a0a:f280:0203:000a:5000:0000:0000:0100"
+        203: "2a0a:f280:0203:000a:5000:0000:0000:0100",
     }
 
     PROD_IPV6_MEDIA = {
         2: "2001:067c:04e8:f002:0000:0000:0000:000b",
-        4: "2001:067c:04e8:f004:0000:0000:0000:000b"
+        4: "2001:067c:04e8:f004:0000:0000:0000:000b",
     }
 
-    def __new__(cls, dc_id: int, test_mode: bool, ipv6: bool, alt_port: bool, media: bool) -> Tuple[str, int]:
+    def __new__(
+        cls, dc_id: int, test_mode: bool, ipv6: bool, alt_port: bool, media: bool
+    ) -> Tuple[str, int]:
         if test_mode:
             if ipv6:
                 ip = cls.TEST_IPV6[dc_id]
diff --git a/pyrogram/session/internals/msg_factory.py b/pyrogram/session/internals/msg_factory.py
index 837f17d0e..3ee539f7d 100644
--- a/pyrogram/session/internals/msg_factory.py
+++ b/pyrogram/session/internals/msg_factory.py
@@ -34,5 +34,5 @@ def __call__(self, body: TLObject) -> Message:
             body,
             MsgId(),
             self.seq_no(not isinstance(body, not_content_related)),
-            len(body)
+            len(body),
         )
diff --git a/pyrogram/session/internals/msg_id.py b/pyrogram/session/internals/msg_id.py
index da2e264ff..cfa922550 100644
--- a/pyrogram/session/internals/msg_id.py
+++ b/pyrogram/session/internals/msg_id.py
@@ -29,7 +29,7 @@ class MsgId:
     def __new__(cls) -> int:
         now = int(time.time())
         cls.offset = (cls.offset + 4) if now == cls.last_time else 0
-        msg_id = (now * 2 ** 32) + cls.offset
+        msg_id = (now * 2**32) + cls.offset
         cls.last_time = now
 
         return msg_id
diff --git a/pyrogram/session/internals/seq_no.py b/pyrogram/session/internals/seq_no.py
index 79501d986..91ffe29b4 100644
--- a/pyrogram/session/internals/seq_no.py
+++ b/pyrogram/session/internals/seq_no.py
@@ -22,7 +22,9 @@ def __init__(self):
         self.content_related_messages_sent = 0
 
     def __call__(self, is_content_related: bool) -> int:
-        seq_no = (self.content_related_messages_sent * 2) + (1 if is_content_related else 0)
+        seq_no = (self.content_related_messages_sent * 2) + (
+            1 if is_content_related else 0
+        )
 
         if is_content_related:
             self.content_related_messages_sent += 1
diff --git a/pyrogram/session/session.py b/pyrogram/session/session.py
index 18d6c04dd..cade6ec37 100644
--- a/pyrogram/session/session.py
+++ b/pyrogram/session/session.py
@@ -29,8 +29,13 @@
 from pyrogram.connection import Connection
 from pyrogram.crypto import mtproto
 from pyrogram.errors import (
-    RPCError, InternalServerError, AuthKeyDuplicated, FloodWait, ServiceUnavailable, BadMsgNotification,
-    SecurityCheckMismatch
+    RPCError,
+    InternalServerError,
+    AuthKeyDuplicated,
+    FloodWait,
+    ServiceUnavailable,
+    BadMsgNotification,
+    SecurityCheckMismatch,
 )
 from pyrogram.raw.all import layer
 from pyrogram.raw.core import TLObject, MsgContainer, Int, FutureSalts
@@ -57,7 +62,7 @@ class Session:
     TRANSPORT_ERRORS = {
         404: "auth key not found",
         429: "transport flood",
-        444: "invalid DC"
+        444: "invalid DC",
     }
 
     def __init__(
@@ -67,7 +72,7 @@ def __init__(
         auth_key: bytes,
         test_mode: bool,
         is_media: bool = False,
-        is_cdn: bool = False
+        is_cdn: bool = False,
     ):
         self.client = client
         self.dc_id = dc_id
@@ -108,7 +113,7 @@ async def start(self):
                 self.client.ipv6,
                 self.client.alt_port,
                 self.client.proxy,
-                self.is_media
+                self.is_media,
             )
 
             try:
@@ -116,7 +121,9 @@ async def start(self):
 
                 self.recv_task = self.loop.create_task(self.recv_worker())
 
-                await self.send(raw.functions.Ping(ping_id=0), timeout=self.START_TIMEOUT)
+                await self.send(
+                    raw.functions.Ping(ping_id=0), timeout=self.START_TIMEOUT
+                )
 
                 if not self.is_cdn:
                     await self.send(
@@ -131,16 +138,20 @@ async def start(self):
                                 lang_code=self.client.lang_code,
                                 lang_pack=self.client.lang_pack,
                                 query=raw.functions.help.GetConfig(),
-                            )
+                            ),
                         ),
-                        timeout=self.START_TIMEOUT
+                        timeout=self.START_TIMEOUT,
                     )
 
                 self.ping_task = self.loop.create_task(self.ping_worker())
 
                 log.info("Session initialized: Layer %s", layer)
-                log.info("Device: %s - %s", self.client.device_model, self.client.app_version)
-                log.info("System: %s (%s)", self.client.system_version, self.client.lang_code)
+                log.info(
+                    "Device: %s - %s", self.client.device_model, self.client.app_version
+                )
+                log.info(
+                    "System: %s (%s)", self.client.system_version, self.client.lang_code
+                )
             except AuthKeyDuplicated as e:
                 await self.stop()
                 raise e
@@ -192,14 +203,10 @@ async def handle_packet(self, packet):
             BytesIO(packet),
             self.session_id,
             self.auth_key,
-            self.auth_key_id
+            self.auth_key_id,
         )
 
-        messages = (
-            data.body.messages
-            if isinstance(data.body, MsgContainer)
-            else [data]
-        )
+        messages = data.body.messages if isinstance(data.body, MsgContainer) else [data]
 
         log.debug("Received: %s", data)
 
@@ -212,24 +219,32 @@ async def handle_packet(self, packet):
 
             try:
                 if len(self.stored_msg_ids) > Session.STORED_MSG_IDS_MAX_SIZE:
-                    del self.stored_msg_ids[:Session.STORED_MSG_IDS_MAX_SIZE // 2]
+                    del self.stored_msg_ids[: Session.STORED_MSG_IDS_MAX_SIZE // 2]
 
                 if self.stored_msg_ids:
                     if msg.msg_id < self.stored_msg_ids[0]:
-                        raise SecurityCheckMismatch("The msg_id is lower than all the stored values")
+                        raise SecurityCheckMismatch(
+                            "The msg_id is lower than all the stored values"
+                        )
 
                     if msg.msg_id in self.stored_msg_ids:
-                        raise SecurityCheckMismatch("The msg_id is equal to any of the stored values")
+                        raise SecurityCheckMismatch(
+                            "The msg_id is equal to any of the stored values"
+                        )
 
-                    time_diff = (msg.msg_id - MsgId()) / 2 ** 32
+                    time_diff = (msg.msg_id - MsgId()) / 2**32
 
                     if time_diff > 30:
-                        raise SecurityCheckMismatch("The msg_id belongs to over 30 seconds in the future. "
-                                                    "Most likely the client time has to be synchronized.")
+                        raise SecurityCheckMismatch(
+                            "The msg_id belongs to over 30 seconds in the future. "
+                            "Most likely the client time has to be synchronized."
+                        )
 
                     if time_diff < -300:
-                        raise SecurityCheckMismatch("The msg_id belongs to over 300 seconds in the past. "
-                                                    "Most likely the client time has to be synchronized.")
+                        raise SecurityCheckMismatch(
+                            "The msg_id belongs to over 300 seconds in the past. "
+                            "Most likely the client time has to be synchronized."
+                        )
             except SecurityCheckMismatch as e:
                 log.info("Discarding packet: %s", e)
                 await self.connection.close()
@@ -237,7 +252,9 @@ async def handle_packet(self, packet):
             else:
                 bisect.insort(self.stored_msg_ids, msg.msg_id)
 
-            if isinstance(msg.body, (raw.types.MsgDetailedInfo, raw.types.MsgNewDetailedInfo)):
+            if isinstance(
+                msg.body, (raw.types.MsgDetailedInfo, raw.types.MsgNewDetailedInfo)
+            ):
                 self.pending_acks.add(msg.body.answer_msg_id)
                 continue
 
@@ -246,7 +263,9 @@ async def handle_packet(self, packet):
 
             msg_id = None
 
-            if isinstance(msg.body, (raw.types.BadMsgNotification, raw.types.BadServerSalt)):
+            if isinstance(
+                msg.body, (raw.types.BadMsgNotification, raw.types.BadServerSalt)
+            ):
                 msg_id = msg.body.bad_msg_id
             elif isinstance(msg.body, (FutureSalts, raw.types.RpcResult)):
                 msg_id = msg.body.req_msg_id
@@ -264,7 +283,9 @@ async def handle_packet(self, packet):
             log.debug("Sending %s acks", len(self.pending_acks))
 
             try:
-                await self.send(raw.types.MsgsAck(msg_ids=list(self.pending_acks)), False)
+                await self.send(
+                    raw.types.MsgsAck(msg_ids=list(self.pending_acks)), False
+                )
             except OSError:
                 pass
             else:
@@ -285,7 +306,8 @@ async def ping_worker(self):
                 await self.send(
                     raw.functions.PingDelayDisconnect(
                         ping_id=0, disconnect_delay=self.WAIT_TIMEOUT + 10
-                    ), False
+                    ),
+                    False,
                 )
             except (OSError, RPCError):
                 pass
@@ -304,7 +326,8 @@ async def recv_worker(self):
 
                     log.warning(
                         "Server sent transport error: %s (%s)",
-                        error_code, Session.TRANSPORT_ERRORS.get(error_code, "unknown error")
+                        error_code,
+                        Session.TRANSPORT_ERRORS.get(error_code, "unknown error"),
                     )
 
                 if self.is_started.is_set():
@@ -316,7 +339,13 @@ async def recv_worker(self):
 
         log.info("NetworkTask stopped")
 
-    async def send(self, data: TLObject, wait_response: bool = True, timeout: float = WAIT_TIMEOUT, retry: int = 0):
+    async def send(
+        self,
+        data: TLObject,
+        wait_response: bool = True,
+        timeout: float = WAIT_TIMEOUT,
+        retry: int = 0,
+    ):
         message = self.msg_factory(data)
         msg_id = message.msg_id
 
@@ -332,7 +361,7 @@ async def send(self, data: TLObject, wait_response: bool = True, timeout: float
             self.salt,
             self.session_id,
             self.auth_key,
-            self.auth_key_id
+            self.auth_key_id,
         )
 
         try:
@@ -353,7 +382,13 @@ async def send(self, data: TLObject, wait_response: bool = True, timeout: float
                 raise TimeoutError("Request timed out")
 
             if isinstance(result, raw.types.RpcError):
-                if isinstance(data, (raw.functions.InvokeWithoutUpdates, raw.functions.InvokeWithTakeout)):
+                if isinstance(
+                    data,
+                    (
+                        raw.functions.InvokeWithoutUpdates,
+                        raw.functions.InvokeWithTakeout,
+                    ),
+                ):
                     data = data.query
 
                 RPCError.raise_it(result, type(data))
@@ -373,24 +408,30 @@ async def send(self, data: TLObject, wait_response: bool = True, timeout: float
 
     def _handle_bad_notification(self):
         new_msg_id = MsgId()
-        if self.stored_msg_ids[len(self.stored_msg_ids)-1] >= new_msg_id:
-            new_msg_id = self.stored_msg_ids[len(self.stored_msg_ids)-1] + 4
-            log.debug("Changing msg_id old=%s new=%s", self.stored_msg_ids[len(self.stored_msg_ids)-1], new_msg_id)
-        self.stored_msg_ids[len(self.stored_msg_ids)-1] = new_msg_id
+        if self.stored_msg_ids[len(self.stored_msg_ids) - 1] >= new_msg_id:
+            new_msg_id = self.stored_msg_ids[len(self.stored_msg_ids) - 1] + 4
+            log.debug(
+                "Changing msg_id old=%s new=%s",
+                self.stored_msg_ids[len(self.stored_msg_ids) - 1],
+                new_msg_id,
+            )
+        self.stored_msg_ids[len(self.stored_msg_ids) - 1] = new_msg_id
 
     async def invoke(
         self,
         query: TLObject,
         retries: int = MAX_RETRIES,
         timeout: float = WAIT_TIMEOUT,
-        sleep_threshold: float = SLEEP_THRESHOLD
+        sleep_threshold: float = SLEEP_THRESHOLD,
     ):
         try:
             await asyncio.wait_for(self.is_started.wait(), self.WAIT_TIMEOUT)
         except asyncio.TimeoutError:
             pass
 
-        if isinstance(query, (raw.functions.InvokeWithoutUpdates, raw.functions.InvokeWithTakeout)):
+        if isinstance(
+            query, (raw.functions.InvokeWithoutUpdates, raw.functions.InvokeWithTakeout)
+        ):
             inner_query = query.query
         else:
             inner_query = query
@@ -406,8 +447,12 @@ async def invoke(
                 if amount > sleep_threshold >= 0:
                     raise
 
-                log.warning('[%s] Waiting for %s seconds before continuing (required by "%s")',
-                            self.client.name, amount, query_name)
+                log.warning(
+                    '[%s] Waiting for %s seconds before continuing (required by "%s")',
+                    self.client.name,
+                    amount,
+                    query_name,
+                )
 
                 await asyncio.sleep(amount)
             except (OSError, InternalServerError, ServiceUnavailable) as e:
@@ -418,7 +463,8 @@ async def invoke(
                 (log.warning if retries < 2 else log.info)(
                     '[%s] Retrying "%s" due to: %s',
                     Session.MAX_RETRIES - retries + 1,
-                    query_name, str(e) or repr(e)
+                    query_name,
+                    str(e) or repr(e),
                 )
 
                 await asyncio.sleep(0.5)
diff --git a/pyrogram/storage/__init__.py b/pyrogram/storage/__init__.py
index ae5a3b332..79048341f 100644
--- a/pyrogram/storage/__init__.py
+++ b/pyrogram/storage/__init__.py
@@ -18,6 +18,7 @@
 
 from .file_storage import FileStorage
 from .memory_storage import MemoryStorage
+
 try:
     import pymongo
 except Exception:
diff --git a/pyrogram/storage/dummy_client.py b/pyrogram/storage/dummy_client.py
index 30929c017..17b9bec33 100644
--- a/pyrogram/storage/dummy_client.py
+++ b/pyrogram/storage/dummy_client.py
@@ -16,7 +16,10 @@
 except ImportError:
     from typing_extensions import Protocol, runtime_checkable
 
-ReadPreferences = Union[Primary, PrimaryPreferred, Secondary, SecondaryPreferred, Nearest]
+ReadPreferences = Union[
+    Primary, PrimaryPreferred, Secondary, SecondaryPreferred, Nearest
+]
+
 
 @runtime_checkable
 class DummyMongoClient(Protocol):
@@ -33,7 +36,7 @@ def get_database(
         read_concern: Optional[ReadConcern] = None,
     ):
         raise NotImplementedError
-    
+
     async def start_session(
         self,
         *,
diff --git a/pyrogram/storage/memory_storage.py b/pyrogram/storage/memory_storage.py
index 2c01f4474..e0edf265f 100644
--- a/pyrogram/storage/memory_storage.py
+++ b/pyrogram/storage/memory_storage.py
@@ -38,12 +38,19 @@ async def open(self):
 
         if self.session_string:
             # Old format
-            if len(self.session_string) in [self.SESSION_STRING_SIZE, self.SESSION_STRING_SIZE_64]:
+            if len(self.session_string) in [
+                self.SESSION_STRING_SIZE,
+                self.SESSION_STRING_SIZE_64,
+            ]:
                 dc_id, test_mode, auth_key, user_id, is_bot = struct.unpack(
-                    (self.OLD_SESSION_STRING_FORMAT
-                     if len(self.session_string) == self.SESSION_STRING_SIZE else
-                     self.OLD_SESSION_STRING_FORMAT_64),
-                    base64.urlsafe_b64decode(self.session_string + "=" * (-len(self.session_string) % 4))
+                    (
+                        self.OLD_SESSION_STRING_FORMAT
+                        if len(self.session_string) == self.SESSION_STRING_SIZE
+                        else self.OLD_SESSION_STRING_FORMAT_64
+                    ),
+                    base64.urlsafe_b64decode(
+                        self.session_string + "=" * (-len(self.session_string) % 4)
+                    ),
                 )
 
                 await self.dc_id(dc_id)
@@ -53,12 +60,16 @@ async def open(self):
                 await self.is_bot(is_bot)
                 await self.date(0)
 
-                log.warning("You are using an old session string format. Use export_session_string to update")
+                log.warning(
+                    "You are using an old session string format. Use export_session_string to update"
+                )
                 return
 
             dc_id, api_id, test_mode, auth_key, user_id, is_bot = struct.unpack(
                 self.SESSION_STRING_FORMAT,
-                base64.urlsafe_b64decode(self.session_string + "=" * (-len(self.session_string) % 4))
+                base64.urlsafe_b64decode(
+                    self.session_string + "=" * (-len(self.session_string) % 4)
+                ),
             )
 
             await self.dc_id(dc_id)
diff --git a/pyrogram/storage/mongo_storage.py b/pyrogram/storage/mongo_storage.py
index 2538bf2ac..8644b9cb8 100644
--- a/pyrogram/storage/mongo_storage.py
+++ b/pyrogram/storage/mongo_storage.py
@@ -22,8 +22,8 @@ class MongoStorage(Storage):
             ~async_pymongo.AsyncClient or ~motor.motor_asyncio.AsyncIOMotorClient object
 
         - remove_peers (`bool`, *optional*):
-            Flag to remove data in the peers collection. If set to True, 
-            the data related to peers will be removed everytime client log out. 
+            Flag to remove data in the peers collection. If set to True,
+            the data related to peers will be removed everytime client log out.
             If set to False or None, the data will not be removed.
 
     Example:
@@ -33,30 +33,32 @@ class MongoStorage(Storage):
         bot_db = conn["my_bot"]
         session = MongoStorage("my_session", connection=conn, remove_peers=True)
     """
+
     lock: asyncio.Lock
     USERNAME_TTL = 8 * 60 * 60
 
     def __init__(
-        self,
-        name: str,
-        connection: DummyMongoClient,
-        remove_peers: bool = False
+        self, name: str, connection: DummyMongoClient, remove_peers: bool = False
     ):
         super().__init__(name=name)
         database = None
 
         if isinstance(connection, DummyMongoClient):
             if isinstance(connection, MongoClient):
-                raise Exception("Pymongo MongoClient object is not supported! please use async mongodb driver such as async_pymongo and motor.")
+                raise Exception(
+                    "Pymongo MongoClient object is not supported! please use async mongodb driver such as async_pymongo and motor."
+                )
             database = connection[name]
         else:
-            raise Exception("Wrong connection object type! please pass valid connection object to connection parameter!")
+            raise Exception(
+                "Wrong connection object type! please pass valid connection object to connection parameter!"
+            )
 
         self.lock = asyncio.Lock()
         self.database = database
-        self._peer = database['peers']
-        self._session = database['session']
-        self._usernames = database['usernames']
+        self._peer = database["peers"]
+        self._session = database["session"]
+        self._usernames = database["usernames"]
         self._remove_peers = remove_peers
 
     async def open(self):
@@ -70,19 +72,18 @@ async def open(self):
         user_id   INTEGER,
         is_bot    INTEGER
         """
-        if await self._session.find_one({'_id': 0}, {}):
+        if await self._session.find_one({"_id": 0}, {}):
             return
         await self._session.insert_one(
             {
-                '_id': 0,
-                'dc_id': 2,
-                'api_id': None,
-                'test_mode': None,
-                'auth_key': b'',
-                'date': 0,
-                'user_id': 0,
-                'is_bot': 0,
-
+                "_id": 0,
+                "dc_id": 2,
+                "api_id": None,
+                "test_mode": None,
+                "auth_key": b"",
+                "date": 0,
+                "user_id": 0,
+                "is_bot": 0,
             }
         )
 
@@ -94,7 +95,7 @@ async def close(self):
 
     async def delete(self):
         try:
-            await self._session.delete_one({'_id': 0})
+            await self._session.delete_one({"_id": 0})
             if self._remove_peers:
                 await self._peer.remove({})
         except Exception as _:
@@ -105,99 +106,98 @@ async def update_peers(self, peers: List[Tuple[int, int, str, str, str]]):
         s = int(time.time())
         bulk = [
             UpdateOne(
-                {'_id': i[0]},
-                {'$set': {
-                    'access_hash': i[1], 
-                    'type': i[2], 
-                    'username': i[3], 
-                    'phone_number': i[4],
-                    'last_update_on': s
-                }},
-                upsert=True
-            ) for i in peers
+                {"_id": i[0]},
+                {
+                    "$set": {
+                        "access_hash": i[1],
+                        "type": i[2],
+                        "username": i[3],
+                        "phone_number": i[4],
+                        "last_update_on": s,
+                    }
+                },
+                upsert=True,
+            )
+            for i in peers
         ]
         if not bulk:
             return
-        await self._peer.bulk_write(
-            bulk
-        )
+        await self._peer.bulk_write(bulk)
 
     async def update_usernames(self, usernames: List[Tuple[int, str]]):
         s = int(time.time())
-        bulk_delete = [
-            DeleteMany(
-                {'peer_id': i[0]}
-            ) for i in usernames
-        ]
+        bulk_delete = [DeleteMany({"peer_id": i[0]}) for i in usernames]
         bulk = [
             UpdateOne(
-                {'_id': i[1]},
-                {'$set': {
-                    'peer_id': i[0],
-                    'last_update_on': s
-                }},
-                upsert=True
-            ) for i in usernames
+                {"_id": i[1]},
+                {"$set": {"peer_id": i[0], "last_update_on": s}},
+                upsert=True,
+            )
+            for i in usernames
         ]
         if not bulk:
             return
-        await self._usernames.bulk_write(
-            bulk_delete
-        )
-        await self._usernames.bulk_write(
-            bulk
-        )
+        await self._usernames.bulk_write(bulk_delete)
+        await self._usernames.bulk_write(bulk)
 
     async def get_peer_by_id(self, peer_id: int):
         # id, access_hash, type
-        r = await self._peer.find_one({'_id': peer_id}, {'_id': 1, 'access_hash': 1, 'type': 1})
+        r = await self._peer.find_one(
+            {"_id": peer_id}, {"_id": 1, "access_hash": 1, "type": 1}
+        )
         if not r:
             raise KeyError(f"ID not found: {peer_id}")
-        return get_input_peer(r['_id'], r['access_hash'], r['type'])
+        return get_input_peer(r["_id"], r["access_hash"], r["type"])
 
     async def get_peer_by_username(self, username: str):
         # id, access_hash, type, last_update_on,
-        r = await self._peer.find_one({'username': username},
-                                      {'_id': 1, 'access_hash': 1, 'type': 1, 'last_update_on': 1})
+        r = await self._peer.find_one(
+            {"username": username},
+            {"_id": 1, "access_hash": 1, "type": 1, "last_update_on": 1},
+        )
 
         if r is None:
-            r2 = await self._usernames.find_one({'_id': username},
-                                          {'peer_id': 1, 'last_update_on': 1})
+            r2 = await self._usernames.find_one(
+                {"_id": username}, {"peer_id": 1, "last_update_on": 1}
+            )
             if r2 is None:
                 raise KeyError(f"Username not found: {username}")
-            if abs(time.time() - r2['last_update_on']) > self.USERNAME_TTL:
+            if abs(time.time() - r2["last_update_on"]) > self.USERNAME_TTL:
                 raise KeyError(f"Username expired: {username}")
-            r = await self._peer.find_one({'_id': r2['peer_id']},
-                                          {'_id': 1, 'access_hash': 1, 'type': 1, 'last_update_on': 1})
+            r = await self._peer.find_one(
+                {"_id": r2["peer_id"]},
+                {"_id": 1, "access_hash": 1, "type": 1, "last_update_on": 1},
+            )
             if r is None:
                 raise KeyError(f"Username not found: {username}")
 
-        if abs(time.time() - r['last_update_on']) > self.USERNAME_TTL:
+        if abs(time.time() - r["last_update_on"]) > self.USERNAME_TTL:
             raise KeyError(f"Username expired: {username}")
 
-        return get_input_peer(r['_id'], r['access_hash'], r['type'])
+        return get_input_peer(r["_id"], r["access_hash"], r["type"])
 
     async def get_peer_by_phone_number(self, phone_number: str):
 
         #  _id, access_hash, type,
-        r = await self._peer.find_one({'phone_number': phone_number},
-                                      {'_id': 1, 'access_hash': 1, 'type': 1})
+        r = await self._peer.find_one(
+            {"phone_number": phone_number}, {"_id": 1, "access_hash": 1, "type": 1}
+        )
 
         if r is None:
             raise KeyError(f"Phone number not found: {phone_number}")
 
-        return get_input_peer(r['_id'], r['access_hash'], r['type'])
+        return get_input_peer(r["_id"], r["access_hash"], r["type"])
 
     async def _get(self):
         attr = inspect.stack()[2].function
-        d = await self._session.find_one({'_id': 0}, {attr: 1})
+        d = await self._session.find_one({"_id": 0}, {attr: 1})
         if not d:
             return
         return d[attr]
 
     async def _set(self, value: Any):
         attr = inspect.stack()[2].function
-        await self._session.update_one({'_id': 0}, {'$set': {attr: value}}, upsert=True)
+        await self._session.update_one({"_id": 0}, {"$set": {attr: value}}, upsert=True)
 
     async def _accessor(self, value: Any = object):
         return await self._get() if value == object else await self._set(value)
diff --git a/pyrogram/storage/sqlite_storage.py b/pyrogram/storage/sqlite_storage.py
index 74d785aa4..1e96f1431 100644
--- a/pyrogram/storage/sqlite_storage.py
+++ b/pyrogram/storage/sqlite_storage.py
@@ -90,20 +90,14 @@
 
 def get_input_peer(peer_id: int, access_hash: int, peer_type: str):
     if peer_type in ["user", "bot"]:
-        return raw.types.InputPeerUser(
-            user_id=peer_id,
-            access_hash=access_hash
-        )
+        return raw.types.InputPeerUser(user_id=peer_id, access_hash=access_hash)
 
     if peer_type == "group":
-        return raw.types.InputPeerChat(
-            chat_id=-peer_id
-        )
+        return raw.types.InputPeerChat(chat_id=-peer_id)
 
     if peer_type in ["channel", "supergroup"]:
         return raw.types.InputPeerChannel(
-            channel_id=utils.get_channel_id(peer_id),
-            access_hash=access_hash
+            channel_id=utils.get_channel_id(peer_id), access_hash=access_hash
         )
 
     raise ValueError(f"Invalid peer type: {peer_type}")
@@ -123,14 +117,11 @@ def create(self):
             self.conn.executescript(SCHEMA)
             self.conn.executescript(UNAME_SCHEMA)
 
-            self.conn.execute(
-                "INSERT INTO version VALUES (?)",
-                (self.VERSION,)
-            )
+            self.conn.execute("INSERT INTO version VALUES (?)", (self.VERSION,))
 
             self.conn.execute(
                 "INSERT INTO sessions VALUES (?, ?, ?, ?, ?, ?, ?)",
-                (2, None, None, None, 0, None, None)
+                (2, None, None, None, 0, None, None),
             )
 
     async def open(self):
@@ -150,26 +141,20 @@ async def update_peers(self, peers: List[Tuple[int, int, str, str, str]]):
         self.conn.executemany(
             "REPLACE INTO peers (id, access_hash, type, username, phone_number)"
             "VALUES (?, ?, ?, ?, ?)",
-            peers
+            peers,
         )
 
     async def update_usernames(self, usernames: List[Tuple[int, str]]):
         self.conn.executescript(UNAME_SCHEMA)
         for user in usernames:
-            self.conn.execute(
-                "DELETE FROM usernames WHERE peer_id=?",
-                (user[0],)
-            )
+            self.conn.execute("DELETE FROM usernames WHERE peer_id=?", (user[0],))
         self.conn.executemany(
-            "REPLACE INTO usernames (peer_id, id)"
-            "VALUES (?, ?)",
-            usernames
+            "REPLACE INTO usernames (peer_id, id)" "VALUES (?, ?)", usernames
         )
 
     async def get_peer_by_id(self, peer_id: int):
         r = self.conn.execute(
-            "SELECT id, access_hash, type FROM peers WHERE id = ?",
-            (peer_id,)
+            "SELECT id, access_hash, type FROM peers WHERE id = ?", (peer_id,)
         ).fetchone()
 
         if r is None:
@@ -181,14 +166,14 @@ async def get_peer_by_username(self, username: str):
         r = self.conn.execute(
             "SELECT id, access_hash, type, last_update_on FROM peers WHERE username = ?"
             "ORDER BY last_update_on DESC",
-            (username,)
+            (username,),
         ).fetchone()
 
         if r is None:
             r2 = self.conn.execute(
                 "SELECT peer_id, last_update_on FROM usernames WHERE id = ?"
                 "ORDER BY last_update_on DESC",
-                (username,)
+                (username,),
             ).fetchone()
             if r2 is None:
                 raise KeyError(f"Username not found: {username}")
@@ -197,7 +182,7 @@ async def get_peer_by_username(self, username: str):
             r = r = self.conn.execute(
                 "SELECT id, access_hash, type, last_update_on FROM peers WHERE id = ?"
                 "ORDER BY last_update_on DESC",
-                (r2[0],)
+                (r2[0],),
             ).fetchone()
             if r is None:
                 raise KeyError(f"Username not found: {username}")
@@ -210,7 +195,7 @@ async def get_peer_by_username(self, username: str):
     async def get_peer_by_phone_number(self, phone_number: str):
         r = self.conn.execute(
             "SELECT id, access_hash, type FROM peers WHERE phone_number = ?",
-            (phone_number,)
+            (phone_number,),
         ).fetchone()
 
         if r is None:
@@ -221,18 +206,13 @@ async def get_peer_by_phone_number(self, phone_number: str):
     def _get(self):
         attr = inspect.stack()[2].function
 
-        return self.conn.execute(
-            f"SELECT {attr} FROM sessions"
-        ).fetchone()[0]
+        return self.conn.execute(f"SELECT {attr} FROM sessions").fetchone()[0]
 
     def _set(self, value: Any):
         attr = inspect.stack()[2].function
 
         with self.conn:
-            self.conn.execute(
-                f"UPDATE sessions SET {attr} = ?",
-                (value,)
-            )
+            self.conn.execute(f"UPDATE sessions SET {attr} = ?", (value,))
 
     def _accessor(self, value: Any = object):
         return self._get() if value == object else self._set(value)
@@ -260,12 +240,7 @@ async def is_bot(self, value: bool = object):
 
     def version(self, value: int = object):
         if value == object:
-            return self.conn.execute(
-                "SELECT number FROM version"
-            ).fetchone()[0]
+            return self.conn.execute("SELECT number FROM version").fetchone()[0]
         else:
             with self.conn:
-                self.conn.execute(
-                    "UPDATE version SET number = ?",
-                    (value,)
-                )
+                self.conn.execute("UPDATE version SET number = ?", (value,))
diff --git a/pyrogram/storage/storage.py b/pyrogram/storage/storage.py
index 8f0938e4d..8e0f45937 100644
--- a/pyrogram/storage/storage.py
+++ b/pyrogram/storage/storage.py
@@ -30,6 +30,7 @@ class Storage(ABC):
         name (``str``):
             The name of the session.
     """
+
     OLD_SESSION_STRING_FORMAT = ">B?256sI?"
     OLD_SESSION_STRING_FORMAT_64 = ">B?256sQ?"
     SESSION_STRING_SIZE = 351
@@ -190,7 +191,7 @@ async def export_session_string(self):
             await self.test_mode(),
             await self.auth_key(),
             await self.user_id(),
-            await self.is_bot()
+            await self.is_bot(),
         )
 
         return base64.urlsafe_b64encode(packed).decode().rstrip("=")
diff --git a/pyrogram/sync.py b/pyrogram/sync.py
index 94c82a3dd..bb630d347 100644
--- a/pyrogram/sync.py
+++ b/pyrogram/sync.py
@@ -41,7 +41,9 @@ async def anext(agen):
             if is_main_thread:
                 item, done = loop.run_until_complete(anext(agen))
             else:
-                item, done = asyncio.run_coroutine_threadsafe(anext(agen), loop).result()
+                item, done = asyncio.run_coroutine_threadsafe(
+                    anext(agen), loop
+                ).result()
 
             if done:
                 break
@@ -58,7 +60,10 @@ def async_to_sync_wrap(*args, **kwargs):
             loop = asyncio.new_event_loop()
             asyncio.set_event_loop(loop)
 
-        if threading.current_thread() is threading.main_thread() or not main_loop.is_running():
+        if (
+            threading.current_thread() is threading.main_thread()
+            or not main_loop.is_running()
+        ):
             if loop.is_running():
                 return coroutine
             else:
@@ -70,12 +75,17 @@ def async_to_sync_wrap(*args, **kwargs):
         else:
             if inspect.iscoroutine(coroutine):
                 if loop.is_running():
+
                     async def coro_wrapper():
-                        return await asyncio.wrap_future(asyncio.run_coroutine_threadsafe(coroutine, main_loop))
+                        return await asyncio.wrap_future(
+                            asyncio.run_coroutine_threadsafe(coroutine, main_loop)
+                        )
 
                     return coro_wrapper()
                 else:
-                    return asyncio.run_coroutine_threadsafe(coroutine, main_loop).result()
+                    return asyncio.run_coroutine_threadsafe(
+                        coroutine, main_loop
+                    ).result()
 
             if inspect.isasyncgen(coroutine):
                 if loop.is_running():
@@ -91,7 +101,9 @@ def wrap(source):
         method = getattr(source, name)
 
         if not name.startswith("_"):
-            if inspect.iscoroutinefunction(method) or inspect.isasyncgenfunction(method):
+            if inspect.iscoroutinefunction(method) or inspect.isasyncgenfunction(
+                method
+            ):
                 async_to_sync(source, name)
 
 
diff --git a/pyrogram/types/authorization/sent_code.py b/pyrogram/types/authorization/sent_code.py
index 2b29bb3af..42b0e36c1 100644
--- a/pyrogram/types/authorization/sent_code.py
+++ b/pyrogram/types/authorization/sent_code.py
@@ -39,7 +39,8 @@ class SentCode(Object):
     """
 
     def __init__(
-        self, *,
+        self,
+        *,
         type: "enums.SentCodeType",
         phone_code_hash: str,
         next_type: "enums.NextCodeType" = None,
@@ -57,6 +58,8 @@ def _parse(sent_code: raw.types.auth.SentCode) -> "SentCode":
         return SentCode(
             type=enums.SentCodeType(type(sent_code.type)),
             phone_code_hash=sent_code.phone_code_hash,
-            next_type=enums.NextCodeType(type(sent_code.next_type)) if sent_code.next_type else None,
-            timeout=sent_code.timeout
+            next_type=enums.NextCodeType(type(sent_code.next_type))
+            if sent_code.next_type
+            else None,
+            timeout=sent_code.timeout,
         )
diff --git a/pyrogram/types/authorization/terms_of_service.py b/pyrogram/types/authorization/terms_of_service.py
index 3c5ffa6c6..153c8eebe 100644
--- a/pyrogram/types/authorization/terms_of_service.py
+++ b/pyrogram/types/authorization/terms_of_service.py
@@ -52,5 +52,7 @@ def _parse(terms_of_service: "raw.types.help.TermsOfService") -> "TermsOfService
             entities=[
                 types.MessageEntity._parse(None, entity, {})
                 for entity in terms_of_service.entities
-            ] if terms_of_service.entities else None
+            ]
+            if terms_of_service.entities
+            else None,
         )
diff --git a/pyrogram/types/bots_and_keyboards/__init__.py b/pyrogram/types/bots_and_keyboards/__init__.py
index a689f97c4..8b11025a3 100644
--- a/pyrogram/types/bots_and_keyboards/__init__.py
+++ b/pyrogram/types/bots_and_keyboards/__init__.py
@@ -18,7 +18,9 @@
 
 from .bot_command import BotCommand
 from .bot_command_scope import BotCommandScope
-from .bot_command_scope_all_chat_administrators import BotCommandScopeAllChatAdministrators
+from .bot_command_scope_all_chat_administrators import (
+    BotCommandScopeAllChatAdministrators,
+)
 from .bot_command_scope_all_group_chats import BotCommandScopeAllGroupChats
 from .bot_command_scope_all_private_chats import BotCommandScopeAllPrivateChats
 from .bot_command_scope_chat import BotCommandScopeChat
@@ -75,5 +77,5 @@
     "MenuButtonCommands",
     "MenuButtonWebApp",
     "MenuButtonDefault",
-    "SentWebAppMessage"
+    "SentWebAppMessage",
 ]
diff --git a/pyrogram/types/bots_and_keyboards/bot_command.py b/pyrogram/types/bots_and_keyboards/bot_command.py
index 88f459dcc..10e233d9c 100644
--- a/pyrogram/types/bots_and_keyboards/bot_command.py
+++ b/pyrogram/types/bots_and_keyboards/bot_command.py
@@ -47,7 +47,4 @@ def write(self) -> "raw.types.BotCommand":
 
     @staticmethod
     def read(c: "raw.types.BotCommand") -> "BotCommand":
-        return BotCommand(
-            command=c.command,
-            description=c.description
-        )
+        return BotCommand(command=c.command, description=c.description)
diff --git a/pyrogram/types/bots_and_keyboards/bot_command_scope_all_chat_administrators.py b/pyrogram/types/bots_and_keyboards/bot_command_scope_all_chat_administrators.py
index 0cc6339c7..a33bc9226 100644
--- a/pyrogram/types/bots_and_keyboards/bot_command_scope_all_chat_administrators.py
+++ b/pyrogram/types/bots_and_keyboards/bot_command_scope_all_chat_administrators.py
@@ -22,8 +22,7 @@
 
 
 class BotCommandScopeAllChatAdministrators(BotCommandScope):
-    """Represents the scope of bot commands, covering all group and supergroup chat administrators.
-    """
+    """Represents the scope of bot commands, covering all group and supergroup chat administrators."""
 
     def __init__(self):
         super().__init__("all_chat_administrators")
diff --git a/pyrogram/types/bots_and_keyboards/bot_command_scope_all_group_chats.py b/pyrogram/types/bots_and_keyboards/bot_command_scope_all_group_chats.py
index 5f8457f61..9862de33f 100644
--- a/pyrogram/types/bots_and_keyboards/bot_command_scope_all_group_chats.py
+++ b/pyrogram/types/bots_and_keyboards/bot_command_scope_all_group_chats.py
@@ -22,8 +22,7 @@
 
 
 class BotCommandScopeAllGroupChats(BotCommandScope):
-    """Represents the scope of bot commands, covering all group and supergroup chats.
-    """
+    """Represents the scope of bot commands, covering all group and supergroup chats."""
 
     def __init__(self):
         super().__init__("all_group_chats")
diff --git a/pyrogram/types/bots_and_keyboards/bot_command_scope_all_private_chats.py b/pyrogram/types/bots_and_keyboards/bot_command_scope_all_private_chats.py
index 14b80f0dc..d59754755 100644
--- a/pyrogram/types/bots_and_keyboards/bot_command_scope_all_private_chats.py
+++ b/pyrogram/types/bots_and_keyboards/bot_command_scope_all_private_chats.py
@@ -22,8 +22,7 @@
 
 
 class BotCommandScopeAllPrivateChats(BotCommandScope):
-    """Represents the scope of bot commands, covering all private chats.
-    """
+    """Represents the scope of bot commands, covering all private chats."""
 
     def __init__(self):
         super().__init__("all_private_chats")
diff --git a/pyrogram/types/bots_and_keyboards/bot_command_scope_chat_member.py b/pyrogram/types/bots_and_keyboards/bot_command_scope_chat_member.py
index 8d91df141..3aed32f1a 100644
--- a/pyrogram/types/bots_and_keyboards/bot_command_scope_chat_member.py
+++ b/pyrogram/types/bots_and_keyboards/bot_command_scope_chat_member.py
@@ -44,5 +44,5 @@ def __init__(self, chat_id: Union[int, str], user_id: Union[int, str]):
     async def write(self, client: "pyrogram.Client") -> "raw.base.BotCommandScope":
         return raw.types.BotCommandScopePeerUser(
             peer=await client.resolve_peer(self.chat_id),
-            user_id=await client.resolve_peer(self.user_id)
+            user_id=await client.resolve_peer(self.user_id),
         )
diff --git a/pyrogram/types/bots_and_keyboards/bot_info.py b/pyrogram/types/bots_and_keyboards/bot_info.py
index c88bc92ca..3ae4c039e 100644
--- a/pyrogram/types/bots_and_keyboards/bot_info.py
+++ b/pyrogram/types/bots_and_keyboards/bot_info.py
@@ -27,7 +27,7 @@ class BotInfo(Object):
     Parameters:
         name (``str``):
             The bot name.
-        
+
         about (``str``):
             The bot bio.
 
@@ -42,11 +42,10 @@ def __init__(self, name: str, about: str, description: str):
         self.about = about
         self.description = description
 
-    
     @staticmethod
     def _parse(bot_info: "raw.types.bots.BotInfo") -> "BotInfo":
         return BotInfo(
-            name=getattr(bot_info,"name", None),
-            about=getattr(bot_info,"about", None),
-            description=getattr(bot_info,"description", None)
+            name=getattr(bot_info, "name", None),
+            about=getattr(bot_info, "about", None),
+            description=getattr(bot_info, "description", None),
         )
diff --git a/pyrogram/types/bots_and_keyboards/callback_query.py b/pyrogram/types/bots_and_keyboards/callback_query.py
index efdd14ca4..6b8a011f8 100644
--- a/pyrogram/types/bots_and_keyboards/callback_query.py
+++ b/pyrogram/types/bots_and_keyboards/callback_query.py
@@ -87,7 +87,9 @@ def __init__(
         self.matches = matches
 
     @staticmethod
-    async def _parse(client: "pyrogram.Client", callback_query, users) -> "CallbackQuery":
+    async def _parse(
+        client: "pyrogram.Client", callback_query, users
+    ) -> "CallbackQuery":
         message = None
         inline_message_id = None
 
@@ -117,10 +119,16 @@ async def _parse(client: "pyrogram.Client", callback_query, users) -> "CallbackQ
             chat_instance=str(callback_query.chat_instance),
             data=data,
             game_short_name=callback_query.game_short_name,
-            client=client
+            client=client,
         )
 
-    async def answer(self, text: str = None, show_alert: bool = None, url: str = None, cache_time: int = 0):
+    async def answer(
+        self,
+        text: str = None,
+        show_alert: bool = None,
+        url: str = None,
+        cache_time: int = 0,
+    ):
         """Bound method *answer* of :obj:`~pyrogram.types.CallbackQuery`.
 
         Use this method as a shortcut for:
@@ -161,7 +169,7 @@ async def answer(self, text: str = None, show_alert: bool = None, url: str = Non
             text=text,
             show_alert=show_alert,
             url=url,
-            cache_time=cache_time
+            cache_time=cache_time,
         )
 
     async def edit_message_text(
@@ -169,7 +177,7 @@ async def edit_message_text(
         text: str,
         parse_mode: Optional["enums.ParseMode"] = None,
         disable_web_page_preview: bool = None,
-        reply_markup: "types.InlineKeyboardMarkup" = None
+        reply_markup: "types.InlineKeyboardMarkup" = None,
     ) -> Union["types.Message", bool]:
         """Edit the text of messages attached to callback queries.
 
@@ -203,7 +211,7 @@ async def edit_message_text(
                 text=text,
                 parse_mode=parse_mode,
                 disable_web_page_preview=disable_web_page_preview,
-                reply_markup=reply_markup
+                reply_markup=reply_markup,
             )
         else:
             return await self._client.edit_inline_text(
@@ -211,14 +219,14 @@ async def edit_message_text(
                 text=text,
                 parse_mode=parse_mode,
                 disable_web_page_preview=disable_web_page_preview,
-                reply_markup=reply_markup
+                reply_markup=reply_markup,
             )
 
     async def edit_message_caption(
         self,
         caption: str,
         parse_mode: Optional["enums.ParseMode"] = None,
-        reply_markup: "types.InlineKeyboardMarkup" = None
+        reply_markup: "types.InlineKeyboardMarkup" = None,
     ) -> Union["types.Message", bool]:
         """Edit the caption of media messages attached to callback queries.
 
@@ -242,12 +250,14 @@ async def edit_message_caption(
         Raises:
             RPCError: In case of a Telegram RPC error.
         """
-        return await self.edit_message_text(caption, parse_mode, reply_markup=reply_markup)
+        return await self.edit_message_text(
+            caption, parse_mode, reply_markup=reply_markup
+        )
 
     async def edit_message_media(
         self,
         media: "types.InputMedia",
-        reply_markup: "types.InlineKeyboardMarkup" = None
+        reply_markup: "types.InlineKeyboardMarkup" = None,
     ) -> Union["types.Message", bool]:
         """Edit animation, audio, document, photo or video messages attached to callback queries.
 
@@ -272,18 +282,17 @@ async def edit_message_media(
                 chat_id=self.message.chat.id,
                 message_id=self.message.id,
                 media=media,
-                reply_markup=reply_markup
+                reply_markup=reply_markup,
             )
         else:
             return await self._client.edit_inline_media(
                 inline_message_id=self.inline_message_id,
                 media=media,
-                reply_markup=reply_markup
+                reply_markup=reply_markup,
             )
 
     async def edit_message_reply_markup(
-        self,
-        reply_markup: "types.InlineKeyboardMarkup" = None
+        self, reply_markup: "types.InlineKeyboardMarkup" = None
     ) -> Union["types.Message", bool]:
         """Edit only the reply markup of messages attached to callback queries.
 
@@ -304,10 +313,9 @@ async def edit_message_reply_markup(
             return await self._client.edit_message_reply_markup(
                 chat_id=self.message.chat.id,
                 message_id=self.message.id,
-                reply_markup=reply_markup
+                reply_markup=reply_markup,
             )
         else:
             return await self._client.edit_inline_reply_markup(
-                inline_message_id=self.inline_message_id,
-                reply_markup=reply_markup
+                inline_message_id=self.inline_message_id, reply_markup=reply_markup
             )
diff --git a/pyrogram/types/bots_and_keyboards/force_reply.py b/pyrogram/types/bots_and_keyboards/force_reply.py
index 4cb137d84..46cf225b5 100644
--- a/pyrogram/types/bots_and_keyboards/force_reply.py
+++ b/pyrogram/types/bots_and_keyboards/force_reply.py
@@ -41,11 +41,7 @@ class ForceReply(Object):
             The placeholder to be shown in the input field when the reply is active; 1-64 characters.
     """
 
-    def __init__(
-        self,
-        selective: bool = None,
-        placeholder: str = None
-    ):
+    def __init__(self, selective: bool = None, placeholder: str = None):
         super().__init__()
 
         self.selective = selective
@@ -53,14 +49,11 @@ def __init__(
 
     @staticmethod
     def read(b):
-        return ForceReply(
-            selective=b.selective,
-            placeholder=b.placeholder
-        )
+        return ForceReply(selective=b.selective, placeholder=b.placeholder)
 
     async def write(self, _: "pyrogram.Client"):
         return raw.types.ReplyKeyboardForceReply(
             single_use=True,
             selective=self.selective or None,
-            placeholder=self.placeholder or None
+            placeholder=self.placeholder or None,
         )
diff --git a/pyrogram/types/bots_and_keyboards/game_high_score.py b/pyrogram/types/bots_and_keyboards/game_high_score.py
index 295b83fb2..fcfe0ec2d 100644
--- a/pyrogram/types/bots_and_keyboards/game_high_score.py
+++ b/pyrogram/types/bots_and_keyboards/game_high_score.py
@@ -51,20 +51,24 @@ def __init__(
         self.position = position
 
     @staticmethod
-    def _parse(client, game_high_score: raw.types.HighScore, users: dict) -> "GameHighScore":
+    def _parse(
+        client, game_high_score: raw.types.HighScore, users: dict
+    ) -> "GameHighScore":
         users = {i.id: i for i in users}
 
         return GameHighScore(
             user=types.User._parse(client, users[game_high_score.user_id]),
             score=game_high_score.score,
             position=game_high_score.pos,
-            client=client
+            client=client,
         )
 
     @staticmethod
     def _parse_action(client, service: raw.types.MessageService, users: dict):
         return GameHighScore(
-            user=types.User._parse(client, users[utils.get_raw_peer_id(service.from_id or service.peer_id)]),
+            user=types.User._parse(
+                client, users[utils.get_raw_peer_id(service.from_id or service.peer_id)]
+            ),
             score=service.action.score,
-            client=client
+            client=client,
         )
diff --git a/pyrogram/types/bots_and_keyboards/inline_keyboard_button.py b/pyrogram/types/bots_and_keyboards/inline_keyboard_button.py
index a1d8a7adc..a746f9224 100644
--- a/pyrogram/types/bots_and_keyboards/inline_keyboard_button.py
+++ b/pyrogram/types/bots_and_keyboards/inline_keyboard_button.py
@@ -81,7 +81,7 @@ def __init__(
         user_id: int = None,
         switch_inline_query: str = None,
         switch_inline_query_current_chat: str = None,
-        callback_game: "types.CallbackGame" = None
+        callback_game: "types.CallbackGame" = None,
     ):
         super().__init__()
 
@@ -106,103 +106,72 @@ def read(b: "raw.base.KeyboardButton"):
             except UnicodeDecodeError:
                 data = b.data
 
-            return InlineKeyboardButton(
-                text=b.text,
-                callback_data=data
-            )
+            return InlineKeyboardButton(text=b.text, callback_data=data)
 
         if isinstance(b, raw.types.KeyboardButtonUrl):
-            return InlineKeyboardButton(
-                text=b.text,
-                url=b.url
-            )
+            return InlineKeyboardButton(text=b.text, url=b.url)
 
         if isinstance(b, raw.types.KeyboardButtonUrlAuth):
-            return InlineKeyboardButton(
-                text=b.text,
-                login_url=types.LoginUrl.read(b)
-            )
+            return InlineKeyboardButton(text=b.text, login_url=types.LoginUrl.read(b))
 
         if isinstance(b, raw.types.KeyboardButtonUserProfile):
-            return InlineKeyboardButton(
-                text=b.text,
-                user_id=b.user_id
-            )
+            return InlineKeyboardButton(text=b.text, user_id=b.user_id)
 
         if isinstance(b, raw.types.KeyboardButtonSwitchInline):
             if b.same_peer:
                 return InlineKeyboardButton(
-                    text=b.text,
-                    switch_inline_query_current_chat=b.query
+                    text=b.text, switch_inline_query_current_chat=b.query
                 )
             else:
-                return InlineKeyboardButton(
-                    text=b.text,
-                    switch_inline_query=b.query
-                )
+                return InlineKeyboardButton(text=b.text, switch_inline_query=b.query)
 
         if isinstance(b, raw.types.KeyboardButtonGame):
-            return InlineKeyboardButton(
-                text=b.text,
-                callback_game=types.CallbackGame()
-            )
+            return InlineKeyboardButton(text=b.text, callback_game=types.CallbackGame())
 
         if isinstance(b, raw.types.KeyboardButtonWebView):
             return InlineKeyboardButton(
-                text=b.text,
-                web_app=types.WebAppInfo(
-                    url=b.url
-                )
+                text=b.text, web_app=types.WebAppInfo(url=b.url)
             )
 
     async def write(self, client: "pyrogram.Client"):
         if self.callback_data is not None:
             # Telegram only wants bytes, but we are allowed to pass strings too, for convenience.
-            data = bytes(self.callback_data, "utf-8") if isinstance(self.callback_data, str) else self.callback_data
-
-            return raw.types.KeyboardButtonCallback(
-                text=self.text,
-                data=data
+            data = (
+                bytes(self.callback_data, "utf-8")
+                if isinstance(self.callback_data, str)
+                else self.callback_data
             )
 
+            return raw.types.KeyboardButtonCallback(text=self.text, data=data)
+
         if self.url is not None:
-            return raw.types.KeyboardButtonUrl(
-                text=self.text,
-                url=self.url
-            )
+            return raw.types.KeyboardButtonUrl(text=self.text, url=self.url)
 
         if self.login_url is not None:
             return self.login_url.write(
                 text=self.text,
-                bot=await client.resolve_peer(self.login_url.bot_username or "self")
+                bot=await client.resolve_peer(self.login_url.bot_username or "self"),
             )
 
         if self.user_id is not None:
             return raw.types.InputKeyboardButtonUserProfile(
-                text=self.text,
-                user_id=await client.resolve_peer(self.user_id)
+                text=self.text, user_id=await client.resolve_peer(self.user_id)
             )
 
         if self.switch_inline_query is not None:
             return raw.types.KeyboardButtonSwitchInline(
-                text=self.text,
-                query=self.switch_inline_query
+                text=self.text, query=self.switch_inline_query
             )
 
         if self.switch_inline_query_current_chat is not None:
             return raw.types.KeyboardButtonSwitchInline(
                 text=self.text,
                 query=self.switch_inline_query_current_chat,
-                same_peer=True
+                same_peer=True,
             )
 
         if self.callback_game is not None:
-            return raw.types.KeyboardButtonGame(
-                text=self.text
-            )
+            return raw.types.KeyboardButtonGame(text=self.text)
 
         if self.web_app is not None:
-            return raw.types.KeyboardButtonWebView(
-                text=self.text,
-                url=self.web_app.url
-            )
+            return raw.types.KeyboardButtonWebView(text=self.text, url=self.web_app.url)
diff --git a/pyrogram/types/bots_and_keyboards/inline_keyboard_markup.py b/pyrogram/types/bots_and_keyboards/inline_keyboard_markup.py
index e0fd32305..d13b1bec6 100644
--- a/pyrogram/types/bots_and_keyboards/inline_keyboard_markup.py
+++ b/pyrogram/types/bots_and_keyboards/inline_keyboard_markup.py
@@ -49,9 +49,7 @@ def read(o):
 
             inline_keyboard.append(row)
 
-        return InlineKeyboardMarkup(
-            inline_keyboard=inline_keyboard
-        )
+        return InlineKeyboardMarkup(inline_keyboard=inline_keyboard)
 
     async def write(self, client: "pyrogram.Client"):
         rows = []
diff --git a/pyrogram/types/bots_and_keyboards/keyboard_button.py b/pyrogram/types/bots_and_keyboards/keyboard_button.py
index 5c144e21f..2a03f3ea8 100644
--- a/pyrogram/types/bots_and_keyboards/keyboard_button.py
+++ b/pyrogram/types/bots_and_keyboards/keyboard_button.py
@@ -20,6 +20,7 @@
 from ..object import Object
 from typing import Union
 
+
 class KeyboardButton(Object):
     """One button of the reply keyboard.
     For simple text buttons String can be used instead of this object to specify text of the button.
@@ -58,9 +59,11 @@ def __init__(
         text: str,
         request_contact: bool = None,
         request_location: bool = None,
-        request_chat: Union["types.RequestPeerTypeChat","types.RequestPeerTypeChannel"] = None,
+        request_chat: Union[
+            "types.RequestPeerTypeChat", "types.RequestPeerTypeChannel"
+        ] = None,
         request_user: "types.RequestPeerTypeUser" = None,
-        web_app: "types.WebAppInfo" = None
+        web_app: "types.WebAppInfo" = None,
     ):
         super().__init__()
 
@@ -77,24 +80,13 @@ def read(b):
             return b.text
 
         if isinstance(b, raw.types.KeyboardButtonRequestPhone):
-            return KeyboardButton(
-                text=b.text,
-                request_contact=True
-            )
+            return KeyboardButton(text=b.text, request_contact=True)
 
         if isinstance(b, raw.types.KeyboardButtonRequestGeoLocation):
-            return KeyboardButton(
-                text=b.text,
-                request_location=True
-            )
+            return KeyboardButton(text=b.text, request_location=True)
 
         if isinstance(b, raw.types.KeyboardButtonSimpleWebView):
-            return KeyboardButton(
-                text=b.text,
-                web_app=types.WebAppInfo(
-                    url=b.url
-                )
-            )
+            return KeyboardButton(text=b.text, web_app=types.WebAppInfo(url=b.url))
 
         if isinstance(b, raw.types.KeyboardButtonRequestPeer):
             if isinstance(b.peer_type, raw.types.RequestPeerTypeBroadcast):
@@ -103,8 +95,8 @@ def read(b):
                     request_chat=types.RequestPeerTypeChannel(
                         is_creator=b.peer_type.creator,
                         is_username=b.peer_type.has_username,
-                        max=b.max_quantity
-                    )
+                        max=b.max_quantity,
+                    ),
                 )
             if isinstance(b.peer_type, raw.types.RequestPeerTypeChat):
                 return KeyboardButton(
@@ -114,8 +106,8 @@ def read(b):
                         is_bot_participant=b.peer_type.bot_participant,
                         is_username=b.peer_type.has_username,
                         is_forum=b.peer_type.forum,
-                        max=b.max_quantity
-                    )
+                        max=b.max_quantity,
+                    ),
                 )
 
             if isinstance(b.peer_type, raw.types.RequestPeerTypeUser):
@@ -124,9 +116,9 @@ def read(b):
                     request_user=types.RequestPeerTypeUser(
                         is_bot=b.peer_type.bot,
                         is_premium=b.peer_type.premium,
-                        max=b.max_quantity
-                    )
-            )
+                        max=b.max_quantity,
+                    ),
+                )
 
     def write(self):
         if self.request_contact:
@@ -140,9 +132,9 @@ def write(self):
                     button_id=0,
                     peer_type=raw.types.RequestPeerTypeBroadcast(
                         creator=self.request_chat.is_creator,
-                        has_username=self.request_chat.is_username
+                        has_username=self.request_chat.is_username,
                     ),
-                    max_quantity=self.request_chat.max
+                    max_quantity=self.request_chat.max,
                 )
             return raw.types.KeyboardButtonRequestPeer(
                 text=self.text,
@@ -151,21 +143,22 @@ def write(self):
                     creator=self.request_chat.is_creator,
                     bot_participant=self.request_chat.is_bot_participant,
                     has_username=self.request_chat.is_username,
-                    forum=self.request_chat.is_forum
+                    forum=self.request_chat.is_forum,
                 ),
-                max_quantity=self.request_chat.max
+                max_quantity=self.request_chat.max,
             )
         elif self.request_user:
             return raw.types.KeyboardButtonRequestPeer(
                 text=self.text,
                 button_id=0,
                 peer_type=raw.types.RequestPeerTypeUser(
-                    bot=self.request_user.is_bot,
-                    premium=self.request_user.is_premium
+                    bot=self.request_user.is_bot, premium=self.request_user.is_premium
                 ),
-                max_quantity=self.request_user.max
+                max_quantity=self.request_user.max,
             )
         elif self.web_app:
-            return raw.types.KeyboardButtonSimpleWebView(text=self.text, url=self.web_app.url)
+            return raw.types.KeyboardButtonSimpleWebView(
+                text=self.text, url=self.web_app.url
+            )
         else:
             return raw.types.KeyboardButton(text=self.text)
diff --git a/pyrogram/types/bots_and_keyboards/login_url.py b/pyrogram/types/bots_and_keyboards/login_url.py
index a0af5a1af..47f0c7191 100644
--- a/pyrogram/types/bots_and_keyboards/login_url.py
+++ b/pyrogram/types/bots_and_keyboards/login_url.py
@@ -57,7 +57,8 @@ class LoginUrl(Object):
     """
 
     def __init__(
-        self, *,
+        self,
+        *,
         url: str,
         forward_text: str = None,
         bot_username: str = None,
@@ -74,11 +75,7 @@ def __init__(
 
     @staticmethod
     def read(b: "raw.types.KeyboardButtonUrlAuth") -> "LoginUrl":
-        return LoginUrl(
-            url=b.url,
-            forward_text=b.fwd_text,
-            button_id=b.button_id
-        )
+        return LoginUrl(url=b.url, forward_text=b.fwd_text, button_id=b.button_id)
 
     def write(self, text: str, bot: "raw.types.InputUser"):
         return raw.types.InputKeyboardButtonUrlAuth(
@@ -86,5 +83,5 @@ def write(self, text: str, bot: "raw.types.InputUser"):
             url=self.url,
             bot=bot,
             fwd_text=self.forward_text,
-            request_write_access=self.request_write_access
+            request_write_access=self.request_write_access,
         )
diff --git a/pyrogram/types/bots_and_keyboards/menu_button_commands.py b/pyrogram/types/bots_and_keyboards/menu_button_commands.py
index b2ef77c9d..70fb0e9f0 100644
--- a/pyrogram/types/bots_and_keyboards/menu_button_commands.py
+++ b/pyrogram/types/bots_and_keyboards/menu_button_commands.py
@@ -22,11 +22,12 @@
 
 
 class MenuButtonCommands(MenuButton):
-    """A menu button, which opens the bot's list of commands.
-    """
+    """A menu button, which opens the bot's list of commands."""
 
     def __init__(self):
         super().__init__("commands")
 
-    async def write(self, client: "pyrogram.Client") -> "raw.types.BotMenuButtonCommands":
+    async def write(
+        self, client: "pyrogram.Client"
+    ) -> "raw.types.BotMenuButtonCommands":
         return raw.types.BotMenuButtonCommands()
diff --git a/pyrogram/types/bots_and_keyboards/menu_button_default.py b/pyrogram/types/bots_and_keyboards/menu_button_default.py
index a00e67633..6115d3aed 100644
--- a/pyrogram/types/bots_and_keyboards/menu_button_default.py
+++ b/pyrogram/types/bots_and_keyboards/menu_button_default.py
@@ -22,11 +22,12 @@
 
 
 class MenuButtonDefault(MenuButton):
-    """Describes that no specific value for the menu button was set.
-    """
+    """Describes that no specific value for the menu button was set."""
 
     def __init__(self):
         super().__init__("default")
 
-    async def write(self, client: "pyrogram.Client") -> "raw.types.BotMenuButtonDefault":
+    async def write(
+        self, client: "pyrogram.Client"
+    ) -> "raw.types.BotMenuButtonDefault":
         return raw.types.BotMenuButtonDefault()
diff --git a/pyrogram/types/bots_and_keyboards/menu_button_web_app.py b/pyrogram/types/bots_and_keyboards/menu_button_web_app.py
index 109088bbc..00c25083d 100644
--- a/pyrogram/types/bots_and_keyboards/menu_button_web_app.py
+++ b/pyrogram/types/bots_and_keyboards/menu_button_web_app.py
@@ -34,18 +34,11 @@ class MenuButtonWebApp(MenuButton):
             :meth:`~pyrogram.Client.answer_web_app_query`.
     """
 
-    def __init__(
-        self,
-        text: str,
-        web_app: "types.WebAppInfo"
-    ):
+    def __init__(self, text: str, web_app: "types.WebAppInfo"):
         super().__init__("web_app")
 
         self.text = text
         self.web_app = web_app
 
     async def write(self, client: "pyrogram.Client") -> "raw.types.BotMenuButton":
-        return raw.types.BotMenuButton(
-            text=self.text,
-            url=self.web_app.url
-        )
+        return raw.types.BotMenuButton(text=self.text, url=self.web_app.url)
diff --git a/pyrogram/types/bots_and_keyboards/reply_keyboard_markup.py b/pyrogram/types/bots_and_keyboards/reply_keyboard_markup.py
index 2949c3e20..c3671b06e 100644
--- a/pyrogram/types/bots_and_keyboards/reply_keyboard_markup.py
+++ b/pyrogram/types/bots_and_keyboards/reply_keyboard_markup.py
@@ -63,7 +63,7 @@ def __init__(
         resize_keyboard: bool = None,
         one_time_keyboard: bool = None,
         selective: bool = None,
-        placeholder: str = None
+        placeholder: str = None,
     ):
         super().__init__()
 
@@ -92,21 +92,25 @@ def read(kb: "raw.base.ReplyMarkup"):
             resize_keyboard=kb.resize,
             one_time_keyboard=kb.single_use,
             selective=kb.selective,
-            placeholder=kb.placeholder
+            placeholder=kb.placeholder,
         )
 
     async def write(self, _: "pyrogram.Client"):
         return raw.types.ReplyKeyboardMarkup(
-            rows=[raw.types.KeyboardButtonRow(
-                buttons=[
-                    types.KeyboardButton(j).write()
-                    if isinstance(j, str) else j.write()
-                    for j in i
-                ]
-            ) for i in self.keyboard],
+            rows=[
+                raw.types.KeyboardButtonRow(
+                    buttons=[
+                        types.KeyboardButton(j).write()
+                        if isinstance(j, str)
+                        else j.write()
+                        for j in i
+                    ]
+                )
+                for i in self.keyboard
+            ],
             resize=self.resize_keyboard or None,
             single_use=self.one_time_keyboard or None,
             selective=self.selective or None,
             persistent=self.is_persistent or None,
-            placeholder=self.placeholder or None
+            placeholder=self.placeholder or None,
         )
diff --git a/pyrogram/types/bots_and_keyboards/reply_keyboard_remove.py b/pyrogram/types/bots_and_keyboards/reply_keyboard_remove.py
index 479efe902..071fc7e09 100644
--- a/pyrogram/types/bots_and_keyboards/reply_keyboard_remove.py
+++ b/pyrogram/types/bots_and_keyboards/reply_keyboard_remove.py
@@ -38,21 +38,14 @@ class ReplyKeyboardRemove(Object):
             keyboard for that user, while still showing the keyboard with poll options to users who haven't voted yet.
     """
 
-    def __init__(
-        self,
-        selective: bool = None
-    ):
+    def __init__(self, selective: bool = None):
         super().__init__()
 
         self.selective = selective
 
     @staticmethod
     def read(b):
-        return ReplyKeyboardRemove(
-            selective=b.selective
-        )
+        return ReplyKeyboardRemove(selective=b.selective)
 
     async def write(self, _: "pyrogram.Client"):
-        return raw.types.ReplyKeyboardHide(
-            selective=self.selective or None
-        )
+        return raw.types.ReplyKeyboardHide(selective=self.selective or None)
diff --git a/pyrogram/types/bots_and_keyboards/request_peer_type_channel.py b/pyrogram/types/bots_and_keyboards/request_peer_type_channel.py
index 87a4dd45e..884f341b1 100644
--- a/pyrogram/types/bots_and_keyboards/request_peer_type_channel.py
+++ b/pyrogram/types/bots_and_keyboards/request_peer_type_channel.py
@@ -28,14 +28,9 @@ class RequestPeerTypeChannel(Object):
 
         is_username (``bool``, *optional*):
             If True, show only Channel which has username.
-    """ # TODO user_admin_rights, bot_admin_rights
+    """  # TODO user_admin_rights, bot_admin_rights
 
-    def __init__(
-        self,
-        is_creator: bool=None,
-        is_username: bool=None,
-        max: int=1
-    ):
+    def __init__(self, is_creator: bool = None, is_username: bool = None, max: int = 1):
         super().__init__()
 
         self.is_creator = is_creator
diff --git a/pyrogram/types/bots_and_keyboards/request_peer_type_chat.py b/pyrogram/types/bots_and_keyboards/request_peer_type_chat.py
index 7249a9dc3..9accb19f4 100644
--- a/pyrogram/types/bots_and_keyboards/request_peer_type_chat.py
+++ b/pyrogram/types/bots_and_keyboards/request_peer_type_chat.py
@@ -34,15 +34,15 @@ class RequestPeerTypeChat(Object):
 
         is_forum (``bool``, *optional*):
             If True, show only Chat which is a forum.
-    """ # TODO user_admin_rights, bot_admin_rights
+    """  # TODO user_admin_rights, bot_admin_rights
 
     def __init__(
         self,
-        is_creator: bool=None,
-        is_bot_participant: bool=None,
-        is_username: bool=None,
-        is_forum: bool=None,
-        max: int=1
+        is_creator: bool = None,
+        is_bot_participant: bool = None,
+        is_username: bool = None,
+        is_forum: bool = None,
+        max: int = 1,
     ):
         super().__init__()
 
diff --git a/pyrogram/types/bots_and_keyboards/request_peer_type_user.py b/pyrogram/types/bots_and_keyboards/request_peer_type_user.py
index f11d35005..ebe053f07 100644
--- a/pyrogram/types/bots_and_keyboards/request_peer_type_user.py
+++ b/pyrogram/types/bots_and_keyboards/request_peer_type_user.py
@@ -30,12 +30,7 @@ class RequestPeerTypeUser(Object):
             If True, show only Premium Users.
     """
 
-    def __init__(
-        self,
-        is_bot: bool=None,
-        is_premium: bool=None,
-        max: int=1
-    ):
+    def __init__(self, is_bot: bool = None, is_premium: bool = None, max: int = 1):
         super().__init__()
 
         self.is_bot = is_bot
diff --git a/pyrogram/types/bots_and_keyboards/sent_web_app_message.py b/pyrogram/types/bots_and_keyboards/sent_web_app_message.py
index 8b1df1973..2eca287c0 100644
--- a/pyrogram/types/bots_and_keyboards/sent_web_app_message.py
+++ b/pyrogram/types/bots_and_keyboards/sent_web_app_message.py
@@ -30,7 +30,8 @@ class SentWebAppMessage(Object):
     """
 
     def __init__(
-        self, *,
+        self,
+        *,
         inline_message_id: str,
     ):
         super().__init__()
@@ -39,4 +40,6 @@ def __init__(
 
     @staticmethod
     def _parse(obj: "raw.types.WebViewMessageSent"):
-        return SentWebAppMessage(inline_message_id=utils.pack_inline_message_id(obj.msg_id))
+        return SentWebAppMessage(
+            inline_message_id=utils.pack_inline_message_id(obj.msg_id)
+        )
diff --git a/pyrogram/types/bots_and_keyboards/web_app_info.py b/pyrogram/types/bots_and_keyboards/web_app_info.py
index 1dbb0a781..d4a01fa29 100644
--- a/pyrogram/types/bots_and_keyboards/web_app_info.py
+++ b/pyrogram/types/bots_and_keyboards/web_app_info.py
@@ -29,7 +29,8 @@ class WebAppInfo(Object):
     """
 
     def __init__(
-        self, *,
+        self,
+        *,
         url: str,
     ):
         super().__init__()
diff --git a/pyrogram/types/inline_mode/__init__.py b/pyrogram/types/inline_mode/__init__.py
index f7323abf9..b970a2809 100644
--- a/pyrogram/types/inline_mode/__init__.py
+++ b/pyrogram/types/inline_mode/__init__.py
@@ -38,10 +38,24 @@
 from .inline_query_result_cached_audio import InlineQueryResultCachedAudio
 
 __all__ = [
-    "InlineQuery", "InlineQueryResult", "InlineQueryResultArticle", "InlineQueryResultPhoto",
-    "InlineQueryResultAnimation", "InlineQueryResultAudio", "InlineQueryResultVideo", "ChosenInlineResult",
-    "InlineQueryResultContact", "InlineQueryResultDocument", "InlineQueryResultVoice", "InlineQueryResultLocation",
-    "InlineQueryResultVenue", "InlineQueryResultCachedPhoto", "InlineQueryResultCachedAnimation",
-    "InlineQueryResultCachedSticker", "InlineQueryResultCachedDocument", "InlineQueryResultCachedVideo",
-    "InlineQueryResultCachedVoice", "InlineQueryResultCachedAudio"
+    "InlineQuery",
+    "InlineQueryResult",
+    "InlineQueryResultArticle",
+    "InlineQueryResultPhoto",
+    "InlineQueryResultAnimation",
+    "InlineQueryResultAudio",
+    "InlineQueryResultVideo",
+    "ChosenInlineResult",
+    "InlineQueryResultContact",
+    "InlineQueryResultDocument",
+    "InlineQueryResultVoice",
+    "InlineQueryResultLocation",
+    "InlineQueryResultVenue",
+    "InlineQueryResultCachedPhoto",
+    "InlineQueryResultCachedAnimation",
+    "InlineQueryResultCachedSticker",
+    "InlineQueryResultCachedDocument",
+    "InlineQueryResultCachedVideo",
+    "InlineQueryResultCachedVoice",
+    "InlineQueryResultCachedAudio",
 ]
diff --git a/pyrogram/types/inline_mode/chosen_inline_result.py b/pyrogram/types/inline_mode/chosen_inline_result.py
index 623d73793..9b91832a7 100644
--- a/pyrogram/types/inline_mode/chosen_inline_result.py
+++ b/pyrogram/types/inline_mode/chosen_inline_result.py
@@ -72,19 +72,25 @@ def __init__(
         self.inline_message_id = inline_message_id
 
     @staticmethod
-    def _parse(client, chosen_inline_result: raw.types.UpdateBotInlineSend, users) -> "ChosenInlineResult":
+    def _parse(
+        client, chosen_inline_result: raw.types.UpdateBotInlineSend, users
+    ) -> "ChosenInlineResult":
         inline_message_id = None
 
         if isinstance(chosen_inline_result.msg_id, raw.types.InputBotInlineMessageID):
-            inline_message_id = b64encode(
-                pack(
-                    " "InlineQuery":
         peer_type = inline_query.peer_type
         chat_type = None
 
@@ -101,9 +103,11 @@ def _parse(client, inline_query: raw.types.UpdateBotInlineQuery, users: dict) ->
             location=types.Location(
                 longitude=inline_query.geo.long,
                 latitude=inline_query.geo.lat,
-                client=client
-            ) if inline_query.geo else None,
-            client=client
+                client=client,
+            )
+            if inline_query.geo
+            else None,
+            client=client,
         )
 
     async def answer(
@@ -114,7 +118,7 @@ async def answer(
         is_personal: bool = False,
         next_offset: str = "",
         switch_pm_text: str = "",
-        switch_pm_parameter: str = ""
+        switch_pm_parameter: str = "",
     ):
         """Bound method *answer* of :obj:`~pyrogram.types.InlineQuery`.
 
@@ -177,5 +181,5 @@ async def answer(
             is_personal=is_personal,
             next_offset=next_offset,
             switch_pm_text=switch_pm_text,
-            switch_pm_parameter=switch_pm_parameter
+            switch_pm_parameter=switch_pm_parameter,
         )
diff --git a/pyrogram/types/inline_mode/inline_query_result.py b/pyrogram/types/inline_mode/inline_query_result.py
index 8548e023c..7807335b1 100644
--- a/pyrogram/types/inline_mode/inline_query_result.py
+++ b/pyrogram/types/inline_mode/inline_query_result.py
@@ -50,7 +50,7 @@ def __init__(
         type: str,
         id: str,
         input_message_content: "types.InputMessageContent",
-        reply_markup: "types.InlineKeyboardMarkup"
+        reply_markup: "types.InlineKeyboardMarkup",
     ):
         super().__init__()
 
diff --git a/pyrogram/types/inline_mode/inline_query_result_animation.py b/pyrogram/types/inline_mode/inline_query_result_animation.py
index 58ec72a54..af24df915 100644
--- a/pyrogram/types/inline_mode/inline_query_result_animation.py
+++ b/pyrogram/types/inline_mode/inline_query_result_animation.py
@@ -92,7 +92,7 @@ def __init__(
         parse_mode: Optional["enums.ParseMode"] = None,
         caption_entities: List["types.MessageEntity"] = None,
         reply_markup: "types.InlineKeyboardMarkup" = None,
-        input_message_content: "types.InputMessageContent" = None
+        input_message_content: "types.InputMessageContent" = None,
     ):
         super().__init__("gif", id, input_message_content, reply_markup)
 
@@ -119,9 +119,9 @@ async def write(self, client: "pyrogram.Client"):
                 raw.types.DocumentAttributeVideo(
                     w=self.animation_width,
                     h=self.animation_height,
-                    duration=self.animation_duration
+                    duration=self.animation_duration,
                 )
-            ]
+            ],
         )
 
         if self.thumb_url is None:
@@ -131,12 +131,14 @@ async def write(self, client: "pyrogram.Client"):
                 url=self.thumb_url,
                 size=0,
                 mime_type=self.thumb_mime_type,
-                attributes=[]
+                attributes=[],
             )
 
-        message, entities = (await utils.parse_text_entities(
-            client, self.caption, self.parse_mode, self.caption_entities
-        )).values()
+        message, entities = (
+            await utils.parse_text_entities(
+                client, self.caption, self.parse_mode, self.caption_entities
+            )
+        ).values()
 
         return raw.types.InputBotInlineResult(
             id=self.id,
@@ -148,9 +150,11 @@ async def write(self, client: "pyrogram.Client"):
                 await self.input_message_content.write(client, self.reply_markup)
                 if self.input_message_content
                 else raw.types.InputBotInlineMessageMediaAuto(
-                    reply_markup=await self.reply_markup.write(client) if self.reply_markup else None,
+                    reply_markup=await self.reply_markup.write(client)
+                    if self.reply_markup
+                    else None,
                     message=message,
-                    entities=entities
+                    entities=entities,
                 )
-            )
+            ),
         )
diff --git a/pyrogram/types/inline_mode/inline_query_result_article.py b/pyrogram/types/inline_mode/inline_query_result_article.py
index 096273f15..b279d754a 100644
--- a/pyrogram/types/inline_mode/inline_query_result_article.py
+++ b/pyrogram/types/inline_mode/inline_query_result_article.py
@@ -66,7 +66,7 @@ def __init__(
         reply_markup: "types.InlineKeyboardMarkup" = None,
         thumb_url: str = None,
         thumb_width: int = 0,
-        thumb_height: int = 0
+        thumb_height: int = 0,
     ):
         super().__init__("article", id, input_message_content, reply_markup)
 
@@ -81,7 +81,9 @@ async def write(self, client: "pyrogram.Client"):
         return raw.types.InputBotInlineResult(
             id=self.id,
             type=self.type,
-            send_message=await self.input_message_content.write(client, self.reply_markup),
+            send_message=await self.input_message_content.write(
+                client, self.reply_markup
+            ),
             title=self.title,
             description=self.description,
             url=self.url,
@@ -91,9 +93,10 @@ async def write(self, client: "pyrogram.Client"):
                 mime_type="image/jpeg",
                 attributes=[
                     raw.types.DocumentAttributeImageSize(
-                        w=self.thumb_width,
-                        h=self.thumb_height
+                        w=self.thumb_width, h=self.thumb_height
                     )
-                ]
-            ) if self.thumb_url else None
+                ],
+            )
+            if self.thumb_url
+            else None,
         )
diff --git a/pyrogram/types/inline_mode/inline_query_result_audio.py b/pyrogram/types/inline_mode/inline_query_result_audio.py
index 03e7b6da3..7a093d8db 100644
--- a/pyrogram/types/inline_mode/inline_query_result_audio.py
+++ b/pyrogram/types/inline_mode/inline_query_result_audio.py
@@ -25,31 +25,31 @@
 
 class InlineQueryResultAudio(InlineQueryResult):
     """Link to an audio file.
-    
+
     By default, this audio file will be sent by the user with optional caption.
     Alternatively, you can use *input_message_content* to send a message with the specified content instead of the
     audio.
-    
+
     Parameters:
         audio_url (``str``):
             A valid URL for the audio file.
-            
+
         title (``str``):
             Title for the result.
-            
+
         id (``str``, *optional*):
             Unique identifier for this result, 1-64 bytes.
             Defaults to a randomly generated UUID4.
-            
+
         performer (``str``, *optional*):
             Audio performer.
-            
+
         audio_duration (``int``, *optional*):
             Audio duration in seconds.
 
         caption (``str``, *optional*):
             Caption of the audio to be sent, 0-1024 characters.
-            
+
         parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
             By default, texts are parsed using both Markdown and HTML styles.
             You can combine both syntaxes together.
@@ -59,10 +59,10 @@ class InlineQueryResultAudio(InlineQueryResult):
 
         description (``str``, *optional*):
             Short description of the result.
-            
+
         reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
             Inline keyboard attached to the message.
-            
+
         input_message_content (:obj:`~pyrogram.types.InputMessageContent`, *optional*):
             Content of the message to be sent instead of the audio.
 
@@ -83,7 +83,7 @@ def __init__(
         description: str = None,
         reply_markup: "types.InlineKeyboardMarkup" = None,
         input_message_content: "types.InputMessageContent" = None,
-        thumb_url: str = None
+        thumb_url: str = None,
     ):
         super().__init__("audio", id, input_message_content, reply_markup)
 
@@ -102,16 +102,20 @@ async def write(self, client: "pyrogram.Client"):
             url=self.audio_url,
             size=0,
             mime_type="audio/mpeg",
-            attributes=[raw.types.DocumentAttributeAudio(
-                duration=self.audio_duration,
-                title=self.title,
-                performer=self.performer
-            )]
+            attributes=[
+                raw.types.DocumentAttributeAudio(
+                    duration=self.audio_duration,
+                    title=self.title,
+                    performer=self.performer,
+                )
+            ],
         )
 
-        message, entities = (await utils.parse_text_entities(
-            client, self.caption, self.parse_mode, self.caption_entities
-        )).values()
+        message, entities = (
+            await utils.parse_text_entities(
+                client, self.caption, self.parse_mode, self.caption_entities
+            )
+        ).values()
 
         return raw.types.InputBotInlineResult(
             id=self.id,
@@ -120,18 +124,19 @@ async def write(self, client: "pyrogram.Client"):
             content=audio,
             description=self.description,
             thumb=raw.types.InputWebDocument(
-                url=self.thumb_url,
-                size=0,
-                mime_type="image/jpeg",
-                attributes=[]
-            ) if self.thumb_url else None,
+                url=self.thumb_url, size=0, mime_type="image/jpeg", attributes=[]
+            )
+            if self.thumb_url
+            else None,
             send_message=(
                 await self.input_message_content.write(client, self.reply_markup)
                 if self.input_message_content
                 else raw.types.InputBotInlineMessageMediaAuto(
-                    reply_markup=await self.reply_markup.write(client) if self.reply_markup else None,
+                    reply_markup=await self.reply_markup.write(client)
+                    if self.reply_markup
+                    else None,
                     message=message,
-                    entities=entities
+                    entities=entities,
                 )
-            )
+            ),
         )
diff --git a/pyrogram/types/inline_mode/inline_query_result_cached_animation.py b/pyrogram/types/inline_mode/inline_query_result_cached_animation.py
index 63e58ca02..825bb0b38 100644
--- a/pyrogram/types/inline_mode/inline_query_result_cached_animation.py
+++ b/pyrogram/types/inline_mode/inline_query_result_cached_animation.py
@@ -68,7 +68,7 @@ def __init__(
         parse_mode: Optional["enums.ParseMode"] = None,
         caption_entities: List["types.MessageEntity"] = None,
         reply_markup: "types.InlineKeyboardMarkup" = None,
-        input_message_content: "types.InputMessageContent" = None
+        input_message_content: "types.InputMessageContent" = None,
     ):
         super().__init__("gif", id, input_message_content, reply_markup)
 
@@ -81,9 +81,11 @@ def __init__(
         self.input_message_content = input_message_content
 
     async def write(self, client: "pyrogram.Client"):
-        message, entities = (await utils.parse_text_entities(
-            client, self.caption, self.parse_mode, self.caption_entities
-        )).values()
+        message, entities = (
+            await utils.parse_text_entities(
+                client, self.caption, self.parse_mode, self.caption_entities
+            )
+        ).values()
 
         file_id = FileId.decode(self.animation_file_id)
 
@@ -100,9 +102,11 @@ async def write(self, client: "pyrogram.Client"):
                 await self.input_message_content.write(client, self.reply_markup)
                 if self.input_message_content
                 else raw.types.InputBotInlineMessageMediaAuto(
-                    reply_markup=await self.reply_markup.write(client) if self.reply_markup else None,
+                    reply_markup=await self.reply_markup.write(client)
+                    if self.reply_markup
+                    else None,
                     message=message,
-                    entities=entities
+                    entities=entities,
                 )
-            )
+            ),
         )
diff --git a/pyrogram/types/inline_mode/inline_query_result_cached_audio.py b/pyrogram/types/inline_mode/inline_query_result_cached_audio.py
index 9535f6334..f6ce0ec58 100644
--- a/pyrogram/types/inline_mode/inline_query_result_cached_audio.py
+++ b/pyrogram/types/inline_mode/inline_query_result_cached_audio.py
@@ -63,7 +63,7 @@ def __init__(
         parse_mode: Optional["enums.ParseMode"] = None,
         caption_entities: List["types.MessageEntity"] = None,
         reply_markup: "types.InlineKeyboardMarkup" = None,
-        input_message_content: "types.InputMessageContent" = None
+        input_message_content: "types.InputMessageContent" = None,
     ):
         super().__init__("audio", id, input_message_content, reply_markup)
 
@@ -75,9 +75,11 @@ def __init__(
         self.input_message_content = input_message_content
 
     async def write(self, client: "pyrogram.Client"):
-        message, entities = (await utils.parse_text_entities(
-            client, self.caption, self.parse_mode, self.caption_entities
-        )).values()
+        message, entities = (
+            await utils.parse_text_entities(
+                client, self.caption, self.parse_mode, self.caption_entities
+            )
+        ).values()
 
         file_id = FileId.decode(self.audio_file_id)
 
@@ -93,9 +95,11 @@ async def write(self, client: "pyrogram.Client"):
                 await self.input_message_content.write(client, self.reply_markup)
                 if self.input_message_content
                 else raw.types.InputBotInlineMessageMediaAuto(
-                    reply_markup=await self.reply_markup.write(client) if self.reply_markup else None,
+                    reply_markup=await self.reply_markup.write(client)
+                    if self.reply_markup
+                    else None,
                     message=message,
-                    entities=entities
+                    entities=entities,
                 )
-            )
+            ),
         )
diff --git a/pyrogram/types/inline_mode/inline_query_result_cached_document.py b/pyrogram/types/inline_mode/inline_query_result_cached_document.py
index 2ab190e7f..02e66b068 100644
--- a/pyrogram/types/inline_mode/inline_query_result_cached_document.py
+++ b/pyrogram/types/inline_mode/inline_query_result_cached_document.py
@@ -71,7 +71,7 @@ def __init__(
         parse_mode: Optional["enums.ParseMode"] = None,
         caption_entities: List["types.MessageEntity"] = None,
         reply_markup: "types.InlineKeyboardMarkup" = None,
-        input_message_content: "types.InputMessageContent" = None
+        input_message_content: "types.InputMessageContent" = None,
     ):
         super().__init__("file", id, input_message_content, reply_markup)
 
@@ -85,9 +85,11 @@ def __init__(
         self.input_message_content = input_message_content
 
     async def write(self, client: "pyrogram.Client"):
-        message, entities = (await utils.parse_text_entities(
-            client, self.caption, self.parse_mode, self.caption_entities
-        )).values()
+        message, entities = (
+            await utils.parse_text_entities(
+                client, self.caption, self.parse_mode, self.caption_entities
+            )
+        ).values()
 
         file_id = FileId.decode(self.document_file_id)
 
@@ -105,9 +107,11 @@ async def write(self, client: "pyrogram.Client"):
                 await self.input_message_content.write(client, self.reply_markup)
                 if self.input_message_content
                 else raw.types.InputBotInlineMessageMediaAuto(
-                    reply_markup=await self.reply_markup.write(client) if self.reply_markup else None,
+                    reply_markup=await self.reply_markup.write(client)
+                    if self.reply_markup
+                    else None,
                     message=message,
-                    entities=entities
+                    entities=entities,
                 )
-            )
+            ),
         )
diff --git a/pyrogram/types/inline_mode/inline_query_result_cached_photo.py b/pyrogram/types/inline_mode/inline_query_result_cached_photo.py
index 2e01d344e..e5abd726c 100644
--- a/pyrogram/types/inline_mode/inline_query_result_cached_photo.py
+++ b/pyrogram/types/inline_mode/inline_query_result_cached_photo.py
@@ -71,7 +71,7 @@ def __init__(
         parse_mode: Optional["enums.ParseMode"] = None,
         caption_entities: List["types.MessageEntity"] = None,
         reply_markup: "types.InlineKeyboardMarkup" = None,
-        input_message_content: "types.InputMessageContent" = None
+        input_message_content: "types.InputMessageContent" = None,
     ):
         super().__init__("photo", id, input_message_content, reply_markup)
 
@@ -85,9 +85,11 @@ def __init__(
         self.input_message_content = input_message_content
 
     async def write(self, client: "pyrogram.Client"):
-        message, entities = (await utils.parse_text_entities(
-            client, self.caption, self.parse_mode, self.caption_entities
-        )).values()
+        message, entities = (
+            await utils.parse_text_entities(
+                client, self.caption, self.parse_mode, self.caption_entities
+            )
+        ).values()
 
         file_id = FileId.decode(self.photo_file_id)
 
@@ -103,9 +105,11 @@ async def write(self, client: "pyrogram.Client"):
                 await self.input_message_content.write(client, self.reply_markup)
                 if self.input_message_content
                 else raw.types.InputBotInlineMessageMediaAuto(
-                    reply_markup=await self.reply_markup.write(client) if self.reply_markup else None,
+                    reply_markup=await self.reply_markup.write(client)
+                    if self.reply_markup
+                    else None,
                     message=message,
-                    entities=entities
+                    entities=entities,
                 )
-            )
+            ),
         )
diff --git a/pyrogram/types/inline_mode/inline_query_result_cached_sticker.py b/pyrogram/types/inline_mode/inline_query_result_cached_sticker.py
index 06d012fbe..10b2980c9 100644
--- a/pyrogram/types/inline_mode/inline_query_result_cached_sticker.py
+++ b/pyrogram/types/inline_mode/inline_query_result_cached_sticker.py
@@ -48,7 +48,7 @@ def __init__(
         sticker_file_id: str,
         id: str = None,
         reply_markup: "types.InlineKeyboardMarkup" = None,
-        input_message_content: "types.InputMessageContent" = None
+        input_message_content: "types.InputMessageContent" = None,
     ):
         super().__init__("sticker", id, input_message_content, reply_markup)
 
@@ -71,8 +71,10 @@ async def write(self, client: "pyrogram.Client"):
                 await self.input_message_content.write(client, self.reply_markup)
                 if self.input_message_content
                 else raw.types.InputBotInlineMessageMediaAuto(
-                    reply_markup=await self.reply_markup.write(client) if self.reply_markup else None,
+                    reply_markup=await self.reply_markup.write(client)
+                    if self.reply_markup
+                    else None,
                     message="",
                 )
-            )
+            ),
         )
diff --git a/pyrogram/types/inline_mode/inline_query_result_cached_video.py b/pyrogram/types/inline_mode/inline_query_result_cached_video.py
index 00ea32ecd..e3d41b594 100644
--- a/pyrogram/types/inline_mode/inline_query_result_cached_video.py
+++ b/pyrogram/types/inline_mode/inline_query_result_cached_video.py
@@ -72,7 +72,7 @@ def __init__(
         parse_mode: Optional["enums.ParseMode"] = None,
         caption_entities: List["types.MessageEntity"] = None,
         reply_markup: "types.InlineKeyboardMarkup" = None,
-        input_message_content: "types.InputMessageContent" = None
+        input_message_content: "types.InputMessageContent" = None,
     ):
         super().__init__("video", id, input_message_content, reply_markup)
 
@@ -86,9 +86,11 @@ def __init__(
         self.input_message_content = input_message_content
 
     async def write(self, client: "pyrogram.Client"):
-        message, entities = (await utils.parse_text_entities(
-            client, self.caption, self.parse_mode, self.caption_entities
-        )).values()
+        message, entities = (
+            await utils.parse_text_entities(
+                client, self.caption, self.parse_mode, self.caption_entities
+            )
+        ).values()
 
         file_id = FileId.decode(self.video_file_id)
 
@@ -106,9 +108,11 @@ async def write(self, client: "pyrogram.Client"):
                 await self.input_message_content.write(client, self.reply_markup)
                 if self.input_message_content
                 else raw.types.InputBotInlineMessageMediaAuto(
-                    reply_markup=await self.reply_markup.write(client) if self.reply_markup else None,
+                    reply_markup=await self.reply_markup.write(client)
+                    if self.reply_markup
+                    else None,
                     message=message,
-                    entities=entities
+                    entities=entities,
                 )
-            )
+            ),
         )
diff --git a/pyrogram/types/inline_mode/inline_query_result_cached_voice.py b/pyrogram/types/inline_mode/inline_query_result_cached_voice.py
index cc2bd7685..ffbd26477 100644
--- a/pyrogram/types/inline_mode/inline_query_result_cached_voice.py
+++ b/pyrogram/types/inline_mode/inline_query_result_cached_voice.py
@@ -68,7 +68,7 @@ def __init__(
         parse_mode: Optional["enums.ParseMode"] = None,
         caption_entities: List["types.MessageEntity"] = None,
         reply_markup: "types.InlineKeyboardMarkup" = None,
-        input_message_content: "types.InputMessageContent" = None
+        input_message_content: "types.InputMessageContent" = None,
     ):
         super().__init__("voice", id, input_message_content, reply_markup)
 
@@ -81,9 +81,11 @@ def __init__(
         self.input_message_content = input_message_content
 
     async def write(self, client: "pyrogram.Client"):
-        message, entities = (await utils.parse_text_entities(
-            client, self.caption, self.parse_mode, self.caption_entities
-        )).values()
+        message, entities = (
+            await utils.parse_text_entities(
+                client, self.caption, self.parse_mode, self.caption_entities
+            )
+        ).values()
 
         file_id = FileId.decode(self.voice_file_id)
 
@@ -100,9 +102,11 @@ async def write(self, client: "pyrogram.Client"):
                 await self.input_message_content.write(client, self.reply_markup)
                 if self.input_message_content
                 else raw.types.InputBotInlineMessageMediaAuto(
-                    reply_markup=await self.reply_markup.write(client) if self.reply_markup else None,
+                    reply_markup=await self.reply_markup.write(client)
+                    if self.reply_markup
+                    else None,
                     message=message,
-                    entities=entities
+                    entities=entities,
                 )
-            )
+            ),
         )
diff --git a/pyrogram/types/inline_mode/inline_query_result_contact.py b/pyrogram/types/inline_mode/inline_query_result_contact.py
index d55a62445..f2e94a5be 100644
--- a/pyrogram/types/inline_mode/inline_query_result_contact.py
+++ b/pyrogram/types/inline_mode/inline_query_result_contact.py
@@ -23,11 +23,11 @@
 
 class InlineQueryResultContact(InlineQueryResult):
     """Contact with a phone number
-    
+
     By default, this contact will be sent by the user.
     Alternatively, you can use *input_message_content* to send a message with the specified content instead of the
     contact.
-    
+
     Parameters:
         phone_number (``str``):
             Contact's phone number.
@@ -47,7 +47,7 @@ class InlineQueryResultContact(InlineQueryResult):
 
         reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
             Inline keyboard attached to the message.
-            
+
         input_message_content (:obj:`~pyrogram.types.InputMessageContent`, *optional*):
             Content of the message to be sent instead of the contact.
 
@@ -72,7 +72,7 @@ def __init__(
         input_message_content: "types.InputMessageContent" = None,
         thumb_url: str = None,
         thumb_width: int = 0,
-        thumb_height: int = 0
+        thumb_height: int = 0,
     ):
         super().__init__("contact", id, input_message_content, reply_markup)
 
@@ -97,7 +97,9 @@ async def write(self, client: "pyrogram.Client"):
                     first_name=self.first_name,
                     last_name=self.last_name,
                     vcard=self.vcard,
-                    reply_markup=await self.reply_markup.write(client) if self.reply_markup else None,
+                    reply_markup=await self.reply_markup.write(client)
+                    if self.reply_markup
+                    else None,
                 )
             ),
             thumb=raw.types.InputWebDocument(
@@ -106,9 +108,10 @@ async def write(self, client: "pyrogram.Client"):
                 mime_type="image/jpg",
                 attributes=[
                     raw.types.DocumentAttributeImageSize(
-                        w=self.thumb_width,
-                        h=self.thumb_height
+                        w=self.thumb_width, h=self.thumb_height
                     )
-                ]
-            ) if self.thumb_url else None
+                ],
+            )
+            if self.thumb_url
+            else None,
         )
diff --git a/pyrogram/types/inline_mode/inline_query_result_document.py b/pyrogram/types/inline_mode/inline_query_result_document.py
index eac7901b1..392bd26b1 100644
--- a/pyrogram/types/inline_mode/inline_query_result_document.py
+++ b/pyrogram/types/inline_mode/inline_query_result_document.py
@@ -87,7 +87,7 @@ def __init__(
         input_message_content: "types.InputMessageContent" = None,
         thumb_url: str = None,
         thumb_width: int = 0,
-        thumb_height: int = 0
+        thumb_height: int = 0,
     ):
         super().__init__("file", id, input_message_content, reply_markup)
 
@@ -104,27 +104,29 @@ def __init__(
 
     async def write(self, client: "pyrogram.Client"):
         document = raw.types.InputWebDocument(
-            url=self.document_url,
-            size=0,
-            mime_type=self.mime_type,
-            attributes=[]
+            url=self.document_url, size=0, mime_type=self.mime_type, attributes=[]
         )
 
-        thumb = raw.types.InputWebDocument(
-            url=self.thumb_url,
-            size=0,
-            mime_type="image/jpeg",
-            attributes=[
-                raw.types.DocumentAttributeImageSize(
-                    w=self.thumb_width,
-                    h=self.thumb_height
-                )
-            ]
-        ) if self.thumb_url else None
+        thumb = (
+            raw.types.InputWebDocument(
+                url=self.thumb_url,
+                size=0,
+                mime_type="image/jpeg",
+                attributes=[
+                    raw.types.DocumentAttributeImageSize(
+                        w=self.thumb_width, h=self.thumb_height
+                    )
+                ],
+            )
+            if self.thumb_url
+            else None
+        )
 
-        message, entities = (await utils.parse_text_entities(
-            client, self.caption, self.parse_mode, self.caption_entities
-        )).values()
+        message, entities = (
+            await utils.parse_text_entities(
+                client, self.caption, self.parse_mode, self.caption_entities
+            )
+        ).values()
 
         return raw.types.InputBotInlineResult(
             id=self.id,
@@ -137,9 +139,11 @@ async def write(self, client: "pyrogram.Client"):
                 await self.input_message_content.write(client, self.reply_markup)
                 if self.input_message_content
                 else raw.types.InputBotInlineMessageMediaAuto(
-                    reply_markup=await self.reply_markup.write(client) if self.reply_markup else None,
+                    reply_markup=await self.reply_markup.write(client)
+                    if self.reply_markup
+                    else None,
                     message=message,
-                    entities=entities
+                    entities=entities,
                 )
-            )
+            ),
         )
diff --git a/pyrogram/types/inline_mode/inline_query_result_location.py b/pyrogram/types/inline_mode/inline_query_result_location.py
index 236f39a62..538d53dd5 100644
--- a/pyrogram/types/inline_mode/inline_query_result_location.py
+++ b/pyrogram/types/inline_mode/inline_query_result_location.py
@@ -85,7 +85,7 @@ def __init__(
         input_message_content: "types.InputMessageContent" = None,
         thumb_url: str = None,
         thumb_width: int = 0,
-        thumb_height: int = 0
+        thumb_height: int = 0,
     ):
         super().__init__("location", id, input_message_content, reply_markup)
 
@@ -110,13 +110,14 @@ async def write(self, client: "pyrogram.Client"):
                 if self.input_message_content
                 else raw.types.InputBotInlineMessageMediaGeo(
                     geo_point=raw.types.InputGeoPoint(
-                        lat=self.latitude,
-                        long=self.longitude
+                        lat=self.latitude, long=self.longitude
                     ),
                     heading=self.heading,
                     period=self.live_period,
                     proximity_notification_radius=self.proximity_alert_radius,
-                    reply_markup=await self.reply_markup.write(client) if self.reply_markup else None
+                    reply_markup=await self.reply_markup.write(client)
+                    if self.reply_markup
+                    else None,
                 )
-            )
+            ),
         )
diff --git a/pyrogram/types/inline_mode/inline_query_result_photo.py b/pyrogram/types/inline_mode/inline_query_result_photo.py
index d75ccac2a..8b753a9e7 100644
--- a/pyrogram/types/inline_mode/inline_query_result_photo.py
+++ b/pyrogram/types/inline_mode/inline_query_result_photo.py
@@ -85,7 +85,7 @@ def __init__(
         parse_mode: Optional["enums.ParseMode"] = None,
         caption_entities: List["types.MessageEntity"] = None,
         reply_markup: "types.InlineKeyboardMarkup" = None,
-        input_message_content: "types.InputMessageContent" = None
+        input_message_content: "types.InputMessageContent" = None,
     ):
         super().__init__("photo", id, input_message_content, reply_markup)
 
@@ -108,25 +108,23 @@ async def write(self, client: "pyrogram.Client"):
             mime_type="image/jpeg",
             attributes=[
                 raw.types.DocumentAttributeImageSize(
-                    w=self.photo_width,
-                    h=self.photo_height
+                    w=self.photo_width, h=self.photo_height
                 )
-            ]
+            ],
         )
 
         if self.thumb_url is None:
             thumb = photo
         else:
             thumb = raw.types.InputWebDocument(
-                url=self.thumb_url,
-                size=0,
-                mime_type="image/jpeg",
-                attributes=[]
+                url=self.thumb_url, size=0, mime_type="image/jpeg", attributes=[]
             )
 
-        message, entities = (await utils.parse_text_entities(
-            client, self.caption, self.parse_mode, self.caption_entities
-        )).values()
+        message, entities = (
+            await utils.parse_text_entities(
+                client, self.caption, self.parse_mode, self.caption_entities
+            )
+        ).values()
 
         return raw.types.InputBotInlineResult(
             id=self.id,
@@ -139,9 +137,11 @@ async def write(self, client: "pyrogram.Client"):
                 await self.input_message_content.write(client, self.reply_markup)
                 if self.input_message_content
                 else raw.types.InputBotInlineMessageMediaAuto(
-                    reply_markup=await self.reply_markup.write(client) if self.reply_markup else None,
+                    reply_markup=await self.reply_markup.write(client)
+                    if self.reply_markup
+                    else None,
                     message=message,
-                    entities=entities
+                    entities=entities,
                 )
-            )
+            ),
         )
diff --git a/pyrogram/types/inline_mode/inline_query_result_venue.py b/pyrogram/types/inline_mode/inline_query_result_venue.py
index b3b513a55..863061d7d 100644
--- a/pyrogram/types/inline_mode/inline_query_result_venue.py
+++ b/pyrogram/types/inline_mode/inline_query_result_venue.py
@@ -87,7 +87,7 @@ def __init__(
         input_message_content: "types.InputMessageContent" = None,
         thumb_url: str = None,
         thumb_width: int = 0,
-        thumb_height: int = 0
+        thumb_height: int = 0,
     ):
         super().__init__("venue", id, input_message_content, reply_markup)
 
@@ -113,19 +113,22 @@ async def write(self, client: "pyrogram.Client"):
                 if self.input_message_content
                 else raw.types.InputBotInlineMessageMediaVenue(
                     geo_point=raw.types.InputGeoPoint(
-                        lat=self.latitude,
-                        long=self.longitude
+                        lat=self.latitude, long=self.longitude
                     ),
                     title=self.title,
                     address=self.address,
                     provider=(
-                        "foursquare" if self.foursquare_id or self.foursquare_type
-                        else "google" if self.google_place_id or self.google_place_type
+                        "foursquare"
+                        if self.foursquare_id or self.foursquare_type
+                        else "google"
+                        if self.google_place_id or self.google_place_type
                         else ""
                     ),
                     venue_id=self.foursquare_id or self.google_place_id or "",
                     venue_type=self.foursquare_type or self.google_place_type or "",
-                    reply_markup=await self.reply_markup.write(client) if self.reply_markup else None
+                    reply_markup=await self.reply_markup.write(client)
+                    if self.reply_markup
+                    else None,
                 )
-            )
+            ),
         )
diff --git a/pyrogram/types/inline_mode/inline_query_result_video.py b/pyrogram/types/inline_mode/inline_query_result_video.py
index 5f71111f4..6bd49070e 100644
--- a/pyrogram/types/inline_mode/inline_query_result_video.py
+++ b/pyrogram/types/inline_mode/inline_query_result_video.py
@@ -93,7 +93,7 @@ def __init__(
         parse_mode: Optional["enums.ParseMode"] = None,
         caption_entities: List["types.MessageEntity"] = None,
         reply_markup: "types.InlineKeyboardMarkup" = None,
-        input_message_content: "types.InputMessageContent" = None
+        input_message_content: "types.InputMessageContent" = None,
     ):
         super().__init__("video", id, input_message_content, reply_markup)
 
@@ -114,23 +114,24 @@ async def write(self, client: "pyrogram.Client"):
             url=self.video_url,
             size=0,
             mime_type=self.mime_type,
-            attributes=[raw.types.DocumentAttributeVideo(
-                duration=self.video_duration,
-                w=self.video_width,
-                h=self.video_height
-            )]
+            attributes=[
+                raw.types.DocumentAttributeVideo(
+                    duration=self.video_duration,
+                    w=self.video_width,
+                    h=self.video_height,
+                )
+            ],
         )
 
         thumb = raw.types.InputWebDocument(
-            url=self.thumb_url,
-            size=0,
-            mime_type="image/jpeg",
-            attributes=[]
+            url=self.thumb_url, size=0, mime_type="image/jpeg", attributes=[]
         )
 
-        message, entities = (await utils.parse_text_entities(
-            client, self.caption, self.parse_mode, self.caption_entities
-        )).values()
+        message, entities = (
+            await utils.parse_text_entities(
+                client, self.caption, self.parse_mode, self.caption_entities
+            )
+        ).values()
 
         return raw.types.InputBotInlineResult(
             id=self.id,
@@ -143,9 +144,11 @@ async def write(self, client: "pyrogram.Client"):
                 await self.input_message_content.write(client, self.reply_markup)
                 if self.input_message_content
                 else raw.types.InputBotInlineMessageMediaAuto(
-                    reply_markup=await self.reply_markup.write(client) if self.reply_markup else None,
+                    reply_markup=await self.reply_markup.write(client)
+                    if self.reply_markup
+                    else None,
                     message=message,
-                    entities=entities
+                    entities=entities,
                 )
-            )
+            ),
         )
diff --git a/pyrogram/types/inline_mode/inline_query_result_voice.py b/pyrogram/types/inline_mode/inline_query_result_voice.py
index 31b422f8d..22799f9cd 100644
--- a/pyrogram/types/inline_mode/inline_query_result_voice.py
+++ b/pyrogram/types/inline_mode/inline_query_result_voice.py
@@ -25,38 +25,38 @@
 
 class InlineQueryResultVoice(InlineQueryResult):
     """Link to a voice recording in an .OGG container encoded with OPUS.
-    
+
     By default, this voice recording will be sent by the user.
     Alternatively, you can use *input_message_content* to send a message with the specified content instead of the
     voice message.
-    
+
     Parameters:
         voice_url (``str``):
             A valid URL for the voice recording.
-            
+
         title (``str``):
             Title for the result.
-            
+
         id (``str``, *optional*):
             Unique identifier for this result, 1-64 bytes.
             Defaults to a randomly generated UUID4.
-            
+
         voice_duration (``int``, *optional*):
             Recording duration in seconds.
 
         caption (``str``, *optional*):
             Caption of the audio to be sent, 0-1024 characters.
-            
+
         parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
             By default, texts are parsed using both Markdown and HTML styles.
             You can combine both syntaxes together.
 
         caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
             List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
-            
+
         reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
             Inline keyboard attached to the message.
-            
+
         input_message_content (:obj:`~pyrogram.types.InputMessageContent`, *optional*):
             Content of the message to be sent instead of the audio.
     """
@@ -71,7 +71,7 @@ def __init__(
         parse_mode: Optional["enums.ParseMode"] = None,
         caption_entities: List["types.MessageEntity"] = None,
         reply_markup: "types.InlineKeyboardMarkup" = None,
-        input_message_content: "types.InputMessageContent" = None
+        input_message_content: "types.InputMessageContent" = None,
     ):
         super().__init__("voice", id, input_message_content, reply_markup)
 
@@ -87,15 +87,19 @@ async def write(self, client: "pyrogram.Client"):
             url=self.voice_url,
             size=0,
             mime_type="audio/mpeg",
-            attributes=[raw.types.DocumentAttributeAudio(
-                duration=self.voice_duration,
-                title=self.title,
-            )]
+            attributes=[
+                raw.types.DocumentAttributeAudio(
+                    duration=self.voice_duration,
+                    title=self.title,
+                )
+            ],
         )
 
-        message, entities = (await utils.parse_text_entities(
-            client, self.caption, self.parse_mode, self.caption_entities
-        )).values()
+        message, entities = (
+            await utils.parse_text_entities(
+                client, self.caption, self.parse_mode, self.caption_entities
+            )
+        ).values()
 
         return raw.types.InputBotInlineResult(
             id=self.id,
@@ -106,9 +110,11 @@ async def write(self, client: "pyrogram.Client"):
                 await self.input_message_content.write(client, self.reply_markup)
                 if self.input_message_content
                 else raw.types.InputBotInlineMessageMediaAuto(
-                    reply_markup=await self.reply_markup.write(client) if self.reply_markup else None,
+                    reply_markup=await self.reply_markup.write(client)
+                    if self.reply_markup
+                    else None,
                     message=message,
-                    entities=entities
+                    entities=entities,
                 )
-            )
+            ),
         )
diff --git a/pyrogram/types/input_media/__init__.py b/pyrogram/types/input_media/__init__.py
index 6f7447db1..99b4956b7 100644
--- a/pyrogram/types/input_media/__init__.py
+++ b/pyrogram/types/input_media/__init__.py
@@ -27,6 +27,13 @@
 from .input_media_area_channel_post import InputMediaAreaChannelPost
 
 __all__ = [
-    "InputMedia", "InputMediaAnimation", "InputMediaAudio", "InputMediaDocument", "InputMediaPhoto", "InputMediaVideo",
-    "InputPhoneContact", "InputMediaArea", "InputMediaAreaChannelPost"
+    "InputMedia",
+    "InputMediaAnimation",
+    "InputMediaAudio",
+    "InputMediaDocument",
+    "InputMediaPhoto",
+    "InputMediaVideo",
+    "InputPhoneContact",
+    "InputMediaArea",
+    "InputMediaAreaChannelPost",
 ]
diff --git a/pyrogram/types/input_media/input_media.py b/pyrogram/types/input_media/input_media.py
index bd60aeb3e..76baa6a5e 100644
--- a/pyrogram/types/input_media/input_media.py
+++ b/pyrogram/types/input_media/input_media.py
@@ -39,7 +39,7 @@ def __init__(
         media: Union[str, BinaryIO],
         caption: str = "",
         parse_mode: str = None,
-        caption_entities: List[MessageEntity] = None
+        caption_entities: List[MessageEntity] = None,
     ):
         super().__init__()
 
diff --git a/pyrogram/types/input_media/input_media_animation.py b/pyrogram/types/input_media/input_media_animation.py
index 2e91a2147..dd5245f56 100644
--- a/pyrogram/types/input_media/input_media_animation.py
+++ b/pyrogram/types/input_media/input_media_animation.py
@@ -74,7 +74,7 @@ def __init__(
         width: int = 0,
         height: int = 0,
         duration: int = 0,
-        has_spoiler: bool = None
+        has_spoiler: bool = None,
     ):
         super().__init__(media, caption, parse_mode, caption_entities)
 
diff --git a/pyrogram/types/input_media/input_media_area.py b/pyrogram/types/input_media/input_media_area.py
index 48f5f9639..4e7e3358b 100644
--- a/pyrogram/types/input_media/input_media_area.py
+++ b/pyrogram/types/input_media/input_media_area.py
@@ -31,10 +31,7 @@ class InputMediaArea(Object):
 
     # TODO: InputMediaAreaVenue
 
-    def __init__(
-        self,
-        coordinates: "types.MediaAreaCoordinates"
-    ):
+    def __init__(self, coordinates: "types.MediaAreaCoordinates"):
         super().__init__()
 
         self.coordinates = coordinates
diff --git a/pyrogram/types/input_media/input_media_area_channel_post.py b/pyrogram/types/input_media/input_media_area_channel_post.py
index 64eed2776..e74fd9e7a 100644
--- a/pyrogram/types/input_media/input_media_area_channel_post.py
+++ b/pyrogram/types/input_media/input_media_area_channel_post.py
@@ -24,6 +24,7 @@
 
 from typing import Union
 
+
 class InputMediaAreaChannelPost(InputMediaArea):
     """A channel post media area.
 
@@ -42,7 +43,7 @@ def __init__(
         self,
         coordinates: "types.MediaAreaCoordinates",
         chat_id: Union[int, str],
-        message_id: int
+        message_id: int,
     ):
         super().__init__(coordinates=coordinates)
 
@@ -54,5 +55,5 @@ async def write(self, client: "pyrogram.Client"):
         return raw.types.InputMediaAreaChannelPost(
             coordinates=self.coordinates,
             channel=await client.resolve_peer(self.chat_id),
-            msg_id=self.message_id
+            msg_id=self.message_id,
         )
diff --git a/pyrogram/types/input_media/input_media_audio.py b/pyrogram/types/input_media/input_media_audio.py
index cc91e7bd5..891a7a2b4 100644
--- a/pyrogram/types/input_media/input_media_audio.py
+++ b/pyrogram/types/input_media/input_media_audio.py
@@ -72,7 +72,7 @@ def __init__(
         caption_entities: List[MessageEntity] = None,
         duration: int = 0,
         performer: str = "",
-        title: str = ""
+        title: str = "",
     ):
         super().__init__(media, caption, parse_mode, caption_entities)
 
diff --git a/pyrogram/types/input_media/input_media_document.py b/pyrogram/types/input_media/input_media_document.py
index 3e4d510b9..1329421ee 100644
--- a/pyrogram/types/input_media/input_media_document.py
+++ b/pyrogram/types/input_media/input_media_document.py
@@ -58,7 +58,7 @@ def __init__(
         thumb: str = None,
         caption: str = "",
         parse_mode: Optional["enums.ParseMode"] = None,
-        caption_entities: List[MessageEntity] = None
+        caption_entities: List[MessageEntity] = None,
     ):
         super().__init__(media, caption, parse_mode, caption_entities)
 
diff --git a/pyrogram/types/input_media/input_media_photo.py b/pyrogram/types/input_media/input_media_photo.py
index f4fd0e030..2a70a0dc3 100644
--- a/pyrogram/types/input_media/input_media_photo.py
+++ b/pyrogram/types/input_media/input_media_photo.py
@@ -56,7 +56,7 @@ def __init__(
         caption: str = "",
         parse_mode: Optional["enums.ParseMode"] = None,
         caption_entities: List[MessageEntity] = None,
-        has_spoiler: bool = None
+        has_spoiler: bool = None,
     ):
         super().__init__(media, caption, parse_mode, caption_entities)
 
diff --git a/pyrogram/types/input_media/input_phone_contact.py b/pyrogram/types/input_media/input_phone_contact.py
index 0608cf217..7140bbdb8 100644
--- a/pyrogram/types/input_media/input_phone_contact.py
+++ b/pyrogram/types/input_media/input_phone_contact.py
@@ -39,13 +39,10 @@ class InputPhoneContact(Object):
     def __init__(self, phone: str, first_name: str, last_name: str = ""):
         super().__init__(None)
 
-    def __new__(cls,
-                phone: str,
-                first_name: str,
-                last_name: str = ""):
+    def __new__(cls, phone: str, first_name: str, last_name: str = ""):
         return raw.types.InputPhoneContact(
             client_id=MsgId(),
             phone="+" + phone.strip("+"),
             first_name=first_name,
-            last_name=last_name
+            last_name=last_name,
         )
diff --git a/pyrogram/types/input_message_content/__init__.py b/pyrogram/types/input_message_content/__init__.py
index ffc05f330..38be4dd2f 100644
--- a/pyrogram/types/input_message_content/__init__.py
+++ b/pyrogram/types/input_message_content/__init__.py
@@ -23,5 +23,8 @@
 from .input_text_message_content import InputTextMessageContent
 
 __all__ = [
-    "InputMessageContent", "InputReplyToMessage", "InputReplyToStory", "InputTextMessageContent"
+    "InputMessageContent",
+    "InputReplyToMessage",
+    "InputReplyToStory",
+    "InputTextMessageContent",
 ]
diff --git a/pyrogram/types/input_message_content/input_reply_to_message.py b/pyrogram/types/input_message_content/input_reply_to_message.py
index 8d0b5667f..144e1b1e2 100644
--- a/pyrogram/types/input_message_content/input_reply_to_message.py
+++ b/pyrogram/types/input_message_content/input_reply_to_message.py
@@ -47,12 +47,12 @@ class InputReplyToMessage(Object):
     """
 
     def __init__(
-        self, *,
+        self,
+        *,
         reply_to_message_id: int = None,
         message_thread_id: int = None,
         reply_to_chat: Union[
-            "raw.types.InputPeerChannel",
-            "raw.types.InputPeerUser"
+            "raw.types.InputPeerChannel", "raw.types.InputPeerUser"
         ] = None,
         quote_text: str = None,
         quote_entities: List["raw.base.MessageEntity"] = None
@@ -82,6 +82,6 @@ def write(self):
                 top_msg_id=top_msg_id,
                 reply_to_peer_id=self.reply_to_chat,
                 quote_text=self.quote_text,
-                quote_entities=self.quote_entities
+                quote_entities=self.quote_entities,
             ).write()
         return None
diff --git a/pyrogram/types/input_message_content/input_reply_to_story.py b/pyrogram/types/input_message_content/input_reply_to_story.py
index c521e4b07..c1842c107 100644
--- a/pyrogram/types/input_message_content/input_reply_to_story.py
+++ b/pyrogram/types/input_message_content/input_reply_to_story.py
@@ -32,11 +32,7 @@ class InputReplyToStory(Object):
             Unique identifier for the target story.
     """
 
-    def __init__(
-        self, *,
-        user_id: "raw.types.InputUser" = None,
-        story_id: int = None
-    ):
+    def __init__(self, *, user_id: "raw.types.InputUser" = None, story_id: int = None):
         super().__init__()
 
         self.user_id = user_id
@@ -44,6 +40,5 @@ def __init__(
 
     def write(self):
         return raw.types.InputReplyToStory(
-            user_id=self.user_id,
-            story_id=self.story_id
+            user_id=self.user_id, story_id=self.story_id
         ).write()
diff --git a/pyrogram/types/input_message_content/input_text_message_content.py b/pyrogram/types/input_message_content/input_text_message_content.py
index 7c88f996b..d629bfa20 100644
--- a/pyrogram/types/input_message_content/input_text_message_content.py
+++ b/pyrogram/types/input_message_content/input_text_message_content.py
@@ -46,7 +46,7 @@ def __init__(
         message_text: str,
         parse_mode: Optional["enums.ParseMode"] = None,
         entities: List["types.MessageEntity"] = None,
-        disable_web_page_preview: bool = None
+        disable_web_page_preview: bool = None,
     ):
         super().__init__()
 
@@ -56,13 +56,15 @@ def __init__(
         self.disable_web_page_preview = disable_web_page_preview
 
     async def write(self, client: "pyrogram.Client", reply_markup):
-        message, entities = (await utils.parse_text_entities(
-            client, self.message_text, self.parse_mode, self.entities
-        )).values()
+        message, entities = (
+            await utils.parse_text_entities(
+                client, self.message_text, self.parse_mode, self.entities
+            )
+        ).values()
 
         return raw.types.InputBotInlineMessageText(
             no_webpage=self.disable_web_page_preview or None,
             reply_markup=await reply_markup.write(client) if reply_markup else None,
             message=message,
-            entities=entities
+            entities=entities,
         )
diff --git a/pyrogram/types/messages_and_media/__init__.py b/pyrogram/types/messages_and_media/__init__.py
index 890a3fe54..c5fcebbac 100644
--- a/pyrogram/types/messages_and_media/__init__.py
+++ b/pyrogram/types/messages_and_media/__init__.py
@@ -63,7 +63,48 @@
 from .exported_story_link import ExportedStoryLink
 
 __all__ = [
-    "Animation", "Audio", "Contact", "Document", "Game", "Giveaway", "GiveawayLaunched", "GiveawayResult", "Location", "MediaArea", "MediaAreaChannelPost", "MediaAreaCoordinates", "Message", "MessageEntity", "Photo", "Thumbnail",
-    "StrippedThumbnail", "Poll", "PollOption", "Sticker", "StickerSet", "Venue", "Video", "VideoNote", "Voice", "WebPage", "WebPageEmpty", "WebPagePreview", "Dice",
-    "Reaction", "WebAppData", "MessageReactions", "ReactionCount", "ReactionType", "MessageReactionUpdated", "MessageReactionCountUpdated", "MessageStory", "Story", "StoryDeleted", "StorySkipped", "StoryViews", "StoryForwardHeader", "StoriesPrivacyRules", "ExportedStoryLink"
+    "Animation",
+    "Audio",
+    "Contact",
+    "Document",
+    "Game",
+    "Giveaway",
+    "GiveawayLaunched",
+    "GiveawayResult",
+    "Location",
+    "MediaArea",
+    "MediaAreaChannelPost",
+    "MediaAreaCoordinates",
+    "Message",
+    "MessageEntity",
+    "Photo",
+    "Thumbnail",
+    "StrippedThumbnail",
+    "Poll",
+    "PollOption",
+    "Sticker",
+    "StickerSet",
+    "Venue",
+    "Video",
+    "VideoNote",
+    "Voice",
+    "WebPage",
+    "WebPageEmpty",
+    "WebPagePreview",
+    "Dice",
+    "Reaction",
+    "WebAppData",
+    "MessageReactions",
+    "ReactionCount",
+    "ReactionType",
+    "MessageReactionUpdated",
+    "MessageReactionCountUpdated",
+    "MessageStory",
+    "Story",
+    "StoryDeleted",
+    "StorySkipped",
+    "StoryViews",
+    "StoryForwardHeader",
+    "StoriesPrivacyRules",
+    "ExportedStoryLink",
 ]
diff --git a/pyrogram/types/messages_and_media/animation.py b/pyrogram/types/messages_and_media/animation.py
index 1e7bf4cf3..911123c10 100644
--- a/pyrogram/types/messages_and_media/animation.py
+++ b/pyrogram/types/messages_and_media/animation.py
@@ -95,7 +95,7 @@ def _parse(
         client,
         animation: "raw.types.Document",
         video_attributes: "raw.types.DocumentAttributeVideo",
-        file_name: str
+        file_name: str,
     ) -> "Animation":
         return Animation(
             file_id=FileId(
@@ -103,11 +103,10 @@ def _parse(
                 dc_id=animation.dc_id,
                 media_id=animation.id,
                 access_hash=animation.access_hash,
-                file_reference=animation.file_reference
+                file_reference=animation.file_reference,
             ).encode(),
             file_unique_id=FileUniqueId(
-                file_unique_type=FileUniqueType.DOCUMENT,
-                media_id=animation.id
+                file_unique_type=FileUniqueType.DOCUMENT, media_id=animation.id
             ).encode(),
             width=getattr(video_attributes, "w", 0),
             height=getattr(video_attributes, "h", 0),
@@ -117,5 +116,5 @@ def _parse(
             file_name=file_name,
             date=utils.timestamp_to_datetime(animation.date),
             thumbs=types.Thumbnail._parse(client, animation),
-            client=client
+            client=client,
         )
diff --git a/pyrogram/types/messages_and_media/audio.py b/pyrogram/types/messages_and_media/audio.py
index e474282f0..02aac397c 100644
--- a/pyrogram/types/messages_and_media/audio.py
+++ b/pyrogram/types/messages_and_media/audio.py
@@ -95,7 +95,7 @@ def _parse(
         client,
         audio: "raw.types.Document",
         audio_attributes: "raw.types.DocumentAttributeAudio",
-        file_name: str
+        file_name: str,
     ) -> "Audio":
         return Audio(
             file_id=FileId(
@@ -103,11 +103,10 @@ def _parse(
                 dc_id=audio.dc_id,
                 media_id=audio.id,
                 access_hash=audio.access_hash,
-                file_reference=audio.file_reference
+                file_reference=audio.file_reference,
             ).encode(),
             file_unique_id=FileUniqueId(
-                file_unique_type=FileUniqueType.DOCUMENT,
-                media_id=audio.id
+                file_unique_type=FileUniqueType.DOCUMENT, media_id=audio.id
             ).encode(),
             duration=audio_attributes.duration,
             performer=audio_attributes.performer,
@@ -117,5 +116,5 @@ def _parse(
             file_name=file_name,
             date=utils.timestamp_to_datetime(audio.date),
             thumbs=types.Thumbnail._parse(client, audio),
-            client=client
+            client=client,
         )
diff --git a/pyrogram/types/messages_and_media/contact.py b/pyrogram/types/messages_and_media/contact.py
index cec03329a..eaa61e405 100644
--- a/pyrogram/types/messages_and_media/contact.py
+++ b/pyrogram/types/messages_and_media/contact.py
@@ -60,12 +60,14 @@ def __init__(
         self.vcard = vcard
 
     @staticmethod
-    def _parse(client: "pyrogram.Client", contact: "raw.types.MessageMediaContact") -> "Contact":
+    def _parse(
+        client: "pyrogram.Client", contact: "raw.types.MessageMediaContact"
+    ) -> "Contact":
         return Contact(
             phone_number=contact.phone_number,
             first_name=contact.first_name,
             last_name=contact.last_name or None,
             vcard=contact.vcard or None,
             user_id=contact.user_id or None,
-            client=client
+            client=client,
         )
diff --git a/pyrogram/types/messages_and_media/dice.py b/pyrogram/types/messages_and_media/dice.py
index 2c683ec82..bf9d90ca2 100644
--- a/pyrogram/types/messages_and_media/dice.py
+++ b/pyrogram/types/messages_and_media/dice.py
@@ -40,8 +40,4 @@ def __init__(self, *, client: "pyrogram.Client" = None, emoji: str, value: int):
 
     @staticmethod
     def _parse(client, dice: "raw.types.MessageMediaDice") -> "Dice":
-        return Dice(
-            emoji=dice.emoticon,
-            value=dice.value,
-            client=client
-        )
+        return Dice(emoji=dice.emoticon, value=dice.value, client=client)
diff --git a/pyrogram/types/messages_and_media/document.py b/pyrogram/types/messages_and_media/document.py
index 95ebe3f28..8299d9d79 100644
--- a/pyrogram/types/messages_and_media/document.py
+++ b/pyrogram/types/messages_and_media/document.py
@@ -83,16 +83,15 @@ def _parse(client, document: "raw.types.Document", file_name: str) -> "Document"
                 dc_id=document.dc_id,
                 media_id=document.id,
                 access_hash=document.access_hash,
-                file_reference=document.file_reference
+                file_reference=document.file_reference,
             ).encode(),
             file_unique_id=FileUniqueId(
-                file_unique_type=FileUniqueType.DOCUMENT,
-                media_id=document.id
+                file_unique_type=FileUniqueType.DOCUMENT, media_id=document.id
             ).encode(),
             file_name=file_name,
             mime_type=document.mime_type,
             file_size=document.size,
             date=utils.timestamp_to_datetime(document.date),
             thumbs=types.Thumbnail._parse(client, document),
-            client=client
+            client=client,
         )
diff --git a/pyrogram/types/messages_and_media/exported_story_link.py b/pyrogram/types/messages_and_media/exported_story_link.py
index 15287904f..9d9d2f703 100644
--- a/pyrogram/types/messages_and_media/exported_story_link.py
+++ b/pyrogram/types/messages_and_media/exported_story_link.py
@@ -20,6 +20,7 @@
 from typing import List
 from ..object import Object
 
+
 class ExportedStoryLink(Object):
     """Contains information about a story viewers.
 
@@ -29,16 +30,11 @@ class ExportedStoryLink(Object):
             The link of the story.
     """
 
-    def __init__(
-            self, *,
-            link: str
-    ):
+    def __init__(self, *, link: str):
         super().__init__()
 
         self.link = link
 
     @staticmethod
     def _parse(exportedstorylink: "raw.types.ExportedStoryLink") -> "ExportedStoryLink":
-        return ExportedStoryLink(
-            link=getattr(exportedstorylink,"link", None)
-        )
+        return ExportedStoryLink(link=getattr(exportedstorylink, "link", None))
diff --git a/pyrogram/types/messages_and_media/game.py b/pyrogram/types/messages_and_media/game.py
index 1452d79eb..56cd2294f 100644
--- a/pyrogram/types/messages_and_media/game.py
+++ b/pyrogram/types/messages_and_media/game.py
@@ -76,16 +76,16 @@ def _parse(client, message: "raw.types.Message") -> "Game":
             attributes = {type(i): i for i in game.document.attributes}
 
             file_name = getattr(
-                attributes.get(
-                    raw.types.DocumentAttributeFilename, None
-                ), "file_name", None
+                attributes.get(raw.types.DocumentAttributeFilename, None),
+                "file_name",
+                None,
             )
 
             animation = types.Animation._parse(
                 client,
                 game.document,
                 attributes.get(raw.types.DocumentAttributeVideo, None),
-                file_name
+                file_name,
             )
 
         return Game(
@@ -95,5 +95,5 @@ def _parse(client, message: "raw.types.Message") -> "Game":
             description=game.description,
             photo=types.Photo._parse(client, game.photo),
             animation=animation,
-            client=client
+            client=client,
         )
diff --git a/pyrogram/types/messages_and_media/giveaway.py b/pyrogram/types/messages_and_media/giveaway.py
index 217da0b10..bd144da79 100644
--- a/pyrogram/types/messages_and_media/giveaway.py
+++ b/pyrogram/types/messages_and_media/giveaway.py
@@ -60,7 +60,7 @@ def __init__(
         quantity: int,
         months: int,
         expire_date: datetime,
-        new_subscribers : bool,
+        new_subscribers: bool,
         allowed_countries: List[str] = None,
         private_channel_ids: List[int] = None
     ):
@@ -100,7 +100,9 @@ async def _parse(client, message: "raw.types.Message") -> "Giveaway":
             months=giveaway.months,
             expire_date=utils.timestamp_to_datetime(giveaway.until_date),
             new_subscribers=giveaway.only_new_subscribers,
-            allowed_countries=giveaway.countries_iso2 if len(giveaway.countries_iso2) > 0 else None,
+            allowed_countries=giveaway.countries_iso2
+            if len(giveaway.countries_iso2) > 0
+            else None,
             private_channel_ids=private_ids if len(private_ids) > 0 else None,
-            client=client
+            client=client,
         )
diff --git a/pyrogram/types/messages_and_media/giveaway_launched.py b/pyrogram/types/messages_and_media/giveaway_launched.py
index 68d0c3d7f..e7a95d894 100644
--- a/pyrogram/types/messages_and_media/giveaway_launched.py
+++ b/pyrogram/types/messages_and_media/giveaway_launched.py
@@ -18,6 +18,7 @@
 
 from ..object import Object
 
+
 class GiveawayLaunched(Object):
     """A service message about a giveaway started in the channel.
 
diff --git a/pyrogram/types/messages_and_media/giveaway_result.py b/pyrogram/types/messages_and_media/giveaway_result.py
index 3e36539f9..6025dafdb 100644
--- a/pyrogram/types/messages_and_media/giveaway_result.py
+++ b/pyrogram/types/messages_and_media/giveaway_result.py
@@ -70,7 +70,7 @@ def __init__(
         winners: List["types.User"] = None,
         months: int = None,
         expire_date: datetime = None,
-        new_subscribers : bool = None,
+        new_subscribers: bool = None,
         is_refunded: bool = None,
         is_winners_hidden: bool
     ):
@@ -92,9 +92,9 @@ async def _parse(
         client,
         giveaway_result: Union[
             "raw.types.MessageActionGiveawayResults",
-            "raw.types.MessageMediaGiveawayResults"
+            "raw.types.MessageMediaGiveawayResults",
         ],
-        hide_winners: bool = False
+        hide_winners: bool = False,
     ) -> "GiveawayResult":
         chat = None
         giveaway_message = None
@@ -108,7 +108,9 @@ async def _parse(
                 )
             )
             chat = types.Chat._parse_chat(client, chat.chats[0])
-            giveaway_message = await client.get_messages(chat_id, giveaway_result.launch_msg_id)
+            giveaway_message = await client.get_messages(
+                chat_id, giveaway_result.launch_msg_id
+            )
             expired_date = utils.timestamp_to_datetime(giveaway_result.until_date)
             winners = []
             for winner in giveaway_result.winners:
@@ -125,5 +127,5 @@ async def _parse(
             new_subscribers=getattr(giveaway_result, "only_new_subscribers", None),
             is_refunded=getattr(giveaway_result, "refunded", None),
             is_winners_hidden=hide_winners,
-            client=client
+            client=client,
         )
diff --git a/pyrogram/types/messages_and_media/location.py b/pyrogram/types/messages_and_media/location.py
index 664890cb7..bb029f58e 100644
--- a/pyrogram/types/messages_and_media/location.py
+++ b/pyrogram/types/messages_and_media/location.py
@@ -34,11 +34,7 @@ class Location(Object):
     """
 
     def __init__(
-        self,
-        *,
-        client: "pyrogram.Client" = None,
-        longitude: float,
-        latitude: float
+        self, *, client: "pyrogram.Client" = None, longitude: float, latitude: float
     ):
         super().__init__(client)
 
@@ -49,7 +45,5 @@ def __init__(
     def _parse(client, geo_point: "raw.types.GeoPoint") -> "Location":
         if isinstance(geo_point, raw.types.GeoPoint):
             return Location(
-                longitude=geo_point.long,
-                latitude=geo_point.lat,
-                client=client
+                longitude=geo_point.long, latitude=geo_point.lat, client=client
             )
diff --git a/pyrogram/types/messages_and_media/media_area.py b/pyrogram/types/messages_and_media/media_area.py
index 7b3b8ba50..ec68b9e86 100644
--- a/pyrogram/types/messages_and_media/media_area.py
+++ b/pyrogram/types/messages_and_media/media_area.py
@@ -30,17 +30,13 @@ class MediaArea(Object):
     - :obj:`~pyrogram.types.MediaAreaChannelPost`
     """
 
-    def __init__(
-        self,
-        coordinates: "types.MediaAreaCoordinates"
-    ):
+    def __init__(self, coordinates: "types.MediaAreaCoordinates"):
         super().__init__()
 
         self.coordinates = coordinates
 
     async def _parse(
-        client: "pyrogram.Client",
-        media_area: "raw.base.MediaArea"
+        client: "pyrogram.Client", media_area: "raw.base.MediaArea"
     ) -> "MediaArea":
         if isinstance(media_area, raw.types.MediaAreaChannelPost):
             return await types.MediaAreaChannelPost._parse(client, media_area)
diff --git a/pyrogram/types/messages_and_media/media_area_channel_post.py b/pyrogram/types/messages_and_media/media_area_channel_post.py
index 82ad9a7ce..afce6cad5 100644
--- a/pyrogram/types/messages_and_media/media_area_channel_post.py
+++ b/pyrogram/types/messages_and_media/media_area_channel_post.py
@@ -22,6 +22,7 @@
 
 from .media_area import MediaArea
 
+
 class MediaAreaChannelPost(MediaArea):
     """A channel post media area.
 
@@ -40,7 +41,7 @@ def __init__(
         self,
         coordinates: "types.MediaAreaCoordinates",
         chat: "types.Chat",
-        message_id: int
+        message_id: int,
     ):
         super().__init__(coordinates=coordinates)
 
@@ -49,8 +50,7 @@ def __init__(
         self.message_id = message_id
 
     async def _parse(
-        client: "pyrogram.Client",
-        media_area: "raw.types.MediaAreaChannelPost"
+        client: "pyrogram.Client", media_area: "raw.types.MediaAreaChannelPost"
     ) -> "MediaAreaChannelPost":
         channel_id = utils.get_channel_id(media_area.channel_id)
         chat = types.Chat._parse_chat(
@@ -61,10 +61,10 @@ async def _parse(
                         id=[await client.resolve_peer(channel_id)]
                     )
                 )
-            ).chats[0]
+            ).chats[0],
         )
         return MediaAreaChannelPost(
             coordinates=types.MediaAreaCoordinates._parse(media_area.coordinates),
             chat=chat,
-            message_id=media_area.msg_id
+            message_id=media_area.msg_id,
         )
diff --git a/pyrogram/types/messages_and_media/media_area_coordinates.py b/pyrogram/types/messages_and_media/media_area_coordinates.py
index c20935ef4..2d48ddf99 100644
--- a/pyrogram/types/messages_and_media/media_area_coordinates.py
+++ b/pyrogram/types/messages_and_media/media_area_coordinates.py
@@ -46,7 +46,7 @@ def __init__(
         y: float = None,
         width: float = None,
         height: float = None,
-        rotation: float = None
+        rotation: float = None,
     ):
         super().__init__()
 
@@ -57,21 +57,21 @@ def __init__(
         self.rotation = rotation
 
     def _parse(
-            media_area_cordinates: "raw.types.MediaAreaCoordinates"
+        media_area_cordinates: "raw.types.MediaAreaCoordinates",
     ) -> "MediaAreaCoordinates":
         return MediaAreaCoordinates(
             x=media_area_cordinates.x,
             y=media_area_cordinates.y,
             width=media_area_cordinates.w,
             height=media_area_cordinates.h,
-            rotation=media_area_cordinates.rotation
+            rotation=media_area_cordinates.rotation,
         )
 
     def write(self):
         return raw.types.MediaAreaCoordinates(
-            x=self.x or 51.596797943115, # value from official android apps
-            y=self.y or 51.580257415771, # value from official android apps
-            w=self.width or 69.867012023926, # value from official android apps
-            h=self.height or 75.783416748047, # value from official android apps
-            rotation=self.rotation or 0.0 # value from official android apps
+            x=self.x or 51.596797943115,  # value from official android apps
+            y=self.y or 51.580257415771,  # value from official android apps
+            w=self.width or 69.867012023926,  # value from official android apps
+            h=self.height or 75.783416748047,  # value from official android apps
+            rotation=self.rotation or 0.0,  # value from official android apps
         ).write()
diff --git a/pyrogram/types/messages_and_media/message.py b/pyrogram/types/messages_and_media/message.py
index 91b414055..cb66230ca 100644
--- a/pyrogram/types/messages_and_media/message.py
+++ b/pyrogram/types/messages_and_media/message.py
@@ -300,7 +300,7 @@ class Message(Object, Update):
 
         views (``int``, *optional*):
             Channel post views.
-        
+
         forwards (``int``, *optional*):
             Channel post forwards.
 
@@ -480,9 +480,9 @@ def __init__(
             "types.InlineKeyboardMarkup",
             "types.ReplyKeyboardMarkup",
             "types.ReplyKeyboardRemove",
-            "types.ForceReply"
+            "types.ForceReply",
         ] = None,
-        reactions: List["types.Reaction"] = None
+        reactions: List["types.Reaction"] = None,
     ):
         super().__init__(client)
 
@@ -579,11 +579,11 @@ def __init__(
         self.reactions = reactions
 
     async def wait_for_click(
-            self,
-            from_user_id: Optional[Union[Union[int, str], List[Union[int, str]]]] = None,
-            timeout: Optional[int] = None,
-            filters=None,
-            alert: Union[str, bool] = True,
+        self,
+        from_user_id: Optional[Union[Union[int, str], List[Union[int, str]]]] = None,
+        timeout: Optional[int] = None,
+        filters=None,
+        alert: Union[str, bool] = True,
     ):
         """Waits for a callback query to be clicked on the message.
 
@@ -623,7 +623,7 @@ async def _parse(
         chats: dict,
         topics: dict = None,
         is_scheduled: bool = False,
-        replies: int = 1
+        replies: int = 1,
     ):
         if isinstance(message, raw.types.MessageEmpty):
             return Message(id=message.id, empty=True, client=client)
@@ -632,14 +632,16 @@ async def _parse(
         peer_id = utils.get_raw_peer_id(message.peer_id)
         user_id = from_id or peer_id
 
-        if isinstance(message.from_id, raw.types.PeerUser) and isinstance(message.peer_id, raw.types.PeerUser):
+        if isinstance(message.from_id, raw.types.PeerUser) and isinstance(
+            message.peer_id, raw.types.PeerUser
+        ):
             if from_id not in users or peer_id not in users:
                 try:
                     r = await client.invoke(
                         raw.functions.users.GetUsers(
                             id=[
                                 await client.resolve_peer(from_id),
-                                await client.resolve_peer(peer_id)
+                                await client.resolve_peer(peer_id),
                             ]
                         )
                     )
@@ -682,10 +684,16 @@ async def _parse(
             service_type = None
 
             if isinstance(action, raw.types.MessageActionChatAddUser):
-                new_chat_members = [types.User._parse(client, users[i]) for i in action.users]
+                new_chat_members = [
+                    types.User._parse(client, users[i]) for i in action.users
+                ]
                 service_type = enums.MessageServiceType.NEW_CHAT_MEMBERS
             elif isinstance(action, raw.types.MessageActionChatJoinedByLink):
-                new_chat_members = [types.User._parse(client, users[utils.get_raw_peer_id(message.from_id)])]
+                new_chat_members = [
+                    types.User._parse(
+                        client, users[utils.get_raw_peer_id(message.from_id)]
+                    )
+                ]
                 service_type = enums.MessageServiceType.NEW_CHAT_MEMBERS
             elif isinstance(action, raw.types.MessageActionChatJoinedByRequest):
                 chat_joined_by_request = types.ChatJoinedByRequest()
@@ -719,10 +727,14 @@ async def _parse(
                 user_shared = []
                 for peer in action.peers:
                     if isinstance(peer, raw.types.PeerChannel):
-                        chat_shared.append(utils.get_channel_id(utils.get_raw_peer_id(peer)))
+                        chat_shared.append(
+                            utils.get_channel_id(utils.get_raw_peer_id(peer))
+                        )
                         service_type = enums.MessageServiceType.ChannelShared
                     elif isinstance(peer, raw.types.PeerChat):
-                        chat_shared.append(utils.get_channel_id(utils.get_raw_peer_id(peer)))
+                        chat_shared.append(
+                            utils.get_channel_id(utils.get_raw_peer_id(peer))
+                        )
                         service_type = enums.MessageServiceType.ChannelShared
                     elif isinstance(peer, raw.types.PeerUser):
                         user_shared.append(peer.user_id)
@@ -758,7 +770,9 @@ async def _parse(
                     video_chat_started = types.VideoChatStarted()
                     service_type = enums.MessageServiceType.VIDEO_CHAT_STARTED
             elif isinstance(action, raw.types.MessageActionInviteToGroupCall):
-                video_chat_members_invited = types.VideoChatMembersInvited._parse(client, action, users)
+                video_chat_members_invited = types.VideoChatMembersInvited._parse(
+                    client, action, users
+                )
                 service_type = enums.MessageServiceType.VIDEO_CHAT_MEMBERS_INVITED
             elif isinstance(action, raw.types.MessageActionWebViewDataSentMe):
                 web_app_data = types.WebAppData._parse(action)
@@ -767,10 +781,16 @@ async def _parse(
                 giveaway_launched = types.GiveawayLaunched()
                 service_type = enums.MessageServiceType.GIVEAWAY_LAUNCHED
             elif isinstance(action, raw.types.MessageActionGiveawayResults):
-                giveaway_result = await types.GiveawayResult._parse(client, action, True)
+                giveaway_result = await types.GiveawayResult._parse(
+                    client, action, True
+                )
                 service_type = enums.MessageServiceType.GIVEAWAY_RESULT
             from_user = types.User._parse(client, users.get(user_id, None))
-            sender_chat = types.Chat._parse(client, message, users, chats, is_chat=False) if not from_user else None
+            sender_chat = (
+                types.Chat._parse(client, message, users, chats, is_chat=False)
+                if not from_user
+                else None
+            )
 
             parsed_message = Message(
                 id=message.id,
@@ -787,12 +807,20 @@ async def _parse(
                 new_chat_title=new_chat_title,
                 new_chat_photo=new_chat_photo,
                 delete_chat_photo=delete_chat_photo,
-                migrate_to_chat_id=utils.get_channel_id(migrate_to_chat_id) if migrate_to_chat_id else None,
-                migrate_from_chat_id=-migrate_from_chat_id if migrate_from_chat_id else None,
+                migrate_to_chat_id=utils.get_channel_id(migrate_to_chat_id)
+                if migrate_to_chat_id
+                else None,
+                migrate_from_chat_id=-migrate_from_chat_id
+                if migrate_from_chat_id
+                else None,
                 group_chat_created=group_chat_created,
                 channel_chat_created=channel_chat_created,
-                chat_shared=chat_shared if chat_shared is not None and len(chat_shared) > 0 else None,
-                user_shared=user_shared if user_shared is not None and len(user_shared) > 0 else None,
+                chat_shared=chat_shared
+                if chat_shared is not None and len(chat_shared) > 0
+                else None,
+                user_shared=user_shared
+                if user_shared is not None and len(user_shared) > 0
+                else None,
                 is_topic_message=is_topic_message,
                 forum_topic_created=forum_topic_created,
                 forum_topic_closed=forum_topic_closed,
@@ -816,7 +844,7 @@ async def _parse(
                     parsed_message.pinned_message = await client.get_messages(
                         parsed_message.chat.id,
                         reply_to_message_ids=message.id,
-                        replies=0
+                        replies=0,
                     )
 
                     parsed_message.service = enums.MessageServiceType.PINNED_MESSAGE
@@ -824,35 +852,48 @@ async def _parse(
                     pass
 
             if isinstance(action, raw.types.MessageActionGameScore):
-                parsed_message.game_high_score = types.GameHighScore._parse_action(client, message, users)
+                parsed_message.game_high_score = types.GameHighScore._parse_action(
+                    client, message, users
+                )
 
                 if message.reply_to and replies:
                     try:
                         parsed_message.reply_to_message = await client.get_messages(
                             parsed_message.chat.id,
                             reply_to_message_ids=message.id,
-                            replies=0
+                            replies=0,
                         )
 
-                        parsed_message.service = enums.MessageServiceType.GAME_HIGH_SCORE
+                        parsed_message.service = (
+                            enums.MessageServiceType.GAME_HIGH_SCORE
+                        )
                     except MessageIdsEmpty:
                         pass
 
-            client.message_cache[(parsed_message.chat.id, parsed_message.id)] = parsed_message
+            client.message_cache[
+                (parsed_message.chat.id, parsed_message.id)
+            ] = parsed_message
 
             if message.reply_to:
                 if message.reply_to.forum_topic:
                     if message.reply_to.reply_to_top_id:
-                        parsed_message.message_thread_id = message.reply_to.reply_to_top_id
+                        parsed_message.message_thread_id = (
+                            message.reply_to.reply_to_top_id
+                        )
                     else:
-                        parsed_message.message_thread_id = message.reply_to.reply_to_msg_id
+                        parsed_message.message_thread_id = (
+                            message.reply_to.reply_to_msg_id
+                        )
                     parsed_message.is_topic_message = True
 
             return parsed_message
 
         if isinstance(message, raw.types.Message):
             message_thread_id = None
-            entities = [types.MessageEntity._parse(client, entity, users) for entity in message.entities]
+            entities = [
+                types.MessageEntity._parse(client, entity, users)
+                for entity in message.entities
+            ]
             entities = types.List(filter(lambda x: x is not None, entities))
 
             forward_from = None
@@ -875,7 +916,9 @@ async def _parse(
                     if peer_id > 0:
                         forward_from = types.User._parse(client, users[raw_peer_id])
                     else:
-                        forward_from_chat = types.Chat._parse_channel_chat(client, chats[raw_peer_id])
+                        forward_from_chat = types.Chat._parse_channel_chat(
+                            client, chats[raw_peer_id]
+                        )
                         forward_from_message_id = forward_header.channel_post
                         forward_signature = forward_header.post_author
                 elif forward_header.from_name:
@@ -925,7 +968,9 @@ async def _parse(
                     giveaway = await types.Giveaway._parse(client, message)
                     media_type = enums.MessageMediaType.GIVEAWAY
                 elif isinstance(media, raw.types.MessageMediaGiveawayResults):
-                    giveaway_result = await types.GiveawayResult._parse(client, message.media)
+                    giveaway_result = await types.GiveawayResult._parse(
+                        client, message.media
+                    )
                     media_type = enums.MessageMediaType.GIVEAWAY_RESULT
                 elif isinstance(media, raw.types.MessageMediaStory):
                     story = await types.MessageStory._parse(client, media)
@@ -937,44 +982,70 @@ async def _parse(
                         attributes = {type(i): i for i in doc.attributes}
 
                         file_name = getattr(
-                            attributes.get(
-                                raw.types.DocumentAttributeFilename, None
-                            ), "file_name", None
+                            attributes.get(raw.types.DocumentAttributeFilename, None),
+                            "file_name",
+                            None,
                         )
 
                         if raw.types.DocumentAttributeAnimated in attributes:
-                            video_attributes = attributes.get(raw.types.DocumentAttributeVideo, None)
-                            animation = types.Animation._parse(client, doc, video_attributes, file_name)
+                            video_attributes = attributes.get(
+                                raw.types.DocumentAttributeVideo, None
+                            )
+                            animation = types.Animation._parse(
+                                client, doc, video_attributes, file_name
+                            )
                             media_type = enums.MessageMediaType.ANIMATION
                             has_media_spoiler = media.spoiler
                         elif raw.types.DocumentAttributeSticker in attributes:
-                            sticker = await types.Sticker._parse(client, doc, attributes)
+                            sticker = await types.Sticker._parse(
+                                client, doc, attributes
+                            )
                             media_type = enums.MessageMediaType.STICKER
                         elif raw.types.DocumentAttributeVideo in attributes:
-                            video_attributes = attributes[raw.types.DocumentAttributeVideo]
+                            video_attributes = attributes[
+                                raw.types.DocumentAttributeVideo
+                            ]
 
                             if video_attributes.round_message:
-                                video_note = types.VideoNote._parse(client, doc, video_attributes)
+                                video_note = types.VideoNote._parse(
+                                    client, doc, video_attributes
+                                )
                                 media_type = enums.MessageMediaType.VIDEO_NOTE
                             else:
-                                video = types.Video._parse(client, doc, video_attributes, file_name, media.ttl_seconds)
+                                video = types.Video._parse(
+                                    client,
+                                    doc,
+                                    video_attributes,
+                                    file_name,
+                                    media.ttl_seconds,
+                                )
                                 media_type = enums.MessageMediaType.VIDEO
                                 has_media_spoiler = media.spoiler
                         elif raw.types.DocumentAttributeAudio in attributes:
-                            audio_attributes = attributes[raw.types.DocumentAttributeAudio]
+                            audio_attributes = attributes[
+                                raw.types.DocumentAttributeAudio
+                            ]
 
                             if audio_attributes.voice:
-                                voice = types.Voice._parse(client, doc, audio_attributes)
+                                voice = types.Voice._parse(
+                                    client, doc, audio_attributes
+                                )
                                 media_type = enums.MessageMediaType.VOICE
                             else:
-                                audio = types.Audio._parse(client, doc, audio_attributes, file_name)
+                                audio = types.Audio._parse(
+                                    client, doc, audio_attributes, file_name
+                                )
                                 media_type = enums.MessageMediaType.AUDIO
                         else:
                             document = types.Document._parse(client, doc, file_name)
                             media_type = enums.MessageMediaType.DOCUMENT
                 elif isinstance(media, raw.types.MessageMediaWebPage):
-                    if isinstance(media.webpage, raw.types.WebPage) or isinstance(media.webpage, raw.types.WebPageEmpty):
-                        web_page_preview = types.WebPagePreview._parse(client, media, message.invert_media)
+                    if isinstance(media.webpage, raw.types.WebPage) or isinstance(
+                        media.webpage, raw.types.WebPageEmpty
+                    ):
+                        web_page_preview = types.WebPagePreview._parse(
+                            client, media, message.invert_media
+                        )
                         media_type = enums.MessageMediaType.WEB_PAGE_PREVIEW
                     else:
                         media = None
@@ -1002,7 +1073,11 @@ async def _parse(
                     reply_markup = None
 
             from_user = types.User._parse(client, users.get(user_id, None))
-            sender_chat = types.Chat._parse(client, message, users, chats, is_chat=False) if not from_user else None
+            sender_chat = (
+                types.Chat._parse(client, message, users, chats, is_chat=False)
+                if not from_user
+                else None
+            )
 
             reactions = types.MessageReactions._parse(client, message.reactions)
 
@@ -1075,59 +1150,91 @@ async def _parse(
                 outgoing=message.out,
                 reply_markup=reply_markup,
                 reactions=reactions,
-                client=client
+                client=client,
             )
 
             if message.reply_to:
                 if isinstance(message.reply_to, raw.types.MessageReplyHeader):
                     parsed_message.quote_text = message.reply_to.quote_text
                     if len(message.reply_to.quote_entities) > 0:
-                        quote_entities = [types.MessageEntity._parse(client, entity, users) for entity in message.reply_to.quote_entities]
-                        parsed_message.quote_entities = types.List(filter(lambda x: x is not None, quote_entities))
+                        quote_entities = [
+                            types.MessageEntity._parse(client, entity, users)
+                            for entity in message.reply_to.quote_entities
+                        ]
+                        parsed_message.quote_entities = types.List(
+                            filter(lambda x: x is not None, quote_entities)
+                        )
                     if message.reply_to.forum_topic:
                         if message.reply_to.reply_to_top_id:
                             thread_id = message.reply_to.reply_to_top_id
-                            parsed_message.reply_to_message_id = message.reply_to.reply_to_msg_id
+                            parsed_message.reply_to_message_id = (
+                                message.reply_to.reply_to_msg_id
+                            )
                         else:
                             thread_id = message.reply_to.reply_to_msg_id
                         parsed_message.message_thread_id = thread_id
                         parsed_message.is_topic_message = True
                         if topics:
-                            parsed_message.topics = types.ForumTopic._parse(topics[thread_id])
+                            parsed_message.topics = types.ForumTopic._parse(
+                                topics[thread_id]
+                            )
                         else:
                             try:
-                                msg = await client.get_messages(parsed_message.chat.id,message.id)
+                                msg = await client.get_messages(
+                                    parsed_message.chat.id, message.id
+                                )
                                 if getattr(msg, "topics"):
                                     parsed_message.topics = msg.topics
                             except Exception:
                                 pass
                     else:
-                        parsed_message.reply_to_message_id = message.reply_to.reply_to_msg_id
-                        parsed_message.reply_to_top_message_id = message.reply_to.reply_to_top_id
+                        parsed_message.reply_to_message_id = (
+                            message.reply_to.reply_to_msg_id
+                        )
+                        parsed_message.reply_to_top_message_id = (
+                            message.reply_to.reply_to_top_id
+                        )
                 else:
                     parsed_message.reply_to_story_id = message.reply_to.story_id
                     parsed_message.reply_to_story_user_id = message.reply_to.user_id
 
                 if replies:
                     if parsed_message.reply_to_message_id:
-                        is_cross_chat = getattr(message.reply_to, "reply_to_peer_id", None) and getattr(message.reply_to.reply_to_peer_id, "channel_id", None)
+                        is_cross_chat = getattr(
+                            message.reply_to, "reply_to_peer_id", None
+                        ) and getattr(
+                            message.reply_to.reply_to_peer_id, "channel_id", None
+                        )
 
                         if is_cross_chat:
-                            key = (utils.get_channel_id(message.reply_to.reply_to_peer_id.channel_id), message.reply_to.reply_to_msg_id)
-                            reply_to_params = {"chat_id": key[0], 'message_ids': key[1]}
+                            key = (
+                                utils.get_channel_id(
+                                    message.reply_to.reply_to_peer_id.channel_id
+                                ),
+                                message.reply_to.reply_to_msg_id,
+                            )
+                            reply_to_params = {"chat_id": key[0], "message_ids": key[1]}
                         else:
-                            key = (parsed_message.chat.id, parsed_message.reply_to_message_id)
-                            reply_to_params = {'chat_id': key[0], 'reply_to_message_ids': message.id}
+                            key = (
+                                parsed_message.chat.id,
+                                parsed_message.reply_to_message_id,
+                            )
+                            reply_to_params = {
+                                "chat_id": key[0],
+                                "reply_to_message_ids": message.id,
+                            }
 
                         try:
                             reply_to_message = client.message_cache[key]
 
                             if not reply_to_message:
                                 reply_to_message = await client.get_messages(
-                                    replies=replies - 1,
-                                    **reply_to_params
+                                    replies=replies - 1, **reply_to_params
                                 )
-                            if reply_to_message and not reply_to_message.forum_topic_created:
+                            if (
+                                reply_to_message
+                                and not reply_to_message.forum_topic_created
+                            ):
                                 parsed_message.reply_to_message = reply_to_message
                         except MessageIdsEmpty:
                             pass
@@ -1135,7 +1242,7 @@ async def _parse(
                         try:
                             reply_to_story = await client.get_stories(
                                 parsed_message.reply_to_story_user_id,
-                                parsed_message.reply_to_story_id
+                                parsed_message.reply_to_story_id,
                             )
                         except Exception:
                             pass
@@ -1143,14 +1250,17 @@ async def _parse(
                             parsed_message.reply_to_story = reply_to_story
 
             if not parsed_message.poll:  # Do not cache poll messages
-                client.message_cache[(parsed_message.chat.id, parsed_message.id)] = parsed_message
+                client.message_cache[
+                    (parsed_message.chat.id, parsed_message.id)
+                ] = parsed_message
 
             return parsed_message
 
     @property
     def link(self) -> str:
         if (
-            self.chat.type in (enums.ChatType.GROUP, enums.ChatType.SUPERGROUP, enums.ChatType.CHANNEL)
+            self.chat.type
+            in (enums.ChatType.GROUP, enums.ChatType.SUPERGROUP, enums.ChatType.CHANNEL)
             and self.chat.username
         ):
             return f"https://t.me/{self.chat.username}/{self.id}"
@@ -1159,31 +1269,30 @@ def link(self) -> str:
 
     async def get_media_group(self) -> List["types.Message"]:
         """Bound method *get_media_group* of :obj:`~pyrogram.types.Message`.
-        
+
         Use as a shortcut for:
-        
+
         .. code-block:: python
 
             await client.get_media_group(
                 chat_id=message.chat.id,
                 message_id=message.id
             )
-            
+
         Example:
             .. code-block:: python
 
                 await message.get_media_group()
-                
+
         Returns:
             List of :obj:`~pyrogram.types.Message`: On success, a list of messages of the media group is returned.
-            
+
         Raises:
             ValueError: In case the passed message id doesn't belong to a media group.
         """
 
         return await self._client.get_media_group(
-            chat_id=self.chat.id,
-            message_id=self.id
+            chat_id=self.chat.id, message_id=self.id
         )
 
     async def reply_text(
@@ -1201,7 +1310,7 @@ async def reply_text(
         schedule_date: datetime = None,
         protect_content: bool = None,
         invert_media: bool = None,
-        reply_markup=None
+        reply_markup=None,
     ) -> "Message":
         """Bound method *reply_text* of :obj:`~pyrogram.types.Message`.
 
@@ -1312,7 +1421,7 @@ async def reply_text(
             schedule_date=schedule_date,
             protect_content=protect_content,
             invert_media=invert_media,
-            reply_markup=reply_markup
+            reply_markup=reply_markup,
         )
 
     reply = reply_text
@@ -1335,14 +1444,14 @@ async def reply_animation(
             "types.InlineKeyboardMarkup",
             "types.ReplyKeyboardMarkup",
             "types.ReplyKeyboardRemove",
-            "types.ForceReply"
+            "types.ForceReply",
         ] = None,
         reply_to_message_id: int = None,
         reply_in_chat_id: Union[int, str] = None,
         quote_text: str = None,
         quote_entities: List["types.MessageEntity"] = None,
         progress: Callable = None,
-        progress_args: tuple = ()
+        progress_args: tuple = (),
     ) -> "Message":
         """Bound method *reply_animation* :obj:`~pyrogram.types.Message`.
 
@@ -1494,7 +1603,7 @@ async def reply_animation(
             quote_entities=quote_entities,
             reply_markup=reply_markup,
             progress=progress,
-            progress_args=progress_args
+            progress_args=progress_args,
         )
 
     async def reply_audio(
@@ -1518,10 +1627,10 @@ async def reply_audio(
             "types.InlineKeyboardMarkup",
             "types.ReplyKeyboardMarkup",
             "types.ReplyKeyboardRemove",
-            "types.ForceReply"
+            "types.ForceReply",
         ] = None,
         progress: Callable = None,
-        progress_args: tuple = ()
+        progress_args: tuple = (),
     ) -> "Message":
         """Bound method *reply_audio* of :obj:`~pyrogram.types.Message`.
 
@@ -1668,7 +1777,7 @@ async def reply_audio(
             quote_entities=quote_entities,
             reply_markup=reply_markup,
             progress=progress,
-            progress_args=progress_args
+            progress_args=progress_args,
         )
 
     async def reply_cached_media(
@@ -1687,8 +1796,8 @@ async def reply_cached_media(
             "types.InlineKeyboardMarkup",
             "types.ReplyKeyboardMarkup",
             "types.ReplyKeyboardRemove",
-            "types.ForceReply"
-        ] = None
+            "types.ForceReply",
+        ] = None,
     ) -> "Message":
         """Bound method *reply_cached_media* of :obj:`~pyrogram.types.Message`.
 
@@ -1783,7 +1892,7 @@ async def reply_cached_media(
             reply_to_chat_id=reply_to_chat_id,
             quote_text=quote_text,
             quote_entities=quote_entities,
-            reply_markup=reply_markup
+            reply_markup=reply_markup,
         )
 
     async def reply_chat_action(self, action: "enums.ChatAction") -> bool:
@@ -1818,10 +1927,7 @@ async def reply_chat_action(self, action: "enums.ChatAction") -> bool:
             RPCError: In case of a Telegram RPC error.
             ValueError: In case the provided string is not a valid chat action.
         """
-        return await self._client.send_chat_action(
-            chat_id=self.chat.id,
-            action=action
-        )
+        return await self._client.send_chat_action(chat_id=self.chat.id, action=action)
 
     async def reply_contact(
         self,
@@ -1840,8 +1946,8 @@ async def reply_contact(
             "types.InlineKeyboardMarkup",
             "types.ReplyKeyboardMarkup",
             "types.ReplyKeyboardRemove",
-            "types.ForceReply"
-        ] = None
+            "types.ForceReply",
+        ] = None,
     ) -> "Message":
         """Bound method *reply_contact* of :obj:`~pyrogram.types.Message`.
 
@@ -1941,7 +2047,7 @@ async def reply_contact(
             quote_text=quote_text,
             quote_entities=quote_entities,
             parse_mode=parse_mode,
-            reply_markup=reply_markup
+            reply_markup=reply_markup,
         )
 
     async def reply_document(
@@ -1965,10 +2071,10 @@ async def reply_document(
             "types.InlineKeyboardMarkup",
             "types.ReplyKeyboardMarkup",
             "types.ReplyKeyboardRemove",
-            "types.ForceReply"
+            "types.ForceReply",
         ] = None,
         progress: Callable = None,
-        progress_args: tuple = ()
+        progress_args: tuple = (),
     ) -> "Message":
         """Bound method *reply_document* of :obj:`~pyrogram.types.Message`.
 
@@ -2041,7 +2147,7 @@ async def reply_document(
             quote_entities (List of :obj:`~pyrogram.types.MessageEntity`, *optional*):
                 List of special entities that appear in quote_text, which can be specified instead of *parse_mode*.
                 for reply_to_message only.
-            
+
             schedule_date (:py:obj:`~datetime.datetime`, *optional*):
                 Date when the message will be automatically sent.
 
@@ -2117,7 +2223,7 @@ async def reply_document(
             protect_content=protect_content,
             reply_markup=reply_markup,
             progress=progress,
-            progress_args=progress_args
+            progress_args=progress_args,
         )
 
     async def reply_game(
@@ -2130,8 +2236,8 @@ async def reply_game(
             "types.InlineKeyboardMarkup",
             "types.ReplyKeyboardMarkup",
             "types.ReplyKeyboardRemove",
-            "types.ForceReply"
-        ] = None
+            "types.ForceReply",
+        ] = None,
     ) -> "Message":
         """Bound method *reply_game* of :obj:`~pyrogram.types.Message`.
 
@@ -2191,7 +2297,7 @@ async def reply_game(
             disable_notification=disable_notification,
             message_thread_id=message_thread_id,
             reply_to_message_id=reply_to_message_id,
-            reply_markup=reply_markup
+            reply_markup=reply_markup,
         )
 
     async def reply_inline_bot_result(
@@ -2203,7 +2309,7 @@ async def reply_inline_bot_result(
         reply_to_message_id: int = None,
         quote_text: str = None,
         quote_entities: List["types.MessageEntity"] = None,
-        parse_mode: Optional["enums.ParseMode"] = None
+        parse_mode: Optional["enums.ParseMode"] = None,
     ) -> "Message":
         """Bound method *reply_inline_bot_result* of :obj:`~pyrogram.types.Message`.
 
@@ -2272,7 +2378,7 @@ async def reply_inline_bot_result(
             disable_notification=disable_notification,
             message_thread_id=message_thread_id,
             reply_to_message_id=reply_to_message_id,
-            quote_text=quote_text
+            quote_text=quote_text,
         )
 
     async def reply_location(
@@ -2290,8 +2396,8 @@ async def reply_location(
             "types.InlineKeyboardMarkup",
             "types.ReplyKeyboardMarkup",
             "types.ReplyKeyboardRemove",
-            "types.ForceReply"
-        ] = None
+            "types.ForceReply",
+        ] = None,
     ) -> "Message":
         """Bound method *reply_location* of :obj:`~pyrogram.types.Message`.
 
@@ -2383,24 +2489,26 @@ async def reply_location(
             quote_text=quote_text,
             quote_entities=quote_entities,
             parse_mode=parse_mode,
-            reply_markup=reply_markup
+            reply_markup=reply_markup,
         )
 
     async def reply_media_group(
         self,
-        media: List[Union[
-            "types.InputMediaPhoto",
-            "types.InputMediaVideo",
-            "types.InputMediaAudio",
-            "types.InputMediaDocument"
-        ]],
+        media: List[
+            Union[
+                "types.InputMediaPhoto",
+                "types.InputMediaVideo",
+                "types.InputMediaAudio",
+                "types.InputMediaDocument",
+            ]
+        ],
         quote: bool = None,
         disable_notification: bool = None,
         reply_to_message_id: int = None,
         reply_in_chat_id: Union[int, str] = None,
         quote_text: str = None,
         quote_entities: List["types.MessageEntity"] = None,
-        parse_mode: Optional["enums.ParseMode"] = None
+        parse_mode: Optional["enums.ParseMode"] = None,
     ) -> List["types.Message"]:
         """Bound method *reply_media_group* of :obj:`~pyrogram.types.Message`.
 
@@ -2478,7 +2586,7 @@ async def reply_media_group(
             message_thread_id=message_thread_id,
             reply_to_message_id=reply_to_message_id,
             reply_to_chat_id=reply_to_chat_id,
-            quote_text=quote_text
+            quote_text=quote_text,
         )
 
     async def reply_photo(
@@ -2499,10 +2607,10 @@ async def reply_photo(
             "types.InlineKeyboardMarkup",
             "types.ReplyKeyboardMarkup",
             "types.ReplyKeyboardRemove",
-            "types.ForceReply"
+            "types.ForceReply",
         ] = None,
         progress: Callable = None,
-        progress_args: tuple = ()
+        progress_args: tuple = (),
     ) -> "Message":
         """Bound method *reply_photo* of :obj:`~pyrogram.types.Message`.
 
@@ -2635,7 +2743,7 @@ async def reply_photo(
             quote_entities=quote_entities,
             reply_markup=reply_markup,
             progress=progress,
-            progress_args=progress_args
+            progress_args=progress_args,
         )
 
     async def reply_poll(
@@ -2665,8 +2773,8 @@ async def reply_poll(
             "types.InlineKeyboardMarkup",
             "types.ReplyKeyboardMarkup",
             "types.ReplyKeyboardRemove",
-            "types.ForceReply"
-        ] = None
+            "types.ForceReply",
+        ] = None,
     ) -> "Message":
         """Bound method *reply_poll* of :obj:`~pyrogram.types.Message`.
 
@@ -2816,7 +2924,7 @@ async def reply_poll(
             quote_entities=quote_entities,
             parse_mode=parse_mode,
             schedule_date=schedule_date,
-            reply_markup=reply_markup
+            reply_markup=reply_markup,
         )
 
     async def reply_sticker(
@@ -2833,10 +2941,10 @@ async def reply_sticker(
             "types.InlineKeyboardMarkup",
             "types.ReplyKeyboardMarkup",
             "types.ReplyKeyboardRemove",
-            "types.ForceReply"
+            "types.ForceReply",
         ] = None,
         progress: Callable = None,
-        progress_args: tuple = ()
+        progress_args: tuple = (),
     ) -> "Message":
         """Bound method *reply_sticker* of :obj:`~pyrogram.types.Message`.
 
@@ -2952,7 +3060,7 @@ async def reply_sticker(
             parse_mode=parse_mode,
             reply_markup=reply_markup,
             progress=progress,
-            progress_args=progress_args
+            progress_args=progress_args,
         )
 
     async def reply_venue(
@@ -2974,8 +3082,8 @@ async def reply_venue(
             "types.InlineKeyboardMarkup",
             "types.ReplyKeyboardMarkup",
             "types.ReplyKeyboardRemove",
-            "types.ForceReply"
-        ] = None
+            "types.ForceReply",
+        ] = None,
     ) -> "Message":
         """Bound method *reply_venue* of :obj:`~pyrogram.types.Message`.
 
@@ -3086,7 +3194,7 @@ async def reply_venue(
             quote_text=quote_text,
             quote_entities=quote_entities,
             parse_mode=parse_mode,
-            reply_markup=reply_markup
+            reply_markup=reply_markup,
         )
 
     async def reply_video(
@@ -3113,10 +3221,10 @@ async def reply_video(
             "types.InlineKeyboardMarkup",
             "types.ReplyKeyboardMarkup",
             "types.ReplyKeyboardRemove",
-            "types.ForceReply"
+            "types.ForceReply",
         ] = None,
         progress: Callable = None,
-        progress_args: tuple = ()
+        progress_args: tuple = (),
     ) -> "Message":
         """Bound method *reply_video* of :obj:`~pyrogram.types.Message`.
 
@@ -3277,7 +3385,7 @@ async def reply_video(
             quote_entities=quote_entities,
             reply_markup=reply_markup,
             progress=progress,
-            progress_args=progress_args
+            progress_args=progress_args,
         )
 
     async def reply_video_note(
@@ -3299,10 +3407,10 @@ async def reply_video_note(
             "types.InlineKeyboardMarkup",
             "types.ReplyKeyboardMarkup",
             "types.ReplyKeyboardRemove",
-            "types.ForceReply"
+            "types.ForceReply",
         ] = None,
         progress: Callable = None,
-        progress_args: tuple = ()
+        progress_args: tuple = (),
     ) -> "Message":
         """Bound method *reply_video_note* of :obj:`~pyrogram.types.Message`.
 
@@ -3438,7 +3546,7 @@ async def reply_video_note(
             parse_mode=parse_mode,
             reply_markup=reply_markup,
             progress=progress,
-            progress_args=progress_args
+            progress_args=progress_args,
         )
 
     async def reply_voice(
@@ -3458,10 +3566,10 @@ async def reply_voice(
             "types.InlineKeyboardMarkup",
             "types.ReplyKeyboardMarkup",
             "types.ReplyKeyboardRemove",
-            "types.ForceReply"
+            "types.ForceReply",
         ] = None,
         progress: Callable = None,
-        progress_args: tuple = ()
+        progress_args: tuple = (),
     ) -> "Message":
         """Bound method *reply_voice* of :obj:`~pyrogram.types.Message`.
 
@@ -3588,8 +3696,9 @@ async def reply_voice(
             quote_entities=quote_entities,
             reply_markup=reply_markup,
             progress=progress,
-            progress_args=progress_args
+            progress_args=progress_args,
         )
+
     async def reply_web_page(
         self,
         url: str,
@@ -3606,7 +3715,7 @@ async def reply_web_page(
         quote_entities: List["types.MessageEntity"] = None,
         schedule_date: datetime = None,
         protect_content: bool = None,
-        reply_markup=None
+        reply_markup=None,
     ) -> "Message":
         """Bound method *reply_web_page* of :obj:`~pyrogram.types.Message`.
 
@@ -3718,7 +3827,7 @@ async def reply_web_page(
             quote_entities=quote_entities,
             schedule_date=schedule_date,
             protect_content=protect_content,
-            reply_markup=reply_markup
+            reply_markup=reply_markup,
         )
 
     async def edit_text(
@@ -3727,7 +3836,7 @@ async def edit_text(
         parse_mode: Optional["enums.ParseMode"] = None,
         entities: List["types.MessageEntity"] = None,
         disable_web_page_preview: bool = None,
-        reply_markup: "types.InlineKeyboardMarkup" = None
+        reply_markup: "types.InlineKeyboardMarkup" = None,
     ) -> "Message":
         """Bound method *edit_text* of :obj:`~pyrogram.types.Message`.
 
@@ -3778,7 +3887,7 @@ async def edit_text(
             parse_mode=parse_mode,
             entities=entities,
             disable_web_page_preview=disable_web_page_preview,
-            reply_markup=reply_markup
+            reply_markup=reply_markup,
         )
 
     edit = edit_text
@@ -3788,7 +3897,7 @@ async def edit_caption(
         caption: str,
         parse_mode: Optional["enums.ParseMode"] = None,
         caption_entities: List["types.MessageEntity"] = None,
-        reply_markup: "types.InlineKeyboardMarkup" = None
+        reply_markup: "types.InlineKeyboardMarkup" = None,
     ) -> "Message":
         """Bound method *edit_caption* of :obj:`~pyrogram.types.Message`.
 
@@ -3833,13 +3942,13 @@ async def edit_caption(
             caption=caption,
             parse_mode=parse_mode,
             caption_entities=caption_entities,
-            reply_markup=reply_markup
+            reply_markup=reply_markup,
         )
 
     async def edit_media(
         self,
         media: "types.InputMedia",
-        reply_markup: "types.InlineKeyboardMarkup" = None
+        reply_markup: "types.InlineKeyboardMarkup" = None,
     ) -> "Message":
         """Bound method *edit_media* of :obj:`~pyrogram.types.Message`.
 
@@ -3875,10 +3984,12 @@ async def edit_media(
             chat_id=self.chat.id,
             message_id=self.id,
             media=media,
-            reply_markup=reply_markup
+            reply_markup=reply_markup,
         )
 
-    async def edit_reply_markup(self, reply_markup: "types.InlineKeyboardMarkup" = None) -> "Message":
+    async def edit_reply_markup(
+        self, reply_markup: "types.InlineKeyboardMarkup" = None
+    ) -> "Message":
         """Bound method *edit_reply_markup* of :obj:`~pyrogram.types.Message`.
 
         Use as a shortcut for:
@@ -3908,9 +4019,7 @@ async def edit_reply_markup(self, reply_markup: "types.InlineKeyboardMarkup" = N
             RPCError: In case of a Telegram RPC error.
         """
         return await self._client.edit_message_reply_markup(
-            chat_id=self.chat.id,
-            message_id=self.id,
-            reply_markup=reply_markup
+            chat_id=self.chat.id, message_id=self.id, reply_markup=reply_markup
         )
 
     async def forward(
@@ -3920,7 +4029,7 @@ async def forward(
         disable_notification: bool = None,
         schedule_date: datetime = None,
         protect_content: bool = None,
-        drop_author: bool = None
+        drop_author: bool = None,
     ) -> Union["types.Message", List["types.Message"]]:
         """Bound method *forward* of :obj:`~pyrogram.types.Message`.
 
@@ -3976,7 +4085,7 @@ async def forward(
             disable_notification=disable_notification,
             schedule_date=schedule_date,
             protect_content=protect_content,
-            drop_author=drop_author
+            drop_author=drop_author,
         )
 
     async def copy(
@@ -3997,8 +4106,8 @@ async def copy(
             "types.InlineKeyboardMarkup",
             "types.ReplyKeyboardMarkup",
             "types.ReplyKeyboardRemove",
-            "types.ForceReply"
-        ] = object
+            "types.ForceReply",
+        ] = object,
     ) -> Union["types.Message", List["types.Message"]]:
         """Bound method *copy* of :obj:`~pyrogram.types.Message`.
 
@@ -4077,11 +4186,17 @@ async def copy(
             RPCError: In case of a Telegram RPC error.
         """
         if self.service:
-            log.warning("Service messages cannot be copied. chat_id: %s, message_id: %s",
-                        self.chat.id, self.id)
+            log.warning(
+                "Service messages cannot be copied. chat_id: %s, message_id: %s",
+                self.chat.id,
+                self.id,
+            )
         elif self.game and not await self._client.storage.is_bot():
-            log.warning("Users cannot send messages with Game media type. chat_id: %s, message_id: %s",
-                        self.chat.id, self.id)
+            log.warning(
+                "Users cannot send messages with Game media type. chat_id: %s, message_id: %s",
+                self.chat.id,
+                self.id,
+            )
         elif self.empty:
             log.warning("Empty messages cannot be copied.")
         elif self.text:
@@ -4095,10 +4210,12 @@ async def copy(
                 message_thread_id=message_thread_id,
                 reply_to_message_id=reply_to_message_id,
                 quote_text=quote_text,
-            quote_entities=quote_entities,
+                quote_entities=quote_entities,
                 schedule_date=schedule_date,
                 protect_content=protect_content,
-                reply_markup=self.reply_markup if reply_markup is object else reply_markup
+                reply_markup=self.reply_markup
+                if reply_markup is object
+                else reply_markup,
             )
         elif self.media:
             send_media = partial(
@@ -4110,7 +4227,9 @@ async def copy(
                 schedule_date=schedule_date,
                 has_spoiler=has_spoiler,
                 protect_content=protect_content,
-                reply_markup=self.reply_markup if reply_markup is object else reply_markup
+                reply_markup=self.reply_markup
+                if reply_markup is object
+                else reply_markup,
             )
 
             if self.photo:
@@ -4138,7 +4257,7 @@ async def copy(
                     vcard=self.contact.vcard,
                     disable_notification=disable_notification,
                     message_thread_id=message_thread_id,
-                    schedule_date=schedule_date
+                    schedule_date=schedule_date,
                 )
             elif self.location:
                 return await self._client.send_location(
@@ -4147,7 +4266,7 @@ async def copy(
                     longitude=self.location.longitude,
                     disable_notification=disable_notification,
                     message_thread_id=message_thread_id,
-                    schedule_date=schedule_date
+                    schedule_date=schedule_date,
                 )
             elif self.venue:
                 return await self._client.send_venue(
@@ -4160,7 +4279,7 @@ async def copy(
                     foursquare_type=self.venue.foursquare_type,
                     disable_notification=disable_notification,
                     message_thread_id=message_thread_id,
-                    schedule_date=schedule_date
+                    schedule_date=schedule_date,
                 )
             elif self.poll:
                 return await self._client.send_poll(
@@ -4169,14 +4288,14 @@ async def copy(
                     options=[opt.text for opt in self.poll.options],
                     disable_notification=disable_notification,
                     message_thread_id=message_thread_id,
-                    schedule_date=schedule_date
+                    schedule_date=schedule_date,
                 )
             elif self.game:
                 return await self._client.send_game(
                     chat_id,
                     game_short_name=self.game.short_name,
                     disable_notification=disable_notification,
-                    message_thread_id=message_thread_id
+                    message_thread_id=message_thread_id,
                 )
             elif self.web_page_preview:
                 return await self._client.send_web_page(
@@ -4194,15 +4313,18 @@ async def copy(
                     quote_entities=quote_entities,
                     schedule_date=schedule_date,
                     protect_content=protect_content,
-                    reply_markup=self.reply_markup if reply_markup is object else reply_markup
+                    reply_markup=self.reply_markup
+                    if reply_markup is object
+                    else reply_markup,
                 )
             else:
                 raise ValueError("Unknown media type")
 
-            if self.sticker or self.video_note:  # Sticker and VideoNote should have no caption
+            if (
+                self.sticker or self.video_note
+            ):  # Sticker and VideoNote should have no caption
                 return await send_media(
-                    file_id=file_id,
-                    message_thread_id=message_thread_id
+                    file_id=file_id, message_thread_id=message_thread_id
                 )
             else:
                 if caption is None:
@@ -4215,7 +4337,7 @@ async def copy(
                     parse_mode=parse_mode,
                     caption_entities=caption_entities,
                     has_spoiler=has_spoiler,
-                    message_thread_id=message_thread_id
+                    message_thread_id=message_thread_id,
                 )
         else:
             raise ValueError("Can't copy this message")
@@ -4251,12 +4373,16 @@ async def delete(self, revoke: bool = True):
             RPCError: In case of a Telegram RPC error.
         """
         return await self._client.delete_messages(
-            chat_id=self.chat.id,
-            message_ids=self.id,
-            revoke=revoke
+            chat_id=self.chat.id, message_ids=self.id, revoke=revoke
         )
 
-    async def click(self, x: Union[int, str] = 0, y: int = None, quote: bool = None, timeout: int = 10):
+    async def click(
+        self,
+        x: Union[int, str] = 0,
+        y: int = None,
+        quote: bool = None,
+        timeout: int = 10,
+    ):
         """Bound method *click* of :obj:`~pyrogram.types.Message`.
 
         Use as a shortcut for clicking a button attached to the message instead of:
@@ -4331,11 +4457,7 @@ async def click(self, x: Union[int, str] = 0, y: int = None, quote: bool = None,
 
         if isinstance(x, int) and y is None:
             try:
-                button = [
-                    button
-                    for row in keyboard
-                    for button in row
-                ][x]
+                button = [button for row in keyboard for button in row][x]
             except IndexError:
                 raise ValueError(f"The button at index {x} doesn't exist")
         elif isinstance(x, int) and isinstance(y, int):
@@ -4348,10 +4470,7 @@ async def click(self, x: Union[int, str] = 0, y: int = None, quote: bool = None,
 
             try:
                 button = [
-                    button
-                    for row in keyboard
-                    for button in row
-                    if label == button.text
+                    button for row in keyboard for button in row if label == button.text
                 ][0]
             except IndexError:
                 raise ValueError(f"The button with label '{x}' doesn't exists")
@@ -4364,7 +4483,7 @@ async def click(self, x: Union[int, str] = 0, y: int = None, quote: bool = None,
                     chat_id=self.chat.id,
                     message_id=self.id,
                     callback_data=button.callback_data,
-                    timeout=timeout
+                    timeout=timeout,
                 )
             elif button.url:
                 return button.url
@@ -4377,7 +4496,9 @@ async def click(self, x: Union[int, str] = 0, y: int = None, quote: bool = None,
         else:
             await self.reply(button, quote=quote)
 
-    async def react(self, emoji: str = "", big: bool = False, add_to_recent: bool = True) -> "types.MessageReactions":
+    async def react(
+        self, emoji: str = "", big: bool = False, add_to_recent: bool = True
+    ) -> "types.MessageReactions":
         """Bound method *react* of :obj:`~pyrogram.types.Message`.
 
         Use as a shortcut for:
@@ -4399,11 +4520,11 @@ async def react(self, emoji: str = "", big: bool = False, add_to_recent: bool =
             emoji (``str``, *optional*):
                 Reaction emoji.
                 Pass "" as emoji (default) to retract the reaction.
-             
+
             big (``bool``, *optional*):
                 Pass True to show a bigger and longer reaction.
                 Defaults to False.
-                
+
             add_to_recent (``bool``, *optional*):
                 Pass True if the reaction should appear in the recently used reactions.
                 This option is applicable only for users.
@@ -4416,10 +4537,7 @@ async def react(self, emoji: str = "", big: bool = False, add_to_recent: bool =
         """
 
         return await self._client.send_reaction(
-            chat_id=self.chat.id,
-            message_id=self.id,
-            emoji=emoji,
-            big=big
+            chat_id=self.chat.id, message_id=self.id, emoji=emoji, big=big
         )
 
     async def retract_vote(
@@ -4448,10 +4566,7 @@ async def retract_vote(
             RPCError: In case of a Telegram RPC error.
         """
 
-        return await self._client.retract_vote(
-            chat_id=self.chat.id,
-            message_id=self.id
-        )
+        return await self._client.retract_vote(chat_id=self.chat.id, message_id=self.id)
 
     async def download(
         self,
@@ -4459,7 +4574,7 @@ async def download(
         in_memory: bool = False,
         block: bool = True,
         progress: Callable = None,
-        progress_args: tuple = ()
+        progress_args: tuple = (),
     ) -> str:
         """Bound method *download* of :obj:`~pyrogram.types.Message`.
 
@@ -4561,12 +4676,12 @@ async def vote(
         """
 
         return await self._client.vote_poll(
-            chat_id=self.chat.id,
-            message_id=self.id,
-            options=option
+            chat_id=self.chat.id, message_id=self.id, options=option
         )
 
-    async def pin(self, disable_notification: bool = False, both_sides: bool = False) -> "types.Message":
+    async def pin(
+        self, disable_notification: bool = False, both_sides: bool = False
+    ) -> "types.Message":
         """Bound method *pin* of :obj:`~pyrogram.types.Message`.
 
         Use as a shortcut for:
@@ -4602,7 +4717,7 @@ async def pin(self, disable_notification: bool = False, both_sides: bool = False
             chat_id=self.chat.id,
             message_id=self.id,
             disable_notification=disable_notification,
-            both_sides=both_sides
+            both_sides=both_sides,
         )
 
     async def unpin(self) -> bool:
@@ -4629,8 +4744,7 @@ async def unpin(self) -> bool:
             RPCError: In case of a Telegram RPC error.
         """
         return await self._client.unpin_chat_message(
-            chat_id=self.chat.id,
-            message_id=self.id
+            chat_id=self.chat.id, message_id=self.id
         )
 
     async def ask(
@@ -4644,10 +4758,10 @@ async def ask(
         reply_to_message_id: int = None,
         reply_markup=None,
         filters=None,
-        timeout: int = None
+        timeout: int = None,
     ) -> "Message":
         """Bound method *ask* of :obj:`~pyrogram.types.Message`.
-        
+
         Use as a shortcut for:
 
         .. code-block:: python
@@ -4695,7 +4809,7 @@ async def ask(
 
             timeout (``int``, *optional*):
                 Timeout in seconds.
-            
+
         Example:
             .. code-block:: python
 
@@ -4722,13 +4836,11 @@ async def ask(
             disable_web_page_preview=disable_web_page_preview,
             disable_notification=disable_notification,
             reply_to_message_id=reply_to_message_id,
-            reply_markup=reply_markup
+            reply_markup=reply_markup,
         )
 
         reply_message = await self._client.wait_for_message(
-            self.chat.id,
-            filters=filters,
-            timeout=timeout
+            self.chat.id, filters=filters, timeout=timeout
         )
 
         reply_message.request = request
diff --git a/pyrogram/types/messages_and_media/message_entity.py b/pyrogram/types/messages_and_media/message_entity.py
index d2bf654dc..1dd6406d1 100644
--- a/pyrogram/types/messages_and_media/message_entity.py
+++ b/pyrogram/types/messages_and_media/message_entity.py
@@ -26,7 +26,7 @@
 
 class MessageEntity(Object):
     """One special entity in a text message.
-    
+
     For example, hashtags, usernames, URLs, etc.
 
     Parameters:
@@ -76,7 +76,9 @@ def __init__(
         self.custom_emoji_id = custom_emoji_id
 
     @staticmethod
-    def _parse(client, entity: "raw.base.MessageEntity", users: dict) -> Optional["MessageEntity"]:
+    def _parse(
+        client, entity: "raw.base.MessageEntity", users: dict
+    ) -> Optional["MessageEntity"]:
         # Special case for InputMessageEntityMentionName -> MessageEntityType.TEXT_MENTION
         # This happens in case of UpdateShortSentMessage inside send_message() where entities are parsed from the input
         if isinstance(entity, raw.types.InputMessageEntityMentionName):
@@ -94,7 +96,7 @@ def _parse(client, entity: "raw.base.MessageEntity", users: dict) -> Optional["M
             user=types.User._parse(client, users.get(user_id, None)),
             language=getattr(entity, "language", None),
             custom_emoji_id=getattr(entity, "document_id", None),
-            client=client
+            client=client,
         )
 
     async def write(self):
diff --git a/pyrogram/types/messages_and_media/message_reaction_count_updated.py b/pyrogram/types/messages_and_media/message_reaction_count_updated.py
index 9f923a4a1..7111f27be 100644
--- a/pyrogram/types/messages_and_media/message_reaction_count_updated.py
+++ b/pyrogram/types/messages_and_media/message_reaction_count_updated.py
@@ -65,7 +65,7 @@ def _parse(
         client: "pyrogram.Client",
         update: "raw.types.UpdateBotMessageReactions",
         users: Dict[int, "raw.types.User"],
-        chats: Dict[int, "raw.types.Chat"]
+        chats: Dict[int, "raw.types.Chat"],
     ) -> "MessageReactionUpdated":
         chat = None
         peer_id = utils.get_peer_id(update.peer)
@@ -80,9 +80,5 @@ def _parse(
             chat=chat,
             message_id=update.msg_id,
             date=utils.timestamp_to_datetime(update.date),
-            reactions=[
-                types.ReactionCount._parse(
-                    rt
-                ) for rt in update.reactions
-            ]
+            reactions=[types.ReactionCount._parse(rt) for rt in update.reactions],
         )
diff --git a/pyrogram/types/messages_and_media/message_reaction_updated.py b/pyrogram/types/messages_and_media/message_reaction_updated.py
index aa4eb387c..f2e05836c 100644
--- a/pyrogram/types/messages_and_media/message_reaction_updated.py
+++ b/pyrogram/types/messages_and_media/message_reaction_updated.py
@@ -35,7 +35,7 @@ class MessageReactionUpdated(Object, Update):
     Parameters:
         id (``int``):
             Unique identifier of the message inside the chat
-            
+
         chat (:obj:`~pyrogram.types.Chat`):
             The chat containing the message the user reacted to
 
@@ -83,7 +83,7 @@ def _parse(
         client: "pyrogram.Client",
         update: "raw.types.UpdateBotMessageReaction",
         users: Dict[int, "raw.types.User"],
-        chats: Dict[int, "raw.types.Chat"]
+        chats: Dict[int, "raw.types.Chat"],
     ) -> "MessageReactionUpdated":
         chat = None
         peer_id = utils.get_peer_id(update.peer)
@@ -102,7 +102,9 @@ def _parse(
         if actor_peer_id > 0:
             from_user = types.User._parse(client, users[raw_actor_peer_id])
         else:
-            actor_chat = types.Chat._parse_channel_chat(client, chats[raw_actor_peer_id])
+            actor_chat = types.Chat._parse_channel_chat(
+                client, chats[raw_actor_peer_id]
+            )
 
         return MessageReactionUpdated(
             client=client,
@@ -111,14 +113,6 @@ def _parse(
             date=utils.timestamp_to_datetime(update.date),
             chat=chat,
             actor_chat=actor_chat,
-            old_reaction=[
-                types.ReactionType._parse(
-                    rt
-                ) for rt in update.old_reactions
-            ],
-            new_reaction=[
-                types.ReactionType._parse(
-                    rt
-                ) for rt in update.new_reactions
-            ]
-        )
\ No newline at end of file
+            old_reaction=[types.ReactionType._parse(rt) for rt in update.old_reactions],
+            new_reaction=[types.ReactionType._parse(rt) for rt in update.new_reactions],
+        )
diff --git a/pyrogram/types/messages_and_media/message_reactions.py b/pyrogram/types/messages_and_media/message_reactions.py
index b2b277893..2b9e59378 100644
--- a/pyrogram/types/messages_and_media/message_reactions.py
+++ b/pyrogram/types/messages_and_media/message_reactions.py
@@ -44,7 +44,7 @@ def __init__(
     @staticmethod
     def _parse(
         client: "pyrogram.Client",
-        message_reactions: Optional["raw.base.MessageReactions"] = None
+        message_reactions: Optional["raw.base.MessageReactions"] = None,
     ) -> Optional["MessageReactions"]:
         if not message_reactions:
             return None
@@ -54,5 +54,5 @@ def _parse(
             reactions=[
                 types.Reaction._parse_count(client, reaction)
                 for reaction in message_reactions.results
-            ]
+            ],
         )
diff --git a/pyrogram/types/messages_and_media/message_story.py b/pyrogram/types/messages_and_media/message_story.py
index 693fb15db..7ef10d907 100644
--- a/pyrogram/types/messages_and_media/message_story.py
+++ b/pyrogram/types/messages_and_media/message_story.py
@@ -28,7 +28,7 @@ class MessageStory(Object):
     Parameters:
         from_user (:obj:`~pyrogram.types.User`, *optional*):
             Sender of the story.
-        
+
         sender_chat (:obj:`~pyrogram.types.Chat`, *optional*):
             Sender of the story. If the story is from channel.
 
@@ -51,8 +51,7 @@ def __init__(
 
     @staticmethod
     async def _parse(
-        client: "pyrogram.Client",
-        message_story: "raw.types.MessageMediaStory"
+        client: "pyrogram.Client", message_story: "raw.types.MessageMediaStory"
     ) -> "MessageStory":
         from_user = None
         sender_chat = None
@@ -72,7 +71,5 @@ async def _parse(
         if not client.me.is_bot:
             return await client.get_stories(user_id or chat_id, message_story.id)
         return MessageStory(
-            from_user=from_user,
-            sender_chat=sender_chat,
-            story_id=message_story.id
+            from_user=from_user, sender_chat=sender_chat, story_id=message_story.id
         )
diff --git a/pyrogram/types/messages_and_media/photo.py b/pyrogram/types/messages_and_media/photo.py
index d6ad92263..af592a316 100644
--- a/pyrogram/types/messages_and_media/photo.py
+++ b/pyrogram/types/messages_and_media/photo.py
@@ -22,7 +22,13 @@
 import pyrogram
 from pyrogram import raw, utils
 from pyrogram import types
-from pyrogram.file_id import FileId, FileType, FileUniqueId, FileUniqueType, ThumbnailSource
+from pyrogram.file_id import (
+    FileId,
+    FileType,
+    FileUniqueId,
+    FileUniqueType,
+    ThumbnailSource,
+)
 from ..object import Object
 
 
@@ -92,10 +98,7 @@ def _parse(client, photo: "raw.types.Photo", ttl_seconds: int = None) -> "Photo"
                 if isinstance(p, raw.types.PhotoSizeProgressive):
                     photos.append(
                         raw.types.PhotoSize(
-                            type=p.type,
-                            w=p.w,
-                            h=p.h,
-                            size=max(p.sizes)
+                            type=p.type, w=p.w, h=p.h, size=max(p.sizes)
                         )
                     )
 
@@ -114,11 +117,10 @@ def _parse(client, photo: "raw.types.Photo", ttl_seconds: int = None) -> "Photo"
                     thumbnail_file_type=FileType.PHOTO,
                     thumbnail_size=main.type,
                     volume_id=0,
-                    local_id=0
+                    local_id=0,
                 ).encode(),
                 file_unique_id=FileUniqueId(
-                    file_unique_type=FileUniqueType.DOCUMENT,
-                    media_id=photo.id
+                    file_unique_type=FileUniqueType.DOCUMENT, media_id=photo.id
                 ).encode(),
                 width=main.w,
                 height=main.h,
@@ -126,5 +128,5 @@ def _parse(client, photo: "raw.types.Photo", ttl_seconds: int = None) -> "Photo"
                 date=utils.timestamp_to_datetime(photo.date),
                 ttl_seconds=ttl_seconds,
                 thumbs=types.Thumbnail._parse(client, photo),
-                client=client
+                client=client,
             )
diff --git a/pyrogram/types/messages_and_media/poll.py b/pyrogram/types/messages_and_media/poll.py
index fe9960276..b56192b2f 100644
--- a/pyrogram/types/messages_and_media/poll.py
+++ b/pyrogram/types/messages_and_media/poll.py
@@ -114,7 +114,10 @@ def __init__(
         self.close_date = close_date
 
     @staticmethod
-    def _parse(client, media_poll: Union["raw.types.MessageMediaPoll", "raw.types.UpdateMessagePoll"]) -> "Poll":
+    def _parse(
+        client,
+        media_poll: Union["raw.types.MessageMediaPoll", "raw.types.UpdateMessagePoll"],
+    ) -> "Poll":
         poll: raw.types.Poll = media_poll.poll
         poll_results: raw.types.PollResults = media_poll.results
         results: List[raw.types.PollAnswerVoters] = poll_results.results
@@ -141,7 +144,7 @@ def _parse(client, media_poll: Union["raw.types.MessageMediaPoll", "raw.types.Up
                     text=answer.text,
                     voter_count=voter_count,
                     data=answer.option,
-                    client=client
+                    client=client,
                 )
             )
 
@@ -160,10 +163,12 @@ def _parse(client, media_poll: Union["raw.types.MessageMediaPoll", "raw.types.Up
             explanation_entities=[
                 types.MessageEntity._parse(client, i, {})
                 for i in poll_results.solution_entities
-            ] if poll_results.solution_entities else None,
+            ]
+            if poll_results.solution_entities
+            else None,
             open_period=poll.close_period,
             close_date=utils.timestamp_to_datetime(poll.close_date),
-            client=client
+            client=client,
         )
 
     @staticmethod
@@ -188,7 +193,7 @@ def _parse_update(client, update: "raw.types.UpdateMessagePoll"):
                     text="",
                     voter_count=result.voters,
                     data=result.option,
-                    client=client
+                    client=client,
                 )
             )
 
@@ -200,12 +205,11 @@ def _parse_update(client, update: "raw.types.UpdateMessagePoll"):
             is_closed=False,
             chosen_option_id=chosen_option_id,
             correct_option_id=correct_option_id,
-            client=client
+            client=client,
         )
 
     async def stop(
-        self,
-        reply_markup: "types.InlineKeyboardMarkup" = None
+        self, reply_markup: "types.InlineKeyboardMarkup" = None
     ) -> "types.Poll":
         """Bound method *stop* of :obj:`~pyrogram.types.Poll`.
 
@@ -235,7 +239,5 @@ async def stop(
         """
 
         return await self._client.stop_poll(
-            chat_id=self.chat.id,
-            message_id=self.id,
-            reply_markup=reply_markup
+            chat_id=self.chat.id, message_id=self.id, reply_markup=reply_markup
         )
diff --git a/pyrogram/types/messages_and_media/reaction.py b/pyrogram/types/messages_and_media/reaction.py
index 1295571ef..84d176ec9 100644
--- a/pyrogram/types/messages_and_media/reaction.py
+++ b/pyrogram/types/messages_and_media/reaction.py
@@ -59,26 +59,16 @@ def __init__(
         self.chosen_order = chosen_order
 
     @staticmethod
-    def _parse(
-        client: "pyrogram.Client",
-        reaction: "raw.base.Reaction"
-    ) -> "Reaction":
+    def _parse(client: "pyrogram.Client", reaction: "raw.base.Reaction") -> "Reaction":
         if isinstance(reaction, raw.types.ReactionEmoji):
-            return Reaction(
-                client=client,
-                emoji=reaction.emoticon
-            )
+            return Reaction(client=client, emoji=reaction.emoticon)
 
         if isinstance(reaction, raw.types.ReactionCustomEmoji):
-            return Reaction(
-                client=client,
-                custom_emoji_id=reaction.document_id
-            )
+            return Reaction(client=client, custom_emoji_id=reaction.document_id)
 
     @staticmethod
     def _parse_count(
-        client: "pyrogram.Client",
-        reaction_count: "raw.base.ReactionCount"
+        client: "pyrogram.Client", reaction_count: "raw.base.ReactionCount"
     ) -> "Reaction":
         reaction = Reaction._parse(client, reaction_count.reaction)
         reaction.count = reaction_count.count
diff --git a/pyrogram/types/messages_and_media/reaction_count.py b/pyrogram/types/messages_and_media/reaction_count.py
index fa46cb08c..c5062276c 100644
--- a/pyrogram/types/messages_and_media/reaction_count.py
+++ b/pyrogram/types/messages_and_media/reaction_count.py
@@ -22,6 +22,7 @@
 from .reaction_type import ReactionType
 from ..object import Object
 
+
 class ReactionCount(Object):
     """Represents a reaction added to a message along with the number of times it was added.
 
@@ -38,13 +39,7 @@ class ReactionCount(Object):
             Available for chosen reactions.
     """
 
-    def __init__(
-        self,
-        *,
-        type: ReactionType,
-        total_count: int,
-        chosen_order: int
-    ):
+    def __init__(self, *, type: ReactionType, total_count: int, chosen_order: int):
         super().__init__()
         self.type = type
         self.total_count = total_count
@@ -55,9 +50,7 @@ def _parse(
         update: "raw.types.ReactionCount",
     ) -> Optional["ReactionCount"]:
         return ReactionCount(
-            type=ReactionType._parse(
-                update.reaction
-            ),
+            type=ReactionType._parse(update.reaction),
             total_count=update.count,
-            chosen_order=update.chosen_order
+            chosen_order=update.chosen_order,
         )
diff --git a/pyrogram/types/messages_and_media/reaction_type.py b/pyrogram/types/messages_and_media/reaction_type.py
index a0a9cbf4e..258ca20a3 100644
--- a/pyrogram/types/messages_and_media/reaction_type.py
+++ b/pyrogram/types/messages_and_media/reaction_type.py
@@ -21,6 +21,7 @@
 from pyrogram import enums, raw
 from ..object import Object
 
+
 class ReactionType(Object):
     """Contains information about a reaction.
 
@@ -34,6 +35,7 @@ class ReactionType(Object):
         custom_emoji_id (``int``, *optional*):
             Custom emoji id.
     """
+
     def __init__(
         self,
         *,
@@ -53,22 +55,14 @@ def _parse(
         if isinstance(update, raw.types.ReactionEmpty):
             return None
         elif isinstance(update, raw.types.ReactionEmoji):
-            return ReactionType(
-                type=enums.ReactionType.EMOJI,
-                emoji=update.emoticon
-            )
+            return ReactionType(type=enums.ReactionType.EMOJI, emoji=update.emoticon)
         elif isinstance(update, raw.types.ReactionCustomEmoji):
             return ReactionType(
-                type=enums.ReactionType.CUSTOM_EMOJI,
-                custom_emoji_id=update.document_id
+                type=enums.ReactionType.CUSTOM_EMOJI, custom_emoji_id=update.document_id
             )
 
     def write(self):
         if self.type == enums.ReactionType.EMOJI:
-            return raw.types.ReactionEmoji(
-                emoticon=self.emoji
-            )
+            return raw.types.ReactionEmoji(emoticon=self.emoji)
         if self.type == enums.ReactionType.CUSTOM_EMOJI:
-            return raw.types.ReactionCustomEmoji(
-                document_id=self.custom_emoji_id
-            )
+            return raw.types.ReactionCustomEmoji(document_id=self.custom_emoji_id)
diff --git a/pyrogram/types/messages_and_media/sticker.py b/pyrogram/types/messages_and_media/sticker.py
index de266b2fd..3a96811f6 100644
--- a/pyrogram/types/messages_and_media/sticker.py
+++ b/pyrogram/types/messages_and_media/sticker.py
@@ -122,15 +122,16 @@ async def _get_sticker_set_name(invoke, input_sticker_set_id):
             if name is not None:
                 return name
 
-            name = (await invoke(
-                raw.functions.messages.GetStickerSet(
-                    stickerset=raw.types.InputStickerSetID(
-                        id=set_id,
-                        access_hash=set_access_hash
-                    ),
-                    hash=0
+            name = (
+                await invoke(
+                    raw.functions.messages.GetStickerSet(
+                        stickerset=raw.types.InputStickerSetID(
+                            id=set_id, access_hash=set_access_hash
+                        ),
+                        hash=0,
+                    )
                 )
-            )).set.short_name
+            ).set.short_name
 
             Sticker.cache[(set_id, set_access_hash)] = name
 
@@ -146,7 +147,9 @@ async def _get_sticker_set_name(invoke, input_sticker_set_id):
     async def _parse(
         client,
         sticker: "raw.types.Document",
-        document_attributes: Dict[Type["raw.base.DocumentAttribute"], "raw.base.DocumentAttribute"],
+        document_attributes: Dict[
+            Type["raw.base.DocumentAttribute"], "raw.base.DocumentAttribute"
+        ],
     ) -> "Sticker":
         sticker_attributes = (
             document_attributes[raw.types.DocumentAttributeSticker]
@@ -154,15 +157,25 @@ async def _parse(
             else document_attributes[raw.types.DocumentAttributeCustomEmoji]
         )
 
-        image_size_attributes = document_attributes.get(raw.types.DocumentAttributeImageSize, None)
-        file_name = getattr(document_attributes.get(raw.types.DocumentAttributeFilename, None), "file_name", None)
-        video_attributes = document_attributes.get(raw.types.DocumentAttributeVideo, None)
+        image_size_attributes = document_attributes.get(
+            raw.types.DocumentAttributeImageSize, None
+        )
+        file_name = getattr(
+            document_attributes.get(raw.types.DocumentAttributeFilename, None),
+            "file_name",
+            None,
+        )
+        video_attributes = document_attributes.get(
+            raw.types.DocumentAttributeVideo, None
+        )
 
         sticker_set = sticker_attributes.stickerset
 
         if isinstance(sticker_set, raw.types.InputStickerSetID):
             input_sticker_set_id = (sticker_set.id, sticker_set.access_hash)
-            set_name = await Sticker._get_sticker_set_name(client.invoke, input_sticker_set_id)
+            set_name = await Sticker._get_sticker_set_name(
+                client.invoke, input_sticker_set_id
+            )
         else:
             set_name = None
 
@@ -172,11 +185,10 @@ async def _parse(
                 dc_id=sticker.dc_id,
                 media_id=sticker.id,
                 access_hash=sticker.access_hash,
-                file_reference=sticker.file_reference
+                file_reference=sticker.file_reference,
             ).encode(),
             file_unique_id=FileUniqueId(
-                file_unique_type=FileUniqueType.DOCUMENT,
-                media_id=sticker.id
+                file_unique_type=FileUniqueType.DOCUMENT, media_id=sticker.id
             ).encode(),
             width=(
                 image_size_attributes.w
@@ -202,5 +214,5 @@ async def _parse(
             file_name=file_name,
             date=utils.timestamp_to_datetime(sticker.date),
             thumbs=types.Thumbnail._parse(client, sticker),
-            client=client
+            client=client,
         )
diff --git a/pyrogram/types/messages_and_media/stickerset.py b/pyrogram/types/messages_and_media/stickerset.py
index 385b1fe53..5628a2773 100644
--- a/pyrogram/types/messages_and_media/stickerset.py
+++ b/pyrogram/types/messages_and_media/stickerset.py
@@ -20,7 +20,13 @@
 
 import pyrogram
 from pyrogram import raw
-from pyrogram.file_id import FileId, FileType, FileUniqueId, FileUniqueType, ThumbnailSource
+from pyrogram.file_id import (
+    FileId,
+    FileType,
+    FileUniqueId,
+    FileUniqueType,
+    ThumbnailSource,
+)
 from ..object import Object
 
 
@@ -78,12 +84,12 @@ def __init__(
     def _parse(stickerset: "raw.types.StickerSet") -> "StickerSet":
 
         return StickerSet(
-            id=getattr(stickerset,"id", None),
-            title=getattr(stickerset,"title", None),
-            short_name=getattr(stickerset,"short_name", None),
-            count=getattr(stickerset,"count", None),
-            masks=getattr(stickerset,"masks", None),
-            animated=getattr(stickerset,"animated", None),
-            videos=getattr(stickerset,"videos", None),
-            emojis=getattr(stickerset,"emojis", None)
+            id=getattr(stickerset, "id", None),
+            title=getattr(stickerset, "title", None),
+            short_name=getattr(stickerset, "short_name", None),
+            count=getattr(stickerset, "count", None),
+            masks=getattr(stickerset, "masks", None),
+            animated=getattr(stickerset, "animated", None),
+            videos=getattr(stickerset, "videos", None),
+            emojis=getattr(stickerset, "emojis", None),
         )
diff --git a/pyrogram/types/messages_and_media/stories_privacy_rules.py b/pyrogram/types/messages_and_media/stories_privacy_rules.py
index a709c598d..c5f0b72d1 100644
--- a/pyrogram/types/messages_and_media/stories_privacy_rules.py
+++ b/pyrogram/types/messages_and_media/stories_privacy_rules.py
@@ -19,6 +19,7 @@
 from pyrogram import enums, raw
 from ..object import Object
 
+
 class StoriesPrivacyRules(Object):
     """A story privacy.
 
@@ -27,10 +28,7 @@ class StoriesPrivacyRules(Object):
             Story privacy type.
     """
 
-    def __init__(
-        self, *,
-        type: "enums.StoriesPrivacyRules"
-    ):
+    def __init__(self, *, type: "enums.StoriesPrivacyRules"):
         super().__init__()
         self.type = type
 
diff --git a/pyrogram/types/messages_and_media/story.py b/pyrogram/types/messages_and_media/story.py
index 89af694bd..dd7159656 100644
--- a/pyrogram/types/messages_and_media/story.py
+++ b/pyrogram/types/messages_and_media/story.py
@@ -24,6 +24,7 @@
 from ..object import Object
 from ..update import Update
 
+
 class Story(Object, Update):
     """A story.
 
@@ -33,7 +34,7 @@ class Story(Object, Update):
 
         from_user (:obj:`~pyrogram.types.User`, *optional*):
             Sender of the story.
-        
+
         sender_chat (:obj:`~pyrogram.types.Chat`, *optional*):
             Sender of the story. If the story is from channel.
 
@@ -59,7 +60,7 @@ class Story(Object, Update):
 
         video (:obj:`~pyrogram.types.Video`, *optional*):
             Story is a video, information about the video.
-        
+
         edited (``bool``, *optional*):
            True, if the Story has been edited.
 
@@ -134,8 +135,8 @@ def __init__(
         allowed_users: List[int] = None,
         denied_users: List[int] = None,
         media_areas: List["types.MediaArea"] = None
-        #allowed_chats: List[int] = None,
-        #denied_chats: List[int] = None
+        # allowed_chats: List[int] = None,
+        # denied_chats: List[int] = None
     ):
         super().__init__(client)
 
@@ -163,20 +164,23 @@ def __init__(
         self.allowed_users = allowed_users
         self.denied_users = denied_users
         self.media_areas = media_areas
-        #self.allowed_chats = allowed_chats
-        #self.denied_chats = denied_chats
+        # self.allowed_chats = allowed_chats
+        # self.denied_chats = denied_chats
 
     @staticmethod
     async def _parse(
         client: "pyrogram.Client",
         stories: raw.base.StoryItem,
-        peer: Union["raw.types.PeerChannel", "raw.types.PeerUser"]
+        peer: Union["raw.types.PeerChannel", "raw.types.PeerUser"],
     ) -> "Story":
         if isinstance(stories, raw.types.StoryItemSkipped):
             return await types.StorySkipped._parse(client, stories, peer)
         if isinstance(stories, raw.types.StoryItemDeleted):
             return await types.StoryDeleted._parse(client, stories, peer)
-        entities = [types.MessageEntity._parse(client, entity, {}) for entity in stories.entities]
+        entities = [
+            types.MessageEntity._parse(client, entity, {})
+            for entity in stories.entities
+        ]
         entities = types.List(filter(lambda x: x is not None, entities))
         animation = None
         photo = None
@@ -185,13 +189,15 @@ async def _parse(
         sender_chat = None
         privacy = None
         forward_from = None
-        #allowed_chats = None
+        # allowed_chats = None
         allowed_users = None
-        #denied_chats = None
+        # denied_chats = None
         denied_users = None
         if stories.media:
             if isinstance(stories.media, raw.types.MessageMediaPhoto):
-                photo = types.Photo._parse(client, stories.media.photo, stories.media.ttl_seconds)
+                photo = types.Photo._parse(
+                    client, stories.media.photo, stories.media.ttl_seconds
+                )
                 media_type = enums.MessageMediaType.PHOTO
             elif isinstance(stories.media, raw.types.MessageMediaDocument):
                 doc = stories.media.document
@@ -200,18 +206,32 @@ async def _parse(
                     attributes = {type(i): i for i in doc.attributes}
 
                     if raw.types.DocumentAttributeAnimated in attributes:
-                        video_attributes = attributes.get(raw.types.DocumentAttributeVideo, None)
-                        animation = types.Animation._parse(client, doc, video_attributes, None)
+                        video_attributes = attributes.get(
+                            raw.types.DocumentAttributeVideo, None
+                        )
+                        animation = types.Animation._parse(
+                            client, doc, video_attributes, None
+                        )
                         media_type = enums.MessageMediaType.ANIMATION
                     elif raw.types.DocumentAttributeVideo in attributes:
-                        video_attributes = attributes.get(raw.types.DocumentAttributeVideo, None)
-                        video = types.Video._parse(client, doc, video_attributes, None, stories.media.ttl_seconds)
+                        video_attributes = attributes.get(
+                            raw.types.DocumentAttributeVideo, None
+                        )
+                        video = types.Video._parse(
+                            client,
+                            doc,
+                            video_attributes,
+                            None,
+                            stories.media.ttl_seconds,
+                        )
                         media_type = enums.MessageMediaType.VIDEO
                     else:
                         media_type = None
             else:
                 media_type = None
-        if isinstance(peer, raw.types.PeerChannel) or isinstance(peer, raw.types.InputPeerChannel):
+        if isinstance(peer, raw.types.PeerChannel) or isinstance(
+            peer, raw.types.InputPeerChannel
+        ):
             chat_id = utils.get_channel_id(peer.channel_id)
             chat = await client.invoke(
                 raw.functions.channels.GetChannels(
@@ -236,21 +256,23 @@ async def _parse(
             elif isinstance(priv, raw.types.PrivacyValueDisallowContacts):
                 privacy = enums.StoryPrivacy.NO_CONTACTS
 
-            '''
+            """
             if allowed_chats and len(allowed_chats) > 0:
                 chats = [int(str(chat_id)[3:]) if str(chat_id).startswith("-100") else chat_id for chat_id in allowed_chats]
                 privacy_rules.append(raw.types.InputPrivacyValueAllowChatParticipants(chats=chats))
             if denied_chats and len(denied_chats) > 0:
                 chats = [int(str(chat_id)[3:]) if str(chat_id).startswith("-100") else chat_id for chat_id in denied_chats]
                 privacy_rules.append(raw.types.InputPrivacyValueDisallowChatParticipants(chats=chats))
-            '''
+            """
             if isinstance(priv, raw.types.PrivacyValueAllowUsers):
                 allowed_users = priv.users
             if isinstance(priv, raw.types.PrivacyValueDisallowUsers):
                 denied_users = priv.users
 
         if stories.fwd_from is not None:
-            forward_from = await types.StoryForwardHeader._parse(client, stories.fwd_from)
+            forward_from = await types.StoryForwardHeader._parse(
+                client, stories.fwd_from
+            )
 
         media_areas = None
         if stories.media_areas is not None and len(stories.media_areas) > 0:
@@ -281,12 +303,12 @@ async def _parse(
             views=types.StoryViews._parse(stories.views),
             privacy=privacy,
             forward_from=forward_from,
-            #allowed_chats=allowed_chats,
-            #denied_chats=denied_chats,
+            # allowed_chats=allowed_chats,
+            # denied_chats=denied_chats,
             allowed_users=allowed_users,
             denied_users=denied_users,
             media_areas=media_areas,
-            client=client
+            client=client,
         )
 
     async def reply_text(
@@ -299,7 +321,7 @@ async def reply_text(
         reply_to_story_id: int = None,
         schedule_date: datetime = None,
         protect_content: bool = None,
-        reply_markup=None
+        reply_markup=None,
     ) -> "types.Message":
         """Bound method *reply_text* of :obj:`~pyrogram.types.Story`.
 
@@ -371,7 +393,7 @@ async def reply_text(
             reply_to_story_id=reply_to_story_id,
             schedule_date=schedule_date,
             protect_content=protect_content,
-            reply_markup=reply_markup
+            reply_markup=reply_markup,
         )
 
     reply = reply_text
@@ -393,11 +415,11 @@ async def reply_animation(
             "types.InlineKeyboardMarkup",
             "types.ReplyKeyboardMarkup",
             "types.ReplyKeyboardRemove",
-            "types.ForceReply"
+            "types.ForceReply",
         ] = None,
         reply_to_story_id: int = None,
         progress: Callable = None,
-        progress_args: tuple = ()
+        progress_args: tuple = (),
     ) -> "types.Message":
         """Bound method *reply_animation* :obj:`~pyrogram.types.Story`.
 
@@ -516,7 +538,7 @@ async def reply_animation(
             reply_to_story_id=reply_to_story_id,
             reply_markup=reply_markup,
             progress=progress,
-            progress_args=progress_args
+            progress_args=progress_args,
         )
 
     async def reply_audio(
@@ -536,10 +558,10 @@ async def reply_audio(
             "types.InlineKeyboardMarkup",
             "types.ReplyKeyboardMarkup",
             "types.ReplyKeyboardRemove",
-            "types.ForceReply"
+            "types.ForceReply",
         ] = None,
         progress: Callable = None,
-        progress_args: tuple = ()
+        progress_args: tuple = (),
     ) -> "types.Message":
         """Bound method *reply_audio* of :obj:`~pyrogram.types.Story`.
 
@@ -654,7 +676,7 @@ async def reply_audio(
             reply_to_story_id=reply_to_story_id,
             reply_markup=reply_markup,
             progress=progress,
-            progress_args=progress_args
+            progress_args=progress_args,
         )
 
     async def reply_cached_media(
@@ -669,8 +691,8 @@ async def reply_cached_media(
             "types.InlineKeyboardMarkup",
             "types.ReplyKeyboardMarkup",
             "types.ReplyKeyboardRemove",
-            "types.ForceReply"
-        ] = None
+            "types.ForceReply",
+        ] = None,
     ) -> "types.Message":
         """Bound method *reply_cached_media* of :obj:`~pyrogram.types.Story`.
 
@@ -732,19 +754,21 @@ async def reply_cached_media(
             caption_entities=caption_entities,
             disable_notification=disable_notification,
             reply_to_story_id=reply_to_story_id,
-            reply_markup=reply_markup
+            reply_markup=reply_markup,
         )
 
     async def reply_media_group(
         self,
-        media: List[Union[
-            "types.InputMediaPhoto",
-            "types.InputMediaVideo",
-            "types.InputMediaAudio",
-            "types.InputMediaDocument"
-        ]],
+        media: List[
+            Union[
+                "types.InputMediaPhoto",
+                "types.InputMediaVideo",
+                "types.InputMediaAudio",
+                "types.InputMediaDocument",
+            ]
+        ],
         disable_notification: bool = None,
-        reply_to_story_id: int = None
+        reply_to_story_id: int = None,
     ) -> List["types.Message"]:
         """Bound method *reply_media_group* of :obj:`~pyrogram.types.Story`.
 
@@ -790,7 +814,7 @@ async def reply_media_group(
             chat_id=self.from_user.id if self.from_user else self.sender_chat.id,
             media=media,
             disable_notification=disable_notification,
-            reply_to_story_id=reply_to_story_id
+            reply_to_story_id=reply_to_story_id,
         )
 
     async def reply_photo(
@@ -807,10 +831,10 @@ async def reply_photo(
             "types.InlineKeyboardMarkup",
             "types.ReplyKeyboardMarkup",
             "types.ReplyKeyboardRemove",
-            "types.ForceReply"
+            "types.ForceReply",
         ] = None,
         progress: Callable = None,
-        progress_args: tuple = ()
+        progress_args: tuple = (),
     ) -> "types.Message":
         """Bound method *reply_photo* of :obj:`~pyrogram.types.Story`.
 
@@ -910,7 +934,7 @@ async def reply_photo(
             reply_to_story_id=reply_to_story_id,
             reply_markup=reply_markup,
             progress=progress,
-            progress_args=progress_args
+            progress_args=progress_args,
         )
 
     async def reply_sticker(
@@ -922,10 +946,10 @@ async def reply_sticker(
             "types.InlineKeyboardMarkup",
             "types.ReplyKeyboardMarkup",
             "types.ReplyKeyboardRemove",
-            "types.ForceReply"
+            "types.ForceReply",
         ] = None,
         progress: Callable = None,
-        progress_args: tuple = ()
+        progress_args: tuple = (),
     ) -> "types.Message":
         """Bound method *reply_sticker* of :obj:`~pyrogram.types.Story`.
 
@@ -1003,7 +1027,7 @@ async def reply_sticker(
             reply_to_story_id=reply_to_story_id,
             reply_markup=reply_markup,
             progress=progress,
-            progress_args=progress_args
+            progress_args=progress_args,
         )
 
     async def reply_video(
@@ -1026,10 +1050,10 @@ async def reply_video(
             "types.InlineKeyboardMarkup",
             "types.ReplyKeyboardMarkup",
             "types.ReplyKeyboardRemove",
-            "types.ForceReply"
+            "types.ForceReply",
         ] = None,
         progress: Callable = None,
-        progress_args: tuple = ()
+        progress_args: tuple = (),
     ) -> "types.Message":
         """Bound method *reply_video* of :obj:`~pyrogram.types.Story`.
 
@@ -1157,7 +1181,7 @@ async def reply_video(
             reply_to_story_id=reply_to_story_id,
             reply_markup=reply_markup,
             progress=progress,
-            progress_args=progress_args
+            progress_args=progress_args,
         )
 
     async def reply_video_note(
@@ -1172,10 +1196,10 @@ async def reply_video_note(
             "types.InlineKeyboardMarkup",
             "types.ReplyKeyboardMarkup",
             "types.ReplyKeyboardRemove",
-            "types.ForceReply"
+            "types.ForceReply",
         ] = None,
         progress: Callable = None,
-        progress_args: tuple = ()
+        progress_args: tuple = (),
     ) -> "types.Message":
         """Bound method *reply_video_note* of :obj:`~pyrogram.types.Story`.
 
@@ -1267,7 +1291,7 @@ async def reply_video_note(
             reply_to_story_id=reply_to_story_id,
             reply_markup=reply_markup,
             progress=progress,
-            progress_args=progress_args
+            progress_args=progress_args,
         )
 
     async def reply_voice(
@@ -1283,10 +1307,10 @@ async def reply_voice(
             "types.InlineKeyboardMarkup",
             "types.ReplyKeyboardMarkup",
             "types.ReplyKeyboardRemove",
-            "types.ForceReply"
+            "types.ForceReply",
         ] = None,
         progress: Callable = None,
-        progress_args: tuple = ()
+        progress_args: tuple = (),
     ) -> "types.Message":
         """Bound method *reply_voice* of :obj:`~pyrogram.types.Story`.
 
@@ -1380,7 +1404,7 @@ async def reply_voice(
             reply_to_story_id=reply_to_story_id,
             reply_markup=reply_markup,
             progress=progress,
-            progress_args=progress_args
+            progress_args=progress_args,
         )
 
     async def delete(self):
@@ -1406,14 +1430,10 @@ async def delete(self):
             RPCError: In case of a Telegram RPC error.
         """
         return await self._client.delete_stories(
-            chat_id=self.sender_chat.id if self.sender_chat else None,
-            story_ids=self.id
+            chat_id=self.sender_chat.id if self.sender_chat else None, story_ids=self.id
         )
 
-    async def edit_animation(
-        self,
-        animation: Union[str, BinaryIO]
-    ) -> "types.Story":
+    async def edit_animation(self, animation: Union[str, BinaryIO]) -> "types.Story":
         """Bound method *edit_animation* of :obj:`~pyrogram.types.Story`.
 
         Use as a shortcut for:
@@ -1443,7 +1463,7 @@ async def edit_animation(
         return await self._client.edit_story(
             chat_id=self.sender_chat.id if self.sender_chat else None,
             story_id=self.id,
-            animation=animation
+            animation=animation,
         )
 
     async def edit(
@@ -1451,15 +1471,15 @@ async def edit(
         privacy: "enums.StoriesPrivacyRules" = None,
         allowed_users: List[int] = None,
         denied_users: List[int] = None,
-        #allowed_chats: List[int] = None,
-        #denied_chats: List[int] = None,
+        # allowed_chats: List[int] = None,
+        # denied_chats: List[int] = None,
         animation: str = None,
         photo: str = None,
         video: str = None,
         caption: str = None,
         parse_mode: "enums.ParseMode" = None,
         caption_entities: List["types.MessageEntity"] = None,
-        media_areas: List["types.InputMediaArea"] = None
+        media_areas: List["types.InputMediaArea"] = None,
     ) -> "types.Story":
         """Bound method *edit* of :obj:`~pyrogram.types.Story`.
 
@@ -1534,8 +1554,8 @@ async def edit(
             chat_id=self.sender_chat.id if self.sender_chat else None,
             story_id=self.id,
             privacy=privacy,
-            #allowed_chats=allowed_chats,
-            #denied_chats=denied_chats,
+            # allowed_chats=allowed_chats,
+            # denied_chats=denied_chats,
             allowed_users=allowed_users,
             denied_users=denied_users,
             animation=animation,
@@ -1544,14 +1564,14 @@ async def edit(
             caption=caption,
             parse_mode=parse_mode,
             caption_entities=caption_entities,
-            media_areas=media_areas
+            media_areas=media_areas,
         )
 
     async def edit_caption(
         self,
         caption: str,
         parse_mode: Optional["enums.ParseMode"] = None,
-        caption_entities: List["types.MessageEntity"] = None
+        caption_entities: List["types.MessageEntity"] = None,
     ) -> "types.Story":
         """Bound method *edit_caption* of :obj:`~pyrogram.types.Story`.
 
@@ -1591,13 +1611,10 @@ async def edit_caption(
             story_id=self.id,
             caption=caption,
             parse_mode=parse_mode,
-            caption_entities=caption_entities
+            caption_entities=caption_entities,
         )
 
-    async def edit_photo(
-        self,
-        photo: Union[str, BinaryIO]
-    ) -> "types.Story":
+    async def edit_photo(self, photo: Union[str, BinaryIO]) -> "types.Story":
         """Bound method *edit_photo* of :obj:`~pyrogram.types.Story`.
 
         Use as a shortcut for:
@@ -1627,7 +1644,7 @@ async def edit_photo(
         return await self._client.edit_story(
             chat_id=self.sender_chat.id if self.sender_chat else None,
             story_id=self.id,
-            photo=photo
+            photo=photo,
         )
 
     async def edit_privacy(
@@ -1635,8 +1652,8 @@ async def edit_privacy(
         privacy: "enums.StoriesPrivacyRules" = None,
         allowed_users: List[int] = None,
         denied_users: List[int] = None,
-        #allowed_chats: List[int] = None,
-        #denied_chats: List[int] = None
+        # allowed_chats: List[int] = None,
+        # denied_chats: List[int] = None
     ) -> "types.Story":
         """Bound method *edit_privacy* of :obj:`~pyrogram.types.Story`.
 
@@ -1674,16 +1691,13 @@ async def edit_privacy(
             chat_id=self.sender_chat.id if self.sender_chat else None,
             story_id=self.id,
             privacy=privacy,
-            #allowed_chats=allowed_chats,
-            #denied_chats=denied_chats,
+            # allowed_chats=allowed_chats,
+            # denied_chats=denied_chats,
             allowed_users=allowed_users,
-            denied_users=denied_users
+            denied_users=denied_users,
         )
 
-    async def edit_video(
-        self,
-        video: Union[str, BinaryIO]
-    ) -> "types.Story":
+    async def edit_video(self, video: Union[str, BinaryIO]) -> "types.Story":
         """Bound method *edit_video* of :obj:`~pyrogram.types.Story`.
 
         Use as a shortcut for:
@@ -1713,7 +1727,7 @@ async def edit_video(
         return await self._client.edit_story(
             chat_id=self.sender_chat.id if self.sender_chat else None,
             story_id=self.id,
-            video=video
+            video=video,
         )
 
     async def export_link(self) -> "types.ExportedStoryLink":
@@ -1739,7 +1753,10 @@ async def export_link(self) -> "types.ExportedStoryLink":
         Raises:
             RPCError: In case of a Telegram RPC error.
         """
-        return await self._client.export_story_link(chat_id=self.from_user.id if self.from_user else self.sender_chat.id, story_id=self.id)
+        return await self._client.export_story_link(
+            chat_id=self.from_user.id if self.from_user else self.sender_chat.id,
+            story_id=self.id,
+        )
 
     async def forward(
         self,
@@ -1747,14 +1764,14 @@ async def forward(
         privacy: "enums.StoriesPrivacyRules" = None,
         allowed_users: List[int] = None,
         denied_users: List[int] = None,
-        #allowed_chats: List[int] = None,
-        #denied_chats: List[int] = None,
+        # allowed_chats: List[int] = None,
+        # denied_chats: List[int] = None,
         pinned: bool = None,
         protect_content: bool = None,
         caption: str = None,
         parse_mode: "enums.ParseMode" = None,
         caption_entities: List["types.MessageEntity"] = None,
-        period: int = None
+        period: int = None,
     ):
         """Bound method *forward* of :obj:`~pyrogram.types.Message`.
 
@@ -1822,8 +1839,10 @@ async def forward(
             caption_entities=caption_entities,
             parse_mode=parse_mode,
             period=period,
-            forward_from_chat_id=self.from_user.id if self.from_user is not None else self.sender_chat.id,
-            forward_from_story_id=self.id
+            forward_from_chat_id=self.from_user.id
+            if self.from_user is not None
+            else self.sender_chat.id,
+            forward_from_story_id=self.id,
         )
 
     async def download(
@@ -1832,7 +1851,7 @@ async def download(
         in_memory: bool = False,
         block: bool = True,
         progress: Callable = None,
-        progress_args: tuple = ()
+        progress_args: tuple = (),
     ) -> str:
         """Bound method *download* of :obj:`~pyrogram.types.Story`.
 
diff --git a/pyrogram/types/messages_and_media/story_deleted.py b/pyrogram/types/messages_and_media/story_deleted.py
index afe79d5d9..019ec8994 100644
--- a/pyrogram/types/messages_and_media/story_deleted.py
+++ b/pyrogram/types/messages_and_media/story_deleted.py
@@ -23,6 +23,7 @@
 from ..object import Object
 from ..update import Update
 
+
 class StoryDeleted(Object, Update):
     """A deleted story.
 
@@ -32,7 +33,7 @@ class StoryDeleted(Object, Update):
 
         from_user (:obj:`~pyrogram.types.User`, *optional*):
             Sender of the story.
-        
+
         sender_chat (:obj:`~pyrogram.types.Chat`, *optional*):
             Sender of the story. If the story is from channel.
     """
@@ -54,7 +55,7 @@ def __init__(
     async def _parse(
         client: "pyrogram.Client",
         stories: raw.base.StoryItem,
-        peer: Union["raw.types.PeerChannel", "raw.types.PeerUser"]
+        peer: Union["raw.types.PeerChannel", "raw.types.PeerUser"],
     ) -> "StoryDeleted":
         from_user = None
         sender_chat = None
@@ -66,8 +67,5 @@ async def _parse(
             from_user = await client.get_users(peer.user_id)
 
         return StoryDeleted(
-            id=stories.id,
-            from_user=from_user,
-            sender_chat=sender_chat,
-            client=client
+            id=stories.id, from_user=from_user, sender_chat=sender_chat, client=client
         )
diff --git a/pyrogram/types/messages_and_media/story_forward_header.py b/pyrogram/types/messages_and_media/story_forward_header.py
index 2f6b5c85c..8a98e5e47 100644
--- a/pyrogram/types/messages_and_media/story_forward_header.py
+++ b/pyrogram/types/messages_and_media/story_forward_header.py
@@ -31,7 +31,7 @@ class StoryForwardHeader(Object):
 
         sender_name (``str``, *optional*):
             For stories forwarded from users who have hidden their accounts, name of the user.
-        
+
         chat (:obj:`~pyrogram.types.Chat`, *optional*):
             Sender of the story. If the story is from channel.
 
@@ -43,7 +43,8 @@ class StoryForwardHeader(Object):
     """
 
     def __init__(
-        self, *,
+        self,
+        *,
         user: "types.User" = None,
         sender_name: str = None,
         chat: "types.Chat" = None,
@@ -59,23 +60,24 @@ def __init__(
         self.is_modified = is_modified
 
     async def _parse(
-        client: "pyrogram.Client",
-        fwd_header: "raw.types.StoryFwdHeader"
+        client: "pyrogram.Client", fwd_header: "raw.types.StoryFwdHeader"
     ) -> "StoryForwardHeader":
         user = None
         chat = None
         if fwd_header.from_peer is not None:
             if isinstance(fwd_header.from_peer, raw.types.PeerChannel):
-                chat = await client.get_chat(utils.get_channel_id(fwd_header.from_peer.channel_id))
+                chat = await client.get_chat(
+                    utils.get_channel_id(fwd_header.from_peer.channel_id)
+                )
             elif isinstance(fwd_header.from_peer, raw.types.InputPeerSelf):
                 user = client.me
             else:
                 user = await client.get_users(fwd_header.from_peer.user_id)
-        
+
         return StoryForwardHeader(
             user=user,
             sender_name=fwd_header.from_name,
             chat=chat,
             story_id=fwd_header.story_id,
-            is_modified=fwd_header.modified
+            is_modified=fwd_header.modified,
         )
diff --git a/pyrogram/types/messages_and_media/story_skipped.py b/pyrogram/types/messages_and_media/story_skipped.py
index 788c1fc5c..5030fa474 100644
--- a/pyrogram/types/messages_and_media/story_skipped.py
+++ b/pyrogram/types/messages_and_media/story_skipped.py
@@ -24,6 +24,7 @@
 from ..object import Object
 from ..update import Update
 
+
 class StorySkipped(Object, Update):
     """A skipped story.
 
@@ -33,7 +34,7 @@ class StorySkipped(Object, Update):
 
         from_user (:obj:`~pyrogram.types.User`, *optional*):
             Sender of the story.
-        
+
         sender_chat (:obj:`~pyrogram.types.Chat`, *optional*):
             Sender of the story. If the story is from channel.
 
@@ -70,7 +71,7 @@ def __init__(
     async def _parse(
         client: "pyrogram.Client",
         stories: raw.base.StoryItem,
-        peer: Union["raw.types.PeerChannel", "raw.types.PeerUser"]
+        peer: Union["raw.types.PeerChannel", "raw.types.PeerUser"],
     ) -> "StorySkipped":
         from_user = None
         sender_chat = None
@@ -88,5 +89,5 @@ async def _parse(
             date=utils.timestamp_to_datetime(stories.date),
             expire_date=utils.timestamp_to_datetime(stories.expire_date),
             close_friends=stories.close_friends,
-            client=client
+            client=client,
         )
diff --git a/pyrogram/types/messages_and_media/story_views.py b/pyrogram/types/messages_and_media/story_views.py
index 662636a93..87d068f39 100644
--- a/pyrogram/types/messages_and_media/story_views.py
+++ b/pyrogram/types/messages_and_media/story_views.py
@@ -20,6 +20,7 @@
 from typing import List
 from ..object import Object
 
+
 class StoryViews(Object):
     """Contains information about a story viewers.
 
@@ -32,11 +33,7 @@ class StoryViews(Object):
             List of user_id of recent stories viewers.
     """
 
-    def __init__(
-            self, *,
-            view_count: int,
-            recent_viewers: List[int] = None
-    ):
+    def __init__(self, *, view_count: int, recent_viewers: List[int] = None):
         super().__init__()
 
         self.view_count = view_count
@@ -45,6 +42,6 @@ def __init__(
     @staticmethod
     def _parse(storyviews: "raw.types.StoryViews") -> "StoryViews":
         return StoryViews(
-            view_count=getattr(storyviews,"view_count", None),
-            recent_viewers=getattr(storyviews,"recent_viewers", None)
+            view_count=getattr(storyviews, "view_count", None),
+            recent_viewers=getattr(storyviews, "recent_viewers", None),
         )
diff --git a/pyrogram/types/messages_and_media/stripped_thumbnail.py b/pyrogram/types/messages_and_media/stripped_thumbnail.py
index e9756607b..6aba5c963 100644
--- a/pyrogram/types/messages_and_media/stripped_thumbnail.py
+++ b/pyrogram/types/messages_and_media/stripped_thumbnail.py
@@ -29,19 +29,13 @@ class StrippedThumbnail(Object):
             Thumbnail data
     """
 
-    def __init__(
-        self,
-        *,
-        client: "pyrogram.Client" = None,
-        data: bytes
-    ):
+    def __init__(self, *, client: "pyrogram.Client" = None, data: bytes):
         super().__init__(client)
 
         self.data = data
 
     @staticmethod
-    def _parse(client, stripped_thumbnail: "raw.types.PhotoStrippedSize") -> "StrippedThumbnail":
-        return StrippedThumbnail(
-            data=stripped_thumbnail.bytes,
-            client=client
-        )
+    def _parse(
+        client, stripped_thumbnail: "raw.types.PhotoStrippedSize"
+    ) -> "StrippedThumbnail":
+        return StrippedThumbnail(data=stripped_thumbnail.bytes, client=client)
diff --git a/pyrogram/types/messages_and_media/thumbnail.py b/pyrogram/types/messages_and_media/thumbnail.py
index b9cb93e12..995dfc1b6 100644
--- a/pyrogram/types/messages_and_media/thumbnail.py
+++ b/pyrogram/types/messages_and_media/thumbnail.py
@@ -20,7 +20,13 @@
 
 import pyrogram
 from pyrogram import raw
-from pyrogram.file_id import FileId, FileType, FileUniqueId, FileUniqueType, ThumbnailSource
+from pyrogram.file_id import (
+    FileId,
+    FileType,
+    FileUniqueId,
+    FileUniqueType,
+    ThumbnailSource,
+)
 from ..object import Object
 
 
@@ -64,7 +70,9 @@ def __init__(
         self.file_size = file_size
 
     @staticmethod
-    def _parse(client, media: Union["raw.types.Photo", "raw.types.Document"]) -> Optional[List["Thumbnail"]]:
+    def _parse(
+        client, media: Union["raw.types.Photo", "raw.types.Document"]
+    ) -> Optional[List["Thumbnail"]]:
         if isinstance(media, raw.types.Photo):
             raw_thumbs = [i for i in media.sizes if isinstance(i, raw.types.PhotoSize)]
             raw_thumbs.sort(key=lambda p: p.size)
@@ -95,16 +103,15 @@ def _parse(client, media: Union["raw.types.Photo", "raw.types.Document"]) -> Opt
                         thumbnail_source=ThumbnailSource.THUMBNAIL,
                         thumbnail_size=thumb.type,
                         volume_id=0,
-                        local_id=0
+                        local_id=0,
                     ).encode(),
                     file_unique_id=FileUniqueId(
-                        file_unique_type=FileUniqueType.DOCUMENT,
-                        media_id=media.id
+                        file_unique_type=FileUniqueType.DOCUMENT, media_id=media.id
                     ).encode(),
                     width=thumb.w,
                     height=thumb.h,
                     file_size=thumb.size,
-                    client=client
+                    client=client,
                 )
             )
 
diff --git a/pyrogram/types/messages_and_media/venue.py b/pyrogram/types/messages_and_media/venue.py
index 8a26f6006..17e68193e 100644
--- a/pyrogram/types/messages_and_media/venue.py
+++ b/pyrogram/types/messages_and_media/venue.py
@@ -70,5 +70,5 @@ def _parse(client, venue: "raw.types.MessageMediaVenue"):
             address=venue.address,
             foursquare_id=venue.venue_id or None,
             foursquare_type=venue.venue_type,
-            client=client
+            client=client,
         )
diff --git a/pyrogram/types/messages_and_media/video.py b/pyrogram/types/messages_and_media/video.py
index b50f9fca7..44c131d29 100644
--- a/pyrogram/types/messages_and_media/video.py
+++ b/pyrogram/types/messages_and_media/video.py
@@ -106,7 +106,7 @@ def _parse(
         video: "raw.types.Document",
         video_attributes: "raw.types.DocumentAttributeVideo",
         file_name: str,
-        ttl_seconds: int = None
+        ttl_seconds: int = None,
     ) -> "Video":
         return Video(
             file_id=FileId(
@@ -114,11 +114,10 @@ def _parse(
                 dc_id=video.dc_id,
                 media_id=video.id,
                 access_hash=video.access_hash,
-                file_reference=video.file_reference
+                file_reference=video.file_reference,
             ).encode(),
             file_unique_id=FileUniqueId(
-                file_unique_type=FileUniqueType.DOCUMENT,
-                media_id=video.id
+                file_unique_type=FileUniqueType.DOCUMENT, media_id=video.id
             ).encode(),
             width=video_attributes.w,
             height=video_attributes.h,
@@ -130,5 +129,5 @@ def _parse(
             date=utils.timestamp_to_datetime(video.date),
             ttl_seconds=ttl_seconds,
             thumbs=types.Thumbnail._parse(client, video),
-            client=client
+            client=client,
         )
diff --git a/pyrogram/types/messages_and_media/video_note.py b/pyrogram/types/messages_and_media/video_note.py
index 3e6b40d0c..1cb1a5571 100644
--- a/pyrogram/types/messages_and_media/video_note.py
+++ b/pyrogram/types/messages_and_media/video_note.py
@@ -84,7 +84,7 @@ def __init__(
     def _parse(
         client,
         video_note: "raw.types.Document",
-        video_attributes: "raw.types.DocumentAttributeVideo"
+        video_attributes: "raw.types.DocumentAttributeVideo",
     ) -> "VideoNote":
         return VideoNote(
             file_id=FileId(
@@ -92,11 +92,10 @@ def _parse(
                 dc_id=video_note.dc_id,
                 media_id=video_note.id,
                 access_hash=video_note.access_hash,
-                file_reference=video_note.file_reference
+                file_reference=video_note.file_reference,
             ).encode(),
             file_unique_id=FileUniqueId(
-                file_unique_type=FileUniqueType.DOCUMENT,
-                media_id=video_note.id
+                file_unique_type=FileUniqueType.DOCUMENT, media_id=video_note.id
             ).encode(),
             length=video_attributes.w,
             duration=video_attributes.duration,
@@ -104,5 +103,5 @@ def _parse(
             mime_type=video_note.mime_type,
             date=utils.timestamp_to_datetime(video_note.date),
             thumbs=types.Thumbnail._parse(client, video_note),
-            client=client
+            client=client,
         )
diff --git a/pyrogram/types/messages_and_media/voice.py b/pyrogram/types/messages_and_media/voice.py
index 8d1c15f65..59fa67bfd 100644
--- a/pyrogram/types/messages_and_media/voice.py
+++ b/pyrogram/types/messages_and_media/voice.py
@@ -74,23 +74,26 @@ def __init__(
         self.date = date
 
     @staticmethod
-    def _parse(client, voice: "raw.types.Document", attributes: "raw.types.DocumentAttributeAudio") -> "Voice":
+    def _parse(
+        client,
+        voice: "raw.types.Document",
+        attributes: "raw.types.DocumentAttributeAudio",
+    ) -> "Voice":
         return Voice(
             file_id=FileId(
                 file_type=FileType.VOICE,
                 dc_id=voice.dc_id,
                 media_id=voice.id,
                 access_hash=voice.access_hash,
-                file_reference=voice.file_reference
+                file_reference=voice.file_reference,
             ).encode(),
             file_unique_id=FileUniqueId(
-                file_unique_type=FileUniqueType.DOCUMENT,
-                media_id=voice.id
+                file_unique_type=FileUniqueType.DOCUMENT, media_id=voice.id
             ).encode(),
             duration=attributes.duration,
             mime_type=voice.mime_type,
             file_size=voice.size,
             waveform=attributes.waveform,
             date=utils.timestamp_to_datetime(voice.date),
-            client=client
+            client=client,
         )
diff --git a/pyrogram/types/messages_and_media/web_app_data.py b/pyrogram/types/messages_and_media/web_app_data.py
index b9a471fd8..8420ad6a6 100644
--- a/pyrogram/types/messages_and_media/web_app_data.py
+++ b/pyrogram/types/messages_and_media/web_app_data.py
@@ -45,7 +45,4 @@ def __init__(
 
     @staticmethod
     def _parse(action: "raw.types.MessageActionWebViewDataSentMe"):
-        return WebAppData(
-            data=action.data,
-            button_text=action.text
-        )
+        return WebAppData(data=action.data, button_text=action.text)
diff --git a/pyrogram/types/messages_and_media/web_page.py b/pyrogram/types/messages_and_media/web_page.py
index 34e51d88c..856257a7b 100644
--- a/pyrogram/types/messages_and_media/web_page.py
+++ b/pyrogram/types/messages_and_media/web_page.py
@@ -145,9 +145,9 @@ def _parse(client, webpage: "raw.types.WebPage") -> "WebPage":
             attributes = {type(i): i for i in doc.attributes}
 
             file_name = getattr(
-                attributes.get(
-                    raw.types.DocumentAttributeFilename, None
-                ), "file_name", None
+                attributes.get(raw.types.DocumentAttributeFilename, None),
+                "file_name",
+                None,
             )
 
             if raw.types.DocumentAttributeAudio in attributes:
@@ -155,8 +155,12 @@ def _parse(client, webpage: "raw.types.WebPage") -> "WebPage":
                 audio = types.Audio._parse(client, doc, audio_attributes, file_name)
 
             elif raw.types.DocumentAttributeAnimated in attributes:
-                video_attributes = attributes.get(raw.types.DocumentAttributeVideo, None)
-                animation = types.Animation._parse(client, doc, video_attributes, file_name)
+                video_attributes = attributes.get(
+                    raw.types.DocumentAttributeVideo, None
+                )
+                animation = types.Animation._parse(
+                    client, doc, video_attributes, file_name
+                )
 
             elif raw.types.DocumentAttributeVideo in attributes:
                 video_attributes = attributes[raw.types.DocumentAttributeVideo]
@@ -183,5 +187,5 @@ def _parse(client, webpage: "raw.types.WebPage") -> "WebPage":
             embed_width=webpage.embed_width,
             embed_height=webpage.embed_height,
             duration=webpage.duration,
-            author=webpage.author
+            author=webpage.author,
         )
diff --git a/pyrogram/types/messages_and_media/web_page_empty.py b/pyrogram/types/messages_and_media/web_page_empty.py
index 69ecb8ef5..7ebb81a0e 100644
--- a/pyrogram/types/messages_and_media/web_page_empty.py
+++ b/pyrogram/types/messages_and_media/web_page_empty.py
@@ -34,12 +34,7 @@ class WebPageEmpty(Object):
             Full URL for this webpage.
     """
 
-    def __init__(
-        self,
-        *,
-        id: str,
-        url: str
-    ):
+    def __init__(self, *, id: str, url: str):
         super().__init__()
 
         self.id = id
@@ -48,7 +43,4 @@ def __init__(
     @staticmethod
     def _parse(webpage: "raw.types.WebPageEmpty") -> "WebPageEmpty":
 
-        return WebPageEmpty(
-            id=str(webpage.id),
-            url=webpage.url
-        )
+        return WebPageEmpty(id=str(webpage.id), url=webpage.url)
diff --git a/pyrogram/types/messages_and_media/web_page_preview.py b/pyrogram/types/messages_and_media/web_page_preview.py
index a178a199e..9894bbf82 100644
--- a/pyrogram/types/messages_and_media/web_page_preview.py
+++ b/pyrogram/types/messages_and_media/web_page_preview.py
@@ -61,16 +61,16 @@ def __init__(
     def _parse(
         client,
         web_page_preview: Union["raw.types.WebPage", "raw.types.WebPageEmpty"],
-        invert_media: bool = None
+        invert_media: bool = None,
     ):
         if isinstance(web_page_preview.webpage, raw.types.WebPage):
-            webpage=types.WebPage._parse(client, web_page_preview.webpage)
+            webpage = types.WebPage._parse(client, web_page_preview.webpage)
         else:
-            webpage=types.WebPageEmpty._parse(web_page_preview.webpage)
+            webpage = types.WebPageEmpty._parse(web_page_preview.webpage)
         return WebPagePreview(
             webpage=webpage,
             force_large_media=web_page_preview.force_large_media,
             force_small_media=web_page_preview.force_small_media,
             invert_media=invert_media,
-            is_safe=web_page_preview.safe
+            is_safe=web_page_preview.safe,
         )
diff --git a/pyrogram/types/object.py b/pyrogram/types/object.py
index 3253c8ecf..6d0392547 100644
--- a/pyrogram/types/object.py
+++ b/pyrogram/types/object.py
@@ -63,13 +63,10 @@ def default(obj: "Object"):
         return {
             "_": obj.__class__.__name__,
             **{
-                attr: (
-                    "*" * 9 if attr == "phone_number" else
-                    getattr(obj, attr)
-                )
+                attr: ("*" * 9 if attr == "phone_number" else getattr(obj, attr))
                 for attr in filter(lambda x: not x.startswith("_"), obj.__dict__)
                 if getattr(obj, attr) is not None
-            }
+            },
         }
 
     def __str__(self) -> str:
@@ -82,7 +79,7 @@ def __repr__(self) -> str:
                 f"{attr}={repr(getattr(self, attr))}"
                 for attr in filter(lambda x: not x.startswith("_"), self.__dict__)
                 if getattr(self, attr) is not None
-            )
+            ),
         )
 
     def __eq__(self, other: "Object") -> bool:
diff --git a/pyrogram/types/pyromod/__init__.py b/pyrogram/types/pyromod/__init__.py
index 7929f2209..57631e679 100644
--- a/pyrogram/types/pyromod/__init__.py
+++ b/pyrogram/types/pyromod/__init__.py
@@ -1,4 +1,4 @@
 from .identifier import Identifier
 from .listener import Listener
 
-__all__ = ["Identifier", "Listener"]
\ No newline at end of file
+__all__ = ["Identifier", "Listener"]
diff --git a/pyrogram/types/pyromod/identifier.py b/pyrogram/types/pyromod/identifier.py
index f07eff4b6..3db440c6d 100644
--- a/pyrogram/types/pyromod/identifier.py
+++ b/pyrogram/types/pyromod/identifier.py
@@ -20,6 +20,7 @@
 from dataclasses import dataclass
 from typing import Optional, Union, List
 
+
 @dataclass
 class Identifier:
     """A dataclass that serves as a utility for matching listeners to the data of updates.
@@ -37,6 +38,7 @@ class Identifier:
         from_user_id (``int`` | ``str`` | Iterable of ``int`` | Iterable of ``str``, *optional*):
             The user ID to match. If None, it is not considered for matching.
     """
+
     inline_message_id: Optional[Union[str, List[str]]] = None
     chat_id: Optional[Union[Union[int, str], List[Union[int, str]]]] = None
     message_id: Optional[Union[int, List[int]]] = None
@@ -71,4 +73,4 @@ def count_populated(self):
             if getattr(self, attr) is not None:
                 non_null_count += 1
 
-        return non_null_count
\ No newline at end of file
+        return non_null_count
diff --git a/pyrogram/types/pyromod/listener.py b/pyrogram/types/pyromod/listener.py
index 81c335d62..5a8f7c3b2 100644
--- a/pyrogram/types/pyromod/listener.py
+++ b/pyrogram/types/pyromod/listener.py
@@ -25,6 +25,7 @@
 
 from .identifier import Identifier
 
+
 @dataclass
 class Listener:
     """Designed to manage and handle different types of listeners used in pyromod.
@@ -53,6 +54,7 @@ class Listener:
         callback (``Callable``, *optional*):
             The callback to call when the listener is fulfilled.
     """
+
     listener_type: pyrogram.enums.ListenerTypes
     filters: "pyrogram.filters.Filter"
     unallowed_click_alert: bool
diff --git a/pyrogram/types/user_and_chats/__init__.py b/pyrogram/types/user_and_chats/__init__.py
index 54979ddc1..c353b1d84 100644
--- a/pyrogram/types/user_and_chats/__init__.py
+++ b/pyrogram/types/user_and_chats/__init__.py
@@ -88,5 +88,5 @@
     "ChatPrivileges",
     "ChatJoiner",
     "EmojiStatus",
-    "ChatReactions"
+    "ChatReactions",
 ]
diff --git a/pyrogram/types/user_and_chats/chat.py b/pyrogram/types/user_and_chats/chat.py
index e5c538a74..00b097779 100644
--- a/pyrogram/types/user_and_chats/chat.py
+++ b/pyrogram/types/user_and_chats/chat.py
@@ -226,7 +226,7 @@ def __init__(
         available_reactions: Optional["types.ChatReactions"] = None,
         usernames: List["types.Username"] = None,
         reply_color: "types.ChatColor" = None,
-        profile_color: "types.ChatColor" = None
+        profile_color: "types.ChatColor" = None,
     ):
         super().__init__(client)
 
@@ -274,7 +274,11 @@ def __init__(
 
     @property
     def full_name(self) -> str:
-        return " ".join(filter(None, [self.first_name, self.last_name])) or self.title or None
+        return (
+            " ".join(filter(None, [self.first_name, self.last_name]))
+            or self.title
+            or None
+        )
 
     @staticmethod
     def _parse_user_chat(client, user: raw.types.User) -> "Chat":
@@ -292,11 +296,16 @@ def _parse_user_chat(client, user: raw.types.User) -> "Chat":
             first_name=user.first_name,
             last_name=user.last_name,
             photo=types.ChatPhoto._parse(client, user.photo, peer_id, user.access_hash),
-            restrictions=types.List([types.Restriction._parse(r) for r in user.restriction_reason]) or None,
+            restrictions=types.List(
+                [types.Restriction._parse(r) for r in user.restriction_reason]
+            )
+            or None,
             dc_id=getattr(getattr(user, "photo", None), "dc_id", None),
             reply_color=types.ChatColor._parse(getattr(user, "color", None)),
-            profile_color=types.ChatColor._parse_profile_color(getattr(user, "profile_color", None)),
-            client=client
+            profile_color=types.ChatColor._parse_profile_color(
+                getattr(user, "profile_color", None)
+            ),
+            client=client,
         )
 
     @staticmethod
@@ -314,13 +323,17 @@ def _parse_chat_chat(client, chat: raw.types.Chat) -> "Chat":
             type=enums.ChatType.GROUP,
             title=chat.title,
             is_creator=getattr(chat, "creator", None),
-            photo=types.ChatPhoto._parse(client, getattr(chat, "photo", None), peer_id, 0),
-            permissions=types.ChatPermissions._parse(getattr(chat, "default_banned_rights", None)),
+            photo=types.ChatPhoto._parse(
+                client, getattr(chat, "photo", None), peer_id, 0
+            ),
+            permissions=types.ChatPermissions._parse(
+                getattr(chat, "default_banned_rights", None)
+            ),
             members_count=getattr(chat, "participants_count", None),
             dc_id=getattr(getattr(chat, "photo", None), "dc_id", None),
             has_protected_content=getattr(chat, "noforwards", None),
             usernames=usernames,
-            client=client
+            client=client,
         )
 
     @staticmethod
@@ -343,7 +356,9 @@ def _parse_channel_chat(client, channel: raw.types.Channel) -> "Chat":
 
         return Chat(
             id=peer_id,
-            type=enums.ChatType.SUPERGROUP if getattr(channel, "megagroup", None) else enums.ChatType.CHANNEL,
+            type=enums.ChatType.SUPERGROUP
+            if getattr(channel, "megagroup", None)
+            else enums.ChatType.CHANNEL,
             is_verified=getattr(channel, "verified", None),
             is_restricted=getattr(channel, "restricted", None),
             is_creator=getattr(channel, "creator", None),
@@ -356,15 +371,24 @@ def _parse_channel_chat(client, channel: raw.types.Channel) -> "Chat":
             title=channel.title,
             username=user_name,
             usernames=usernames,
-            photo=types.ChatPhoto._parse(client, getattr(channel, "photo", None), peer_id,
-                                         getattr(channel, "access_hash", 0)),
-            restrictions=types.List([types.Restriction._parse(r) for r in restriction_reason]) or None,
-            permissions=types.ChatPermissions._parse(getattr(channel, "default_banned_rights", None)),
+            photo=types.ChatPhoto._parse(
+                client,
+                getattr(channel, "photo", None),
+                peer_id,
+                getattr(channel, "access_hash", 0),
+            ),
+            restrictions=types.List(
+                [types.Restriction._parse(r) for r in restriction_reason]
+            )
+            or None,
+            permissions=types.ChatPermissions._parse(
+                getattr(channel, "default_banned_rights", None)
+            ),
             members_count=getattr(channel, "participants_count", None),
             dc_id=getattr(getattr(channel, "photo", None), "dc_id", None),
             has_protected_content=getattr(channel, "noforwards", None),
             reply_color=types.ChatColor._parse(getattr(channel, "color", None)),
-            client=client
+            client=client,
         )
 
     @staticmethod
@@ -373,7 +397,7 @@ def _parse(
         message: Union[raw.types.Message, raw.types.MessageService],
         users: dict,
         chats: dict,
-        is_chat: bool
+        is_chat: bool,
     ) -> "Chat":
         from_id = utils.get_raw_peer_id(message.from_id)
         peer_id = utils.get_raw_peer_id(message.peer_id)
@@ -397,7 +421,9 @@ def _parse_dialog(client, peer, users: dict, chats: dict):
             return Chat._parse_channel_chat(client, chats[peer.channel_id])
 
     @staticmethod
-    async def _parse_full(client, chat_full: Union[raw.types.messages.ChatFull, raw.types.users.UserFull]) -> "Chat":
+    async def _parse_full(
+        client, chat_full: Union[raw.types.messages.ChatFull, raw.types.users.UserFull]
+    ) -> "Chat":
         users = {u.id: u for u in chat_full.users}
         chats = {c.id: c for c in chat_full.chats}
 
@@ -410,23 +436,27 @@ async def _parse_full(client, chat_full: Union[raw.types.messages.ChatFull, raw.
 
             if full_user.pinned_msg_id:
                 parsed_chat.pinned_message = await client.get_messages(
-                    parsed_chat.id,
-                    message_ids=full_user.pinned_msg_id
+                    parsed_chat.id, message_ids=full_user.pinned_msg_id
                 )
 
             if getattr(full_user, "stories"):
                 peer_stories: raw.types.PeerStories = full_user.stories
-                parsed_chat.stories = types.List(
-                    [
-                        await types.Story._parse(
-                            client, story, peer_stories.peer
-                        )
-                        for story in peer_stories.stories
-                    ]
-                ) or None
+                parsed_chat.stories = (
+                    types.List(
+                        [
+                            await types.Story._parse(client, story, peer_stories.peer)
+                            for story in peer_stories.stories
+                        ]
+                    )
+                    or None
+                )
 
-            if getattr(full_user, "wallpaper") and isinstance(full_user.wallpaper, raw.types.WallPaper):
-                parsed_chat.wallpaper = types.Document._parse(client, full_user.wallpaper.document, "wallpaper.jpg")
+            if getattr(full_user, "wallpaper") and isinstance(
+                full_user.wallpaper, raw.types.WallPaper
+            ):
+                parsed_chat.wallpaper = types.Document._parse(
+                    client, full_user.wallpaper.document, "wallpaper.jpg"
+                )
         else:
             full_chat = chat_full.full_chat
             chat_raw = chats[full_chat.id]
@@ -440,11 +470,15 @@ async def _parse_full(client, chat_full: Union[raw.types.messages.ChatFull, raw.
             else:
                 parsed_chat = Chat._parse_channel_chat(client, chat_raw)
                 parsed_chat.members_count = full_chat.participants_count
-                parsed_chat.slow_mode_delay = getattr(full_chat, "slowmode_seconds", None)
+                parsed_chat.slow_mode_delay = getattr(
+                    full_chat, "slowmode_seconds", None
+                )
                 parsed_chat.description = full_chat.about or None
                 # TODO: Add StickerSet type
                 parsed_chat.can_set_sticker_set = full_chat.can_set_stickers
-                parsed_chat.sticker_set_name = getattr(full_chat.stickerset, "short_name", None)
+                parsed_chat.sticker_set_name = getattr(
+                    full_chat.stickerset, "short_name", None
+                )
                 parsed_chat.is_participants_hidden = full_chat.participants_hidden
                 parsed_chat.is_antispam = full_chat.antispam
                 parsed_chat.folder_id = getattr(full_chat, "folder_id", None)
@@ -452,7 +486,9 @@ async def _parse_full(client, chat_full: Union[raw.types.messages.ChatFull, raw.
                 linked_chat_raw = chats.get(full_chat.linked_chat_id, None)
 
                 if linked_chat_raw:
-                    parsed_chat.linked_chat = Chat._parse_channel_chat(client, linked_chat_raw)
+                    parsed_chat.linked_chat = Chat._parse_channel_chat(
+                        client, linked_chat_raw
+                    )
 
                 default_send_as = full_chat.default_send_as
 
@@ -466,36 +502,43 @@ async def _parse_full(client, chat_full: Union[raw.types.messages.ChatFull, raw.
 
                 if getattr(full_chat, "stories"):
                     peer_stories: raw.types.PeerStories = full_chat.stories
-                    parsed_chat.stories = types.List(
-                        [
-                            await types.Story._parse(
-                                client, story, peer_stories.peer
-                            )
-                            for story in peer_stories.stories
-                        ]
-                    ) or None
+                    parsed_chat.stories = (
+                        types.List(
+                            [
+                                await types.Story._parse(
+                                    client, story, peer_stories.peer
+                                )
+                                for story in peer_stories.stories
+                            ]
+                        )
+                        or None
+                    )
 
-                if getattr(full_chat, "wallpaper") and isinstance(full_chat.wallpaper, raw.types.WallPaper):
-                    parsed_chat.wallpaper = types.Document._parse(client, full_chat.wallpaper.document, "wallpaper.jpg")
+                if getattr(full_chat, "wallpaper") and isinstance(
+                    full_chat.wallpaper, raw.types.WallPaper
+                ):
+                    parsed_chat.wallpaper = types.Document._parse(
+                        client, full_chat.wallpaper.document, "wallpaper.jpg"
+                    )
 
             if full_chat.pinned_msg_id:
                 parsed_chat.pinned_message = await client.get_messages(
-                    parsed_chat.id,
-                    message_ids=full_chat.pinned_msg_id
+                    parsed_chat.id, message_ids=full_chat.pinned_msg_id
                 )
 
             if isinstance(full_chat.exported_invite, raw.types.ChatInviteExported):
                 parsed_chat.invite_link = full_chat.exported_invite.link
 
             parsed_chat.available_reactions = types.ChatReactions._parse(
-                client,
-                full_chat.available_reactions
+                client, full_chat.available_reactions
             )
 
         return parsed_chat
 
     @staticmethod
-    def _parse_chat(client, chat: Union[raw.types.Chat, raw.types.User, raw.types.Channel]) -> "Chat":
+    def _parse_chat(
+        client, chat: Union[raw.types.Chat, raw.types.User, raw.types.Channel]
+    ) -> "Chat":
         if isinstance(chat, (raw.types.Chat, raw.types.ChatForbidden)):
             return Chat._parse_chat_chat(client, chat)
         elif isinstance(chat, raw.types.User):
@@ -505,7 +548,7 @@ def _parse_chat(client, chat: Union[raw.types.Chat, raw.types.User, raw.types.Ch
 
     def listen(self, *args, **kwargs):
         """Bound method *listen* of :obj:`~pyrogram.types.Chat`.
-        
+
         Use as a shortcut for:
 
         .. code-block:: python
@@ -534,7 +577,7 @@ def listen(self, *args, **kwargs):
 
     def ask(self, text, *args, **kwargs):
         """Bound method *ask* of :obj:`~pyrogram.types.Chat`.
-        
+
         Use as a shortcut for:
 
         .. code-block:: python
@@ -568,7 +611,7 @@ def ask(self, text, *args, **kwargs):
 
     def stop_listening(self, *args, **kwargs):
         """Bound method *stop_listening* of :obj:`~pyrogram.types.Chat`.
-        
+
         Use as a shortcut for:
 
         .. code-block:: python
@@ -670,10 +713,7 @@ async def set_title(self, title: str) -> bool:
             ValueError: In case a chat_id belongs to user.
         """
 
-        return await self._client.set_chat_title(
-            chat_id=self.id,
-            title=title
-        )
+        return await self._client.set_chat_title(chat_id=self.id, title=title)
 
     async def set_description(self, description: str) -> bool:
         """Bound method *set_description* of :obj:`~pyrogram.types.Chat`.
@@ -705,8 +745,7 @@ async def set_description(self, description: str) -> bool:
         """
 
         return await self._client.set_chat_description(
-            chat_id=self.id,
-            description=description
+            chat_id=self.id, description=description
         )
 
     async def set_photo(
@@ -766,16 +805,11 @@ async def set_photo(
         """
 
         return await self._client.set_chat_photo(
-            chat_id=self.id,
-            photo=photo,
-            video=video,
-            video_start_ts=video_start_ts
+            chat_id=self.id, photo=photo, video=video, video_start_ts=video_start_ts
         )
 
     async def ban_member(
-        self,
-        user_id: Union[int, str],
-        until_date: datetime = utils.zero_datetime()
+        self, user_id: Union[int, str], until_date: datetime = utils.zero_datetime()
     ) -> Union["types.Message", bool]:
         """Bound method *ban_member* of :obj:`~pyrogram.types.Chat`.
 
@@ -817,15 +851,10 @@ async def ban_member(
         """
 
         return await self._client.ban_chat_member(
-            chat_id=self.id,
-            user_id=user_id,
-            until_date=until_date
+            chat_id=self.id, user_id=user_id, until_date=until_date
         )
 
-    async def unban_member(
-        self,
-        user_id: Union[int, str]
-    ) -> bool:
+    async def unban_member(self, user_id: Union[int, str]) -> bool:
         """Bound method *unban_member* of :obj:`~pyrogram.types.Chat`.
 
         Use as a shortcut for:
@@ -912,9 +941,7 @@ async def restrict_member(
     # Set None as privileges default due to issues with partially initialized module, because at the time Chat
     # is being initialized, ChatPrivileges would be required here, but was not initialized yet.
     async def promote_member(
-        self,
-        user_id: Union[int, str],
-        privileges: "types.ChatPrivileges" = None
+        self, user_id: Union[int, str], privileges: "types.ChatPrivileges" = None
     ) -> bool:
         """Bound method *promote_member* of :obj:`~pyrogram.types.Chat`.
 
@@ -949,9 +976,7 @@ async def promote_member(
         """
 
         return await self._client.promote_chat_member(
-            chat_id=self.id,
-            user_id=user_id,
-            privileges=privileges
+            chat_id=self.id, user_id=user_id, privileges=privileges
         )
 
     async def join(self):
@@ -1047,16 +1072,13 @@ async def get_member(
             :obj:`~pyrogram.types.ChatMember`: On success, a chat member is returned.
         """
 
-        return await self._client.get_chat_member(
-            self.id,
-            user_id=user_id
-        )
+        return await self._client.get_chat_member(self.id, user_id=user_id)
 
     def get_members(
         self,
         query: str = "",
         limit: int = 0,
-        filter: "enums.ChatMembersFilter" = enums.ChatMembersFilter.SEARCH
+        filter: "enums.ChatMembersFilter" = enums.ChatMembersFilter.SEARCH,
     ) -> Optional[AsyncGenerator["types.ChatMember", None]]:
         """Bound method *get_members* of :obj:`~pyrogram.types.Chat`.
 
@@ -1093,16 +1115,13 @@ def get_members(
         """
 
         return self._client.get_chat_members(
-            self.id,
-            query=query,
-            limit=limit,
-            filter=filter
+            self.id, query=query, limit=limit, filter=filter
         )
 
     async def add_members(
         self,
         user_ids: Union[Union[int, str], List[Union[int, str]]],
-        forward_limit: int = 100
+        forward_limit: int = 100,
     ) -> bool:
         """Bound method *add_members* of :obj:`~pyrogram.types.Chat`.
 
@@ -1122,12 +1141,12 @@ async def add_members(
         """
 
         return await self._client.add_chat_members(
-            self.id,
-            user_ids=user_ids,
-            forward_limit=forward_limit
+            self.id, user_ids=user_ids, forward_limit=forward_limit
         )
 
-    async def mark_unread(self, ) -> bool:
+    async def mark_unread(
+        self,
+    ) -> bool:
         """Bound method *mark_unread* of :obj:`~pyrogram.types.Chat`.
 
         Use as a shortcut for:
@@ -1169,10 +1188,7 @@ async def set_protected_content(self, enabled: bool) -> bool:
             ``bool``: On success, True is returned.
         """
 
-        return await self._client.set_chat_protected_content(
-            self.id,
-            enabled=enabled
-        )
+        return await self._client.set_chat_protected_content(self.id, enabled=enabled)
 
     async def unpin_all_messages(self) -> bool:
         """Bound method *unpin_all_messages* of :obj:`~pyrogram.types.Chat`.
diff --git a/pyrogram/types/user_and_chats/chat_admin_with_invite_links.py b/pyrogram/types/user_and_chats/chat_admin_with_invite_links.py
index 385a38da4..1d1a592bb 100644
--- a/pyrogram/types/user_and_chats/chat_admin_with_invite_links.py
+++ b/pyrogram/types/user_and_chats/chat_admin_with_invite_links.py
@@ -39,7 +39,8 @@ class ChatAdminWithInviteLinks(Object):
     """
 
     def __init__(
-        self, *,
+        self,
+        *,
         admin: "types.User",
         chat_invite_links_count: int,
         revoked_chat_invite_links_count: int = None
@@ -54,10 +55,10 @@ def __init__(
     def _parse(
         client: "pyrogram.Client",
         admin: "raw.types.ChatAdminWithInvites",
-        users: Dict[int, "raw.types.User"] = None
+        users: Dict[int, "raw.types.User"] = None,
     ) -> "ChatAdminWithInviteLinks":
         return ChatAdminWithInviteLinks(
             admin=types.User._parse(client, users[admin.admin_id]),
             chat_invite_links_count=admin.invites_count,
-            revoked_chat_invite_links_count=admin.revoked_invites_count
+            revoked_chat_invite_links_count=admin.revoked_invites_count,
         )
diff --git a/pyrogram/types/user_and_chats/chat_color.py b/pyrogram/types/user_and_chats/chat_color.py
index 88a59eece..69a7f9f4b 100644
--- a/pyrogram/types/user_and_chats/chat_color.py
+++ b/pyrogram/types/user_and_chats/chat_color.py
@@ -49,16 +49,22 @@ def _parse(color: "raw.types.PeerColor" = None) -> Optional["ChatColor"]:
             return None
 
         return ChatColor(
-            color=enums.ReplyColor(color.color) if getattr(color, "color", None) else None,
-            background_emoji_id=getattr(color, "background_emoji_id", None)
+            color=enums.ReplyColor(color.color)
+            if getattr(color, "color", None)
+            else None,
+            background_emoji_id=getattr(color, "background_emoji_id", None),
         )
 
     @staticmethod
-    def _parse_profile_color(color: "raw.types.PeerColor" = None) -> Optional["ChatColor"]:
+    def _parse_profile_color(
+        color: "raw.types.PeerColor" = None,
+    ) -> Optional["ChatColor"]:
         if not color:
             return None
 
         return ChatColor(
-            color=enums.ProfileColor(color.color) if getattr(color, "color", None) else None,
-            background_emoji_id=getattr(color, "background_emoji_id", None)
-        )
\ No newline at end of file
+            color=enums.ProfileColor(color.color)
+            if getattr(color, "color", None)
+            else None,
+            background_emoji_id=getattr(color, "background_emoji_id", None),
+        )
diff --git a/pyrogram/types/user_and_chats/chat_event.py b/pyrogram/types/user_and_chats/chat_event.py
index 987e76bdf..3c7bbd4ca 100644
--- a/pyrogram/types/user_and_chats/chat_event.py
+++ b/pyrogram/types/user_and_chats/chat_event.py
@@ -146,69 +146,50 @@ class ChatEvent(Object):
     """
 
     def __init__(
-        self, *,
+        self,
+        *,
         id: int,
         date: datetime,
         user: "types.User",
         action: str,
-
         old_description: str = None,
         new_description: str = None,
-
         old_history_ttl: int = None,
         new_history_ttl: int = None,
-
         old_linked_chat: "types.Chat" = None,
         new_linked_chat: "types.Chat" = None,
-
         old_photo: "types.Photo" = None,
         new_photo: "types.Photo" = None,
-
         old_title: str = None,
         new_title: str = None,
-
         old_username: str = None,
         new_username: str = None,
-
         old_chat_permissions: "types.ChatPermissions" = None,
         new_chat_permissions: "types.ChatPermissions" = None,
-
         deleted_message: "types.Message" = None,
-
         old_message: "types.Message" = None,
         new_message: "types.Message" = None,
-
         invited_member: "types.ChatMember" = None,
-
         old_administrator_privileges: "types.ChatMember" = None,
         new_administrator_privileges: "types.ChatMember" = None,
-
         old_member_permissions: "types.ChatMember" = None,
         new_member_permissions: "types.ChatMember" = None,
-
         stopped_poll: "types.Message" = None,
-
         invites_enabled: "types.ChatMember" = None,
-
         history_hidden: bool = None,
-
         signatures_enabled: bool = None,
-
         old_slow_mode: int = None,
         new_slow_mode: int = None,
-
         pinned_message: "types.Message" = None,
         unpinned_message: "types.Message" = None,
-
         old_invite_link: "types.ChatInviteLink" = None,
         new_invite_link: "types.ChatInviteLink" = None,
         revoked_invite_link: "types.ChatInviteLink" = None,
         deleted_invite_link: "types.ChatInviteLink" = None,
-
         created_forum_topic: "types.ForumTopic" = None,
         old_forum_topic: "types.ForumTopic" = None,
         new_forum_topic: "types.ForumTopic" = None,
-        deleted_forum_topic: "types.ForumTopic" = None
+        deleted_forum_topic: "types.ForumTopic" = None,
     ):
         super().__init__()
 
@@ -280,7 +261,7 @@ async def _parse(
         client: "pyrogram.Client",
         event: "raw.base.ChannelAdminLogEvent",
         users: List["raw.base.User"],
-        chats: List["raw.base.Chat"]
+        chats: List["raw.base.Chat"],
     ):
         users = {i.id: i for i in users}
         chats = {i.id: i for i in chats}
@@ -376,36 +357,64 @@ async def _parse(
             new_username = action.new_value
             action = enums.ChatEventAction.USERNAME_CHANGED
 
-        elif isinstance(action, raw.types.ChannelAdminLogEventActionDefaultBannedRights):
-            old_chat_permissions = types.ChatPermissions._parse(action.prev_banned_rights)
-            new_chat_permissions = types.ChatPermissions._parse(action.new_banned_rights)
+        elif isinstance(
+            action, raw.types.ChannelAdminLogEventActionDefaultBannedRights
+        ):
+            old_chat_permissions = types.ChatPermissions._parse(
+                action.prev_banned_rights
+            )
+            new_chat_permissions = types.ChatPermissions._parse(
+                action.new_banned_rights
+            )
             action = enums.ChatEventAction.CHAT_PERMISSIONS_CHANGED
 
         elif isinstance(action, raw.types.ChannelAdminLogEventActionDeleteMessage):
-            deleted_message = await types.Message._parse(client, action.message, users, chats)
+            deleted_message = await types.Message._parse(
+                client, action.message, users, chats
+            )
             action = enums.ChatEventAction.MESSAGE_DELETED
 
         elif isinstance(action, raw.types.ChannelAdminLogEventActionEditMessage):
-            old_message = await types.Message._parse(client, action.prev_message, users, chats)
-            new_message = await types.Message._parse(client, action.new_message, users, chats)
+            old_message = await types.Message._parse(
+                client, action.prev_message, users, chats
+            )
+            new_message = await types.Message._parse(
+                client, action.new_message, users, chats
+            )
             action = enums.ChatEventAction.MESSAGE_EDITED
 
         elif isinstance(action, raw.types.ChannelAdminLogEventActionParticipantInvite):
-            invited_member = types.ChatMember._parse(client, action.participant, users, chats)
+            invited_member = types.ChatMember._parse(
+                client, action.participant, users, chats
+            )
             action = enums.ChatEventAction.MEMBER_INVITED
 
-        elif isinstance(action, raw.types.ChannelAdminLogEventActionParticipantToggleAdmin):
-            old_administrator_privileges = types.ChatMember._parse(client, action.prev_participant, users, chats)
-            new_administrator_privileges = types.ChatMember._parse(client, action.new_participant, users, chats)
+        elif isinstance(
+            action, raw.types.ChannelAdminLogEventActionParticipantToggleAdmin
+        ):
+            old_administrator_privileges = types.ChatMember._parse(
+                client, action.prev_participant, users, chats
+            )
+            new_administrator_privileges = types.ChatMember._parse(
+                client, action.new_participant, users, chats
+            )
             action = enums.ChatEventAction.ADMINISTRATOR_PRIVILEGES_CHANGED
 
-        elif isinstance(action, raw.types.ChannelAdminLogEventActionParticipantToggleBan):
-            old_member_permissions = types.ChatMember._parse(client, action.prev_participant, users, chats)
-            new_member_permissions = types.ChatMember._parse(client, action.new_participant, users, chats)
+        elif isinstance(
+            action, raw.types.ChannelAdminLogEventActionParticipantToggleBan
+        ):
+            old_member_permissions = types.ChatMember._parse(
+                client, action.prev_participant, users, chats
+            )
+            new_member_permissions = types.ChatMember._parse(
+                client, action.new_participant, users, chats
+            )
             action = enums.ChatEventAction.MEMBER_PERMISSIONS_CHANGED
 
         elif isinstance(action, raw.types.ChannelAdminLogEventActionStopPoll):
-            stopped_poll = await types.Message._parse(client, action.message, users, chats)
+            stopped_poll = await types.Message._parse(
+                client, action.message, users, chats
+            )
             action = enums.ChatEventAction.POLL_STOPPED
 
         elif isinstance(action, raw.types.ChannelAdminLogEventActionParticipantJoin):
@@ -418,7 +427,9 @@ async def _parse(
             invites_enabled = action.new_value
             action = enums.ChatEventAction.INVITES_ENABLED
 
-        elif isinstance(action, raw.types.ChannelAdminLogEventActionTogglePreHistoryHidden):
+        elif isinstance(
+            action, raw.types.ChannelAdminLogEventActionTogglePreHistoryHidden
+        ):
             history_hidden = action.new_value
             action = enums.ChatEventAction.HISTORY_HIDDEN
 
@@ -435,23 +446,39 @@ async def _parse(
             message = action.message
 
             if message.pinned:
-                pinned_message = await types.Message._parse(client, message, users, chats)
+                pinned_message = await types.Message._parse(
+                    client, message, users, chats
+                )
                 action = enums.ChatEventAction.MESSAGE_PINNED
             else:
-                unpinned_message = await types.Message._parse(client, message, users, chats)
+                unpinned_message = await types.Message._parse(
+                    client, message, users, chats
+                )
                 action = enums.ChatEventAction.MESSAGE_UNPINNED
 
         elif isinstance(action, raw.types.ChannelAdminLogEventActionExportedInviteEdit):
-            old_invite_link = types.ChatInviteLink._parse(client, action.prev_invite, users)
-            new_invite_link = types.ChatInviteLink._parse(client, action.new_invite, users)
+            old_invite_link = types.ChatInviteLink._parse(
+                client, action.prev_invite, users
+            )
+            new_invite_link = types.ChatInviteLink._parse(
+                client, action.new_invite, users
+            )
             action = enums.ChatEventAction.INVITE_LINK_EDITED
 
-        elif isinstance(action, raw.types.ChannelAdminLogEventActionExportedInviteRevoke):
-            revoked_invite_link = types.ChatInviteLink._parse(client, action.invite, users)
+        elif isinstance(
+            action, raw.types.ChannelAdminLogEventActionExportedInviteRevoke
+        ):
+            revoked_invite_link = types.ChatInviteLink._parse(
+                client, action.invite, users
+            )
             action = enums.ChatEventAction.INVITE_LINK_REVOKED
 
-        elif isinstance(action, raw.types.ChannelAdminLogEventActionExportedInviteDelete):
-            deleted_invite_link = types.ChatInviteLink._parse(client, action.invite, users)
+        elif isinstance(
+            action, raw.types.ChannelAdminLogEventActionExportedInviteDelete
+        ):
+            deleted_invite_link = types.ChatInviteLink._parse(
+                client, action.invite, users
+            )
             action = enums.ChatEventAction.INVITE_LINK_DELETED
 
         elif isinstance(action, raw.types.ChannelAdminLogEventActionCreateTopic):
@@ -477,52 +504,34 @@ async def _parse(
             action=action,
             old_description=old_description,
             new_description=new_description,
-
             old_history_ttl=old_history_ttl,
             new_history_ttl=new_history_ttl,
-
             old_linked_chat=old_linked_chat,
             new_linked_chat=new_linked_chat,
-
             old_photo=old_photo,
             new_photo=new_photo,
-
             old_title=old_title,
             new_title=new_title,
-
             old_username=old_username,
             new_username=new_username,
-
             old_chat_permissions=old_chat_permissions,
             new_chat_permissions=new_chat_permissions,
-
             deleted_message=deleted_message,
-
             old_message=old_message,
             new_message=new_message,
-
             invited_member=invited_member,
-
             old_administrator_privileges=old_administrator_privileges,
             new_administrator_privileges=new_administrator_privileges,
-
             old_member_permissions=old_member_permissions,
             new_member_permissions=new_member_permissions,
-
             stopped_poll=stopped_poll,
-
             invites_enabled=invites_enabled,
-
             history_hidden=history_hidden,
-
             signatures_enabled=signatures_enabled,
-
             old_slow_mode=old_slow_mode,
             new_slow_mode=new_slow_mode,
-
             pinned_message=pinned_message,
             unpinned_message=unpinned_message,
-
             old_invite_link=old_invite_link,
             new_invite_link=new_invite_link,
             revoked_invite_link=revoked_invite_link,
@@ -530,5 +539,5 @@ async def _parse(
             created_forum_topic=created_forum_topic,
             old_forum_topic=old_forum_topic,
             new_forum_topic=new_forum_topic,
-            deleted_forum_topic=deleted_forum_topic
+            deleted_forum_topic=deleted_forum_topic,
         )
diff --git a/pyrogram/types/user_and_chats/chat_event_filter.py b/pyrogram/types/user_and_chats/chat_event_filter.py
index 92298ea3b..398d9c4a5 100644
--- a/pyrogram/types/user_and_chats/chat_event_filter.py
+++ b/pyrogram/types/user_and_chats/chat_event_filter.py
@@ -72,7 +72,8 @@ class ChatEventFilter(Object):
     """
 
     def __init__(
-        self, *,
+        self,
+        *,
         new_restrictions: bool = False,
         new_privileges: bool = False,
         new_members: bool = False,
@@ -171,5 +172,5 @@ def write(self) -> "raw.base.ChannelAdminLogEventsFilter":
             edit=edit,
             delete=delete,
             group_call=group_call,
-            invites=invites
+            invites=invites,
         )
diff --git a/pyrogram/types/user_and_chats/chat_invite_link.py b/pyrogram/types/user_and_chats/chat_invite_link.py
index 59f6315ba..3edc0d358 100644
--- a/pyrogram/types/user_and_chats/chat_invite_link.py
+++ b/pyrogram/types/user_and_chats/chat_invite_link.py
@@ -70,7 +70,8 @@ class ChatInviteLink(Object):
     """
 
     def __init__(
-        self, *,
+        self,
+        *,
         invite_link: str,
         date: datetime,
         is_primary: bool = None,
@@ -103,7 +104,7 @@ def __init__(
     def _parse(
         client: "pyrogram.Client",
         invite: "raw.base.ExportedChatInvite",
-        users: Dict[int, "raw.types.User"] = None
+        users: Dict[int, "raw.types.User"] = None,
     ) -> Optional["ChatInviteLink"]:
         if not isinstance(invite, raw.types.ChatInviteExported):
             return None
@@ -126,5 +127,5 @@ def _parse(
             expire_date=utils.timestamp_to_datetime(invite.expire_date),
             member_limit=invite.usage_limit,
             member_count=invite.usage,
-            pending_join_request_count=invite.requested
+            pending_join_request_count=invite.requested,
         )
diff --git a/pyrogram/types/user_and_chats/chat_join_request.py b/pyrogram/types/user_and_chats/chat_join_request.py
index b810640b7..86e5a6edc 100644
--- a/pyrogram/types/user_and_chats/chat_join_request.py
+++ b/pyrogram/types/user_and_chats/chat_join_request.py
@@ -69,7 +69,7 @@ def _parse(
         client: "pyrogram.Client",
         update: "raw.types.UpdateBotChatInviteRequester",
         users: Dict[int, "raw.types.User"],
-        chats: Dict[int, "raw.types.Chat"]
+        chats: Dict[int, "raw.types.Chat"],
     ) -> "ChatJoinRequest":
         chat_id = utils.get_raw_peer_id(update.peer)
 
@@ -79,61 +79,59 @@ def _parse(
             date=utils.timestamp_to_datetime(update.date),
             bio=update.about,
             invite_link=types.ChatInviteLink._parse(client, update.invite, users),
-            client=client
+            client=client,
         )
 
     async def approve(self) -> bool:
         """Bound method *approve* of :obj:`~pyrogram.types.ChatJoinRequest`.
-        
+
         Use as a shortcut for:
-        
+
         .. code-block:: python
 
             await client.approve_chat_join_request(
                 chat_id=request.chat.id,
                 user_id=request.from_user.id
             )
-            
+
         Example:
             .. code-block:: python
 
                 await request.approve()
-                
+
         Returns:
             ``bool``: True on success.
-        
+
         Raises:
             RPCError: In case of a Telegram RPC error.
         """
         return await self._client.approve_chat_join_request(
-            chat_id=self.chat.id,
-            user_id=self.from_user.id
+            chat_id=self.chat.id, user_id=self.from_user.id
         )
 
     async def decline(self) -> bool:
         """Bound method *decline* of :obj:`~pyrogram.types.ChatJoinRequest`.
-        
+
         Use as a shortcut for:
-        
+
         .. code-block:: python
 
             await client.decline_chat_join_request(
                 chat_id=request.chat.id,
                 user_id=request.from_user.id
             )
-            
+
         Example:
             .. code-block:: python
 
                 await request.decline()
-                
+
         Returns:
             ``bool``: True on success.
-        
+
         Raises:
             RPCError: In case of a Telegram RPC error.
         """
         return await self._client.decline_chat_join_request(
-            chat_id=self.chat.id,
-            user_id=self.from_user.id
+            chat_id=self.chat.id, user_id=self.from_user.id
         )
diff --git a/pyrogram/types/user_and_chats/chat_joiner.py b/pyrogram/types/user_and_chats/chat_joiner.py
index 024f88ea2..16418bf19 100644
--- a/pyrogram/types/user_and_chats/chat_joiner.py
+++ b/pyrogram/types/user_and_chats/chat_joiner.py
@@ -78,5 +78,5 @@ def _parse(
                 if joiner.approved_by
                 else None
             ),
-            client=client
+            client=client,
         )
diff --git a/pyrogram/types/user_and_chats/chat_member.py b/pyrogram/types/user_and_chats/chat_member.py
index 4459a8d1c..00237a86b 100644
--- a/pyrogram/types/user_and_chats/chat_member.py
+++ b/pyrogram/types/user_and_chats/chat_member.py
@@ -111,7 +111,7 @@ def _parse(
         client: "pyrogram.Client",
         member: Union["raw.base.ChatParticipant", "raw.base.ChannelParticipant"],
         users: Dict[int, "raw.base.User"],
-        chats: Dict[int, "raw.base.Chat"]
+        chats: Dict[int, "raw.base.Chat"],
     ) -> "ChatMember":
         # Chat participants
         if isinstance(member, raw.types.ChatParticipant):
@@ -120,7 +120,7 @@ def _parse(
                 user=types.User._parse(client, users[member.user_id]),
                 joined_date=utils.timestamp_to_datetime(member.date),
                 invited_by=types.User._parse(client, users[member.inviter_id]),
-                client=client
+                client=client,
             )
         elif isinstance(member, raw.types.ChatParticipantAdmin):
             return ChatMember(
@@ -128,13 +128,13 @@ def _parse(
                 user=types.User._parse(client, users[member.user_id]),
                 joined_date=utils.timestamp_to_datetime(member.date),
                 invited_by=types.User._parse(client, users[member.inviter_id]),
-                client=client
+                client=client,
             )
         elif isinstance(member, raw.types.ChatParticipantCreator):
             return ChatMember(
                 status=enums.ChatMemberStatus.OWNER,
                 user=types.User._parse(client, users[member.user_id]),
-                client=client
+                client=client,
             )
 
         # Channel participants
@@ -143,7 +143,7 @@ def _parse(
                 status=enums.ChatMemberStatus.MEMBER,
                 user=types.User._parse(client, users[member.user_id]),
                 joined_date=utils.timestamp_to_datetime(member.date),
-                client=client
+                client=client,
             )
         elif isinstance(member, raw.types.ChannelParticipantAdmin):
             return ChatMember(
@@ -153,12 +153,13 @@ def _parse(
                 promoted_by=types.User._parse(client, users[member.promoted_by]),
                 invited_by=(
                     types.User._parse(client, users[member.inviter_id])
-                    if member.inviter_id else None
+                    if member.inviter_id
+                    else None
                 ),
                 custom_title=member.rank,
                 can_be_edited=member.can_edit,
                 privileges=types.ChatPrivileges._parse(member.admin_rights),
-                client=client
+                client=client,
             )
         elif isinstance(member, raw.types.ChannelParticipantBanned):
             peer = member.peer
@@ -166,12 +167,14 @@ def _parse(
 
             user = (
                 types.User._parse(client, users[peer_id])
-                if isinstance(peer, raw.types.PeerUser) else None
+                if isinstance(peer, raw.types.PeerUser)
+                else None
             )
 
             chat = (
                 types.Chat._parse_chat(client, chats[peer_id])
-                if not isinstance(peer, raw.types.PeerUser) else None
+                if not isinstance(peer, raw.types.PeerUser)
+                else None
             )
 
             return ChatMember(
@@ -187,7 +190,7 @@ def _parse(
                 is_member=not member.left,
                 restricted_by=types.User._parse(client, users[member.kicked_by]),
                 permissions=types.ChatPermissions._parse(member.banned_rights),
-                client=client
+                client=client,
             )
         elif isinstance(member, raw.types.ChannelParticipantCreator):
             return ChatMember(
@@ -195,7 +198,7 @@ def _parse(
                 user=types.User._parse(client, users[member.user_id]),
                 custom_title=member.rank,
                 privileges=types.ChatPrivileges._parse(member.admin_rights),
-                client=client
+                client=client,
             )
         elif isinstance(member, raw.types.ChannelParticipantLeft):
             peer = member.peer
@@ -203,19 +206,18 @@ def _parse(
 
             user = (
                 types.User._parse(client, users[peer_id])
-                if isinstance(peer, raw.types.PeerUser) else None
+                if isinstance(peer, raw.types.PeerUser)
+                else None
             )
 
             chat = (
                 types.Chat._parse_chat(client, chats[peer_id])
-                if not isinstance(peer, raw.types.PeerUser) else None
+                if not isinstance(peer, raw.types.PeerUser)
+                else None
             )
 
             return ChatMember(
-                status=enums.ChatMemberStatus.LEFT,
-                user=user,
-                chat=chat,
-                client=client
+                status=enums.ChatMemberStatus.LEFT, user=user, chat=chat, client=client
             )
         elif isinstance(member, raw.types.ChannelParticipantSelf):
             return ChatMember(
@@ -223,5 +225,5 @@ def _parse(
                 user=types.User._parse(client, users[member.user_id]),
                 joined_date=utils.timestamp_to_datetime(member.date),
                 invited_by=types.User._parse(client, users[member.inviter_id]),
-                client=client
+                client=client,
             )
diff --git a/pyrogram/types/user_and_chats/chat_member_updated.py b/pyrogram/types/user_and_chats/chat_member_updated.py
index f8b6638db..1e1a53b33 100644
--- a/pyrogram/types/user_and_chats/chat_member_updated.py
+++ b/pyrogram/types/user_and_chats/chat_member_updated.py
@@ -72,9 +72,11 @@ def __init__(
     @staticmethod
     def _parse(
         client: "pyrogram.Client",
-        update: Union["raw.types.UpdateChatParticipant", "raw.types.UpdateChannelParticipant"],
+        update: Union[
+            "raw.types.UpdateChatParticipant", "raw.types.UpdateChannelParticipant"
+        ],
         users: Dict[int, "raw.types.User"],
-        chats: Dict[int, "raw.types.Chat"]
+        chats: Dict[int, "raw.types.Chat"],
     ) -> "ChatMemberUpdated":
         chat_id = getattr(update, "chat_id", None) or getattr(update, "channel_id")
 
@@ -83,10 +85,14 @@ def _parse(
         invite_link = None
 
         if update.prev_participant:
-            old_chat_member = types.ChatMember._parse(client, update.prev_participant, users, chats)
+            old_chat_member = types.ChatMember._parse(
+                client, update.prev_participant, users, chats
+            )
 
         if update.new_participant:
-            new_chat_member = types.ChatMember._parse(client, update.new_participant, users, chats)
+            new_chat_member = types.ChatMember._parse(
+                client, update.new_participant, users, chats
+            )
 
         if update.invite:
             invite_link = types.ChatInviteLink._parse(client, update.invite, users)
@@ -98,5 +104,5 @@ def _parse(
             old_chat_member=old_chat_member,
             new_chat_member=new_chat_member,
             invite_link=invite_link,
-            client=client
+            client=client,
         )
diff --git a/pyrogram/types/user_and_chats/chat_permissions.py b/pyrogram/types/user_and_chats/chat_permissions.py
index 1484e8718..f84fb18d1 100644
--- a/pyrogram/types/user_and_chats/chat_permissions.py
+++ b/pyrogram/types/user_and_chats/chat_permissions.py
@@ -184,7 +184,7 @@ def _parse(denied_permissions: "raw.base.ChatBannedRights") -> "ChatPermissions"
                 denied_permissions.send_roundvideos,
                 denied_permissions.send_stickers,
                 denied_permissions.send_videos,
-                denied_permissions.send_voices
+                denied_permissions.send_voices,
             ]
             all_params_not = [
                 not denied_permissions.send_messages,
@@ -204,7 +204,7 @@ def _parse(denied_permissions: "raw.base.ChatBannedRights") -> "ChatPermissions"
                 not denied_permissions.send_roundvideos,
                 not denied_permissions.send_stickers,
                 not denied_permissions.send_videos,
-                not denied_permissions.send_voices
+                not denied_permissions.send_voices,
             ]
             if all(all_params):
                 all_permissions = False
@@ -230,5 +230,5 @@ def _parse(denied_permissions: "raw.base.ChatBannedRights") -> "ChatPermissions"
                 can_send_roundvideos=not denied_permissions.send_roundvideos,
                 can_send_stickers=not denied_permissions.send_stickers,
                 can_send_videos=not denied_permissions.send_videos,
-                can_send_voices=not denied_permissions.send_voices
+                can_send_voices=not denied_permissions.send_voices,
             )
diff --git a/pyrogram/types/user_and_chats/chat_photo.py b/pyrogram/types/user_and_chats/chat_photo.py
index b3aba61dd..7231bcd6e 100644
--- a/pyrogram/types/user_and_chats/chat_photo.py
+++ b/pyrogram/types/user_and_chats/chat_photo.py
@@ -20,7 +20,13 @@
 
 import pyrogram
 from pyrogram import raw
-from pyrogram.file_id import FileId, FileType, FileUniqueId, FileUniqueType, ThumbnailSource
+from pyrogram.file_id import (
+    FileId,
+    FileType,
+    FileUniqueId,
+    FileUniqueType,
+    ThumbnailSource,
+)
 from ..object import Object
 
 
@@ -53,7 +59,6 @@ def __init__(
         small_photo_unique_id: str,
         big_file_id: str,
         big_photo_unique_id: str
-
     ):
         super().__init__(client)
 
@@ -67,9 +72,11 @@ def _parse(
         client,
         chat_photo: Union["raw.types.UserProfilePhoto", "raw.types.ChatPhoto"],
         peer_id: int,
-        peer_access_hash: int
+        peer_access_hash: int,
     ):
-        if not isinstance(chat_photo, (raw.types.UserProfilePhoto, raw.types.ChatPhoto)):
+        if not isinstance(
+            chat_photo, (raw.types.UserProfilePhoto, raw.types.ChatPhoto)
+        ):
             return None
 
         return ChatPhoto(
@@ -82,11 +89,10 @@ def _parse(
                 thumbnail_source=ThumbnailSource.CHAT_PHOTO_SMALL,
                 local_id=0,
                 chat_id=peer_id,
-                chat_access_hash=peer_access_hash
+                chat_access_hash=peer_access_hash,
             ).encode(),
             small_photo_unique_id=FileUniqueId(
-                file_unique_type=FileUniqueType.DOCUMENT,
-                media_id=chat_photo.photo_id
+                file_unique_type=FileUniqueType.DOCUMENT, media_id=chat_photo.photo_id
             ).encode(),
             big_file_id=FileId(
                 file_type=FileType.CHAT_PHOTO,
@@ -97,11 +103,10 @@ def _parse(
                 thumbnail_source=ThumbnailSource.CHAT_PHOTO_BIG,
                 local_id=0,
                 chat_id=peer_id,
-                chat_access_hash=peer_access_hash
+                chat_access_hash=peer_access_hash,
             ).encode(),
             big_photo_unique_id=FileUniqueId(
-                file_unique_type=FileUniqueType.DOCUMENT,
-                media_id=chat_photo.photo_id
+                file_unique_type=FileUniqueType.DOCUMENT, media_id=chat_photo.photo_id
             ).encode(),
-            client=client
+            client=client,
         )
diff --git a/pyrogram/types/user_and_chats/chat_preview.py b/pyrogram/types/user_and_chats/chat_preview.py
index e251c8658..f87aee57d 100644
--- a/pyrogram/types/user_and_chats/chat_preview.py
+++ b/pyrogram/types/user_and_chats/chat_preview.py
@@ -66,13 +66,20 @@ def __init__(
     def _parse(client, chat_invite: "raw.types.ChatInvite") -> "ChatPreview":
         return ChatPreview(
             title=chat_invite.title,
-            type=("group" if not chat_invite.channel else
-                  "channel" if chat_invite.broadcast else
-                  "supergroup"),
+            type=(
+                "group"
+                if not chat_invite.channel
+                else "channel"
+                if chat_invite.broadcast
+                else "supergroup"
+            ),
             members_count=chat_invite.participants_count,
             photo=types.Photo._parse(client, chat_invite.photo),
-            members=[types.User._parse(client, user) for user in chat_invite.participants] or None,
-            client=client
+            members=[
+                types.User._parse(client, user) for user in chat_invite.participants
+            ]
+            or None,
+            client=client,
         )
 
     # TODO: Maybe just merge this object into Chat itself by adding the "members" field.
diff --git a/pyrogram/types/user_and_chats/chat_privileges.py b/pyrogram/types/user_and_chats/chat_privileges.py
index 0e8be3b1a..5db6c8133 100644
--- a/pyrogram/types/user_and_chats/chat_privileges.py
+++ b/pyrogram/types/user_and_chats/chat_privileges.py
@@ -96,10 +96,10 @@ def __init__(
         can_edit_messages: bool = False,  # Channels only
         can_invite_users: bool = False,
         can_pin_messages: bool = False,  # Groups and supergroups only
-        can_manage_topics: bool = False, # supergroups only.
-        can_post_stories: bool = False, # Channels only
-        can_edit_stories: bool = False, # Channels only
-        can_delete_stories: bool = False, # Channels only
+        can_manage_topics: bool = False,  # supergroups only.
+        can_post_stories: bool = False,  # Channels only
+        can_edit_stories: bool = False,  # Channels only
+        can_delete_stories: bool = False,  # Channels only
         is_anonymous: bool = False
     ):
         super().__init__(None)
@@ -137,5 +137,5 @@ def _parse(admin_rights: "raw.base.ChatAdminRights") -> "ChatPrivileges":
             can_post_stories=admin_rights.post_stories,
             can_edit_stories=admin_rights.edit_stories,
             can_delete_stories=admin_rights.delete_stories,
-            is_anonymous=admin_rights.anonymous
+            is_anonymous=admin_rights.anonymous,
         )
diff --git a/pyrogram/types/user_and_chats/chat_reactions.py b/pyrogram/types/user_and_chats/chat_reactions.py
index 0252029bc..4ce812da5 100644
--- a/pyrogram/types/user_and_chats/chat_reactions.py
+++ b/pyrogram/types/user_and_chats/chat_reactions.py
@@ -51,12 +51,14 @@ def __init__(
         self.reactions = reactions
 
     @staticmethod
-    def _parse(client, chat_reactions: "raw.base.ChatReactions") -> Optional["ChatReactions"]:
+    def _parse(
+        client, chat_reactions: "raw.base.ChatReactions"
+    ) -> Optional["ChatReactions"]:
         if isinstance(chat_reactions, raw.types.ChatReactionsAll):
             return ChatReactions(
                 client=client,
                 all_are_enabled=True,
-                allow_custom_emoji=chat_reactions.allow_custom
+                allow_custom_emoji=chat_reactions.allow_custom,
             )
 
         if isinstance(chat_reactions, raw.types.ChatReactionsSome):
@@ -65,9 +67,9 @@ def _parse(client, chat_reactions: "raw.base.ChatReactions") -> Optional["ChatRe
                 reactions=[
                     types.ReactionType._parse(reaction)
                     for reaction in chat_reactions.reactions
-                ]
+                ],
             )
         if isinstance(chat_reactions, raw.types.ChatReactionsNone):
             return None
 
-        return None
\ No newline at end of file
+        return None
diff --git a/pyrogram/types/user_and_chats/dialog.py b/pyrogram/types/user_and_chats/dialog.py
index 7259a89a5..b2cfd2bf1 100644
--- a/pyrogram/types/user_and_chats/dialog.py
+++ b/pyrogram/types/user_and_chats/dialog.py
@@ -75,5 +75,5 @@ def _parse(client, dialog: "raw.types.Dialog", messages, users, chats) -> "Dialo
             unread_mentions_count=dialog.unread_mentions_count,
             unread_mark=dialog.unread_mark,
             is_pinned=dialog.pinned,
-            client=client
+            client=client,
         )
diff --git a/pyrogram/types/user_and_chats/emoji_status.py b/pyrogram/types/user_and_chats/emoji_status.py
index 50b46bfa4..ba891727f 100644
--- a/pyrogram/types/user_and_chats/emoji_status.py
+++ b/pyrogram/types/user_and_chats/emoji_status.py
@@ -51,16 +51,13 @@ def __init__(
     @staticmethod
     def _parse(client, emoji_status: "raw.base.EmojiStatus") -> Optional["EmojiStatus"]:
         if isinstance(emoji_status, raw.types.EmojiStatus):
-            return EmojiStatus(
-                client=client,
-                custom_emoji_id=emoji_status.document_id
-            )
+            return EmojiStatus(client=client, custom_emoji_id=emoji_status.document_id)
 
         if isinstance(emoji_status, raw.types.EmojiStatusUntil):
             return EmojiStatus(
                 client=client,
                 custom_emoji_id=emoji_status.document_id,
-                until_date=utils.timestamp_to_datetime(emoji_status.until)
+                until_date=utils.timestamp_to_datetime(emoji_status.until),
             )
 
         return None
@@ -69,9 +66,7 @@ def write(self):
         if self.until_date:
             return raw.types.EmojiStatusUntil(
                 document_id=self.custom_emoji_id,
-                until=utils.datetime_to_timestamp(self.until_date)
+                until=utils.datetime_to_timestamp(self.until_date),
             )
 
-        return raw.types.EmojiStatus(
-            document_id=self.custom_emoji_id
-        )
+        return raw.types.EmojiStatus(document_id=self.custom_emoji_id)
diff --git a/pyrogram/types/user_and_chats/forum_topic.py b/pyrogram/types/user_and_chats/forum_topic.py
index e8f01958a..9bdd5e8b4 100644
--- a/pyrogram/types/user_and_chats/forum_topic.py
+++ b/pyrogram/types/user_and_chats/forum_topic.py
@@ -93,13 +93,13 @@ def __init__(
         unread_mentions_count: int,
         unread_reactions_count: int,
         from_id: Union["types.PeerChannel", "types.PeerUser"],
-        #notify_settings: "types.PeerNotifySettings", //todo
+        # notify_settings: "types.PeerNotifySettings", //todo
         my: bool = None,
         closed: bool = None,
         pinned: bool = None,
         short: bool = None,
         icon_emoji_id: int = None,
-        #draft: "types.DraftMessage" = None //todo
+        # draft: "types.DraftMessage" = None //todo
     ):
         super().__init__()
 
@@ -114,13 +114,13 @@ def __init__(
         self.unread_mentions_count = unread_mentions_count
         self.unread_reactions_count = unread_reactions_count
         self.from_id = from_id
-        #self.notify_settings = notify_settings //todo
+        # self.notify_settings = notify_settings //todo
         self.my = my
         self.closed = closed
         self.pinned = pinned
         self.short = short
         self.icon_emoji_id = icon_emoji_id
-        #self.draft = draft //todo
+        # self.draft = draft //todo
 
     @staticmethod
     def _parse(forum_topic: "raw.types.forum_topic") -> "ForumTopic":
@@ -131,22 +131,22 @@ def _parse(forum_topic: "raw.types.forum_topic") -> "ForumTopic":
             peer = types.PeerUser._parse(from_id)
 
         return ForumTopic(
-            id=getattr(forum_topic,"id", None),
-            date=getattr(forum_topic,"date", None),
-            title=getattr(forum_topic,"title", None),
-            icon_color=getattr(forum_topic,"icon_color", None),
-            top_message=getattr(forum_topic,"top_message", None),
-            read_inbox_max_id=getattr(forum_topic,"read_inbox_max_id", None),
-            read_outbox_max_id=getattr(forum_topic,"read_outbox_max_id", None),
-            unread_count=getattr(forum_topic,"unread_count", None),
-            unread_mentions_count=getattr(forum_topic,"unread_mentions_count", None),
-            unread_reactions_count=getattr(forum_topic,"unread_reactions_count", None),
+            id=getattr(forum_topic, "id", None),
+            date=getattr(forum_topic, "date", None),
+            title=getattr(forum_topic, "title", None),
+            icon_color=getattr(forum_topic, "icon_color", None),
+            top_message=getattr(forum_topic, "top_message", None),
+            read_inbox_max_id=getattr(forum_topic, "read_inbox_max_id", None),
+            read_outbox_max_id=getattr(forum_topic, "read_outbox_max_id", None),
+            unread_count=getattr(forum_topic, "unread_count", None),
+            unread_mentions_count=getattr(forum_topic, "unread_mentions_count", None),
+            unread_reactions_count=getattr(forum_topic, "unread_reactions_count", None),
             from_id=peer,
-            #notify_settings=None, //todo
-            my=getattr(forum_topic,"my", None),
-            closed=getattr(forum_topic,"closed", None),
-            pinned=getattr(forum_topic,"pinned", None),
-            short=getattr(forum_topic,"short", None),
-            icon_emoji_id=getattr(forum_topic,"icon_emoji_id", None),
-            #draft=None //todo
+            # notify_settings=None, //todo
+            my=getattr(forum_topic, "my", None),
+            closed=getattr(forum_topic, "closed", None),
+            pinned=getattr(forum_topic, "pinned", None),
+            short=getattr(forum_topic, "short", None),
+            icon_emoji_id=getattr(forum_topic, "icon_emoji_id", None),
+            # draft=None //todo
         )
diff --git a/pyrogram/types/user_and_chats/forum_topic_created.py b/pyrogram/types/user_and_chats/forum_topic_created.py
index da7daaccc..f1f725660 100644
--- a/pyrogram/types/user_and_chats/forum_topic_created.py
+++ b/pyrogram/types/user_and_chats/forum_topic_created.py
@@ -39,11 +39,7 @@ class ForumTopicCreated(Object):
     """
 
     def __init__(
-        self, *,
-        id: int,
-        title: str,
-        icon_color: int,
-        icon_emoji_id: int = None
+        self, *, id: int, title: str, icon_color: int, icon_emoji_id: int = None
     ):
         super().__init__()
 
@@ -55,10 +51,9 @@ def __init__(
     @staticmethod
     def _parse(message: "raw.base.Message") -> "ForumTopicCreated":
 
-
         return ForumTopicCreated(
             id=getattr(message, "id", None),
-            title=getattr(message.action,"title", None),
-            icon_color=getattr(message.action,"icon_color", None),
-            icon_emoji_id=getattr(message.action,"icon_emoji_id", None)
+            title=getattr(message.action, "title", None),
+            icon_color=getattr(message.action, "icon_color", None),
+            icon_emoji_id=getattr(message.action, "icon_emoji_id", None),
         )
diff --git a/pyrogram/types/user_and_chats/forum_topic_edited.py b/pyrogram/types/user_and_chats/forum_topic_edited.py
index b55056707..12f4eb534 100644
--- a/pyrogram/types/user_and_chats/forum_topic_edited.py
+++ b/pyrogram/types/user_and_chats/forum_topic_edited.py
@@ -36,10 +36,7 @@ class ForumTopicEdited(Object):
     """
 
     def __init__(
-        self, *,
-        title: str = None,
-        icon_color: int = None,
-        icon_emoji_id: str = None
+        self, *, title: str = None, icon_color: int = None, icon_emoji_id: str = None
     ):
         super().__init__()
 
@@ -50,9 +47,8 @@ def __init__(
     @staticmethod
     def _parse(action: "raw.types.MessageActionTopicEdit") -> "ForumTopicEdited":
 
-
         return ForumTopicEdited(
-            title=getattr(action,"title", None),
-            icon_color=getattr(action,"icon_color", None),
-            icon_emoji_id=getattr(action,"icon_emoji_id", None)
+            title=getattr(action, "title", None),
+            icon_color=getattr(action, "icon_color", None),
+            icon_emoji_id=getattr(action, "icon_emoji_id", None),
         )
diff --git a/pyrogram/types/user_and_chats/invite_link_importer.py b/pyrogram/types/user_and_chats/invite_link_importer.py
index 34e5f397f..89f4e956b 100644
--- a/pyrogram/types/user_and_chats/invite_link_importer.py
+++ b/pyrogram/types/user_and_chats/invite_link_importer.py
@@ -34,11 +34,7 @@ class InviteLinkImporter(Object):
             The user that has used the given invite link
     """
 
-    def __init__(
-        self, *,
-        date: datetime,
-        user: "types.User"
-    ):
+    def __init__(self, *, date: datetime, user: "types.User"):
         super().__init__(None)
 
         self.date = date
@@ -54,7 +50,7 @@ def _parse(client, invite_importers: "raw.types.messages.ChatInviteImporters"):
             importers.append(
                 InviteLinkImporter(
                     date=utils.timestamp_to_datetime(j.date),
-                    user=types.User._parse(client=None, user=d[j.user_id])
+                    user=types.User._parse(client=None, user=d[j.user_id]),
                 )
             )
 
diff --git a/pyrogram/types/user_and_chats/peer_channel.py b/pyrogram/types/user_and_chats/peer_channel.py
index a0f79078b..74fd97163 100644
--- a/pyrogram/types/user_and_chats/peer_channel.py
+++ b/pyrogram/types/user_and_chats/peer_channel.py
@@ -29,10 +29,7 @@ class PeerChannel(Object):
             Id of the channel.
     """
 
-    def __init__(
-        self, *,
-        channel_id: int
-    ):
+    def __init__(self, *, channel_id: int):
         super().__init__()
 
         self.channel_id = channel_id
@@ -40,7 +37,4 @@ def __init__(
     @staticmethod
     def _parse(action: "raw.types.PeerChannel") -> "PeerChannel":
 
-
-        return PeerChannel(
-            channel_id=getattr(action,"channel_id", None)
-        )
+        return PeerChannel(channel_id=getattr(action, "channel_id", None))
diff --git a/pyrogram/types/user_and_chats/peer_user.py b/pyrogram/types/user_and_chats/peer_user.py
index 48a88b492..f410eb730 100644
--- a/pyrogram/types/user_and_chats/peer_user.py
+++ b/pyrogram/types/user_and_chats/peer_user.py
@@ -29,10 +29,7 @@ class PeerUser(Object):
             Id of the user.
     """
 
-    def __init__(
-        self, *,
-        user_id: int
-    ):
+    def __init__(self, *, user_id: int):
         super().__init__()
 
         self.user_id = user_id
@@ -40,7 +37,4 @@ def __init__(
     @staticmethod
     def _parse(action: "raw.types.PeerUser") -> "PeerUser":
 
-
-        return PeerUser(
-            user_id=getattr(action,"user_id", None)
-        )
+        return PeerUser(user_id=getattr(action, "user_id", None))
diff --git a/pyrogram/types/user_and_chats/restriction.py b/pyrogram/types/user_and_chats/restriction.py
index 8f7a1b726..163d03910 100644
--- a/pyrogram/types/user_and_chats/restriction.py
+++ b/pyrogram/types/user_and_chats/restriction.py
@@ -46,5 +46,5 @@ def _parse(restriction: "raw.types.RestrictionReason") -> "Restriction":
         return Restriction(
             platform=restriction.platform,
             reason=restriction.reason,
-            text=restriction.text
+            text=restriction.text,
         )
diff --git a/pyrogram/types/user_and_chats/user.py b/pyrogram/types/user_and_chats/user.py
index 293eb7ff7..fc22f828f 100644
--- a/pyrogram/types/user_and_chats/user.py
+++ b/pyrogram/types/user_and_chats/user.py
@@ -195,7 +195,7 @@ def __init__(
         photo: "types.ChatPhoto" = None,
         restrictions: List["types.Restriction"] = None,
         reply_color: "types.ChatColor" = None,
-        profile_color: "types.ChatColor" = None
+        profile_color: "types.ChatColor" = None,
     ):
         super().__init__(client)
 
@@ -237,7 +237,7 @@ def mention(self):
         return Link(
             f"tg://user?id={self.id}",
             self.first_name or "Deleted Account",
-            self._client.parse_mode
+            self._client.parse_mode,
         )
 
     @staticmethod
@@ -282,10 +282,15 @@ def _parse(client, user: "raw.base.User") -> Optional["User"]:
             dc_id=getattr(user.photo, "dc_id", None),
             phone_number=user.phone,
             photo=types.ChatPhoto._parse(client, user.photo, user.id, user.access_hash),
-            restrictions=types.List([types.Restriction._parse(r) for r in user.restriction_reason]) or None,
+            restrictions=types.List(
+                [types.Restriction._parse(r) for r in user.restriction_reason]
+            )
+            or None,
             reply_color=types.ChatColor._parse(getattr(user, "color", None)),
-            profile_color=types.ChatColor._parse_profile_color(getattr(user, "profile_color", None)),
-            client=client
+            profile_color=types.ChatColor._parse_profile_color(
+                getattr(user, "profile_color", None)
+            ),
+            client=client,
         )
 
     @staticmethod
@@ -318,7 +323,7 @@ def _parse_status(user_status: "raw.base.UserStatus", is_bot: bool = False):
         return {
             "status": status,
             "last_online_date": last_online_date,
-            "next_offline_date": next_offline_date
+            "next_offline_date": next_offline_date,
         }
 
     @staticmethod
@@ -326,7 +331,7 @@ def _parse_user_status(client, user_status: "raw.types.UpdateUserStatus"):
         return User(
             id=user_status.user_id,
             **User._parse_status(user_status.status),
-            client=client
+            client=client,
         )
 
     def listen(self, *args, **kwargs):
@@ -360,7 +365,7 @@ def listen(self, *args, **kwargs):
 
     def ask(self, text, *args, **kwargs):
         """Bound method *ask* of :obj:`~pyrogram.types.User`.
-        
+
         Use as a shortcut for:
 
         .. code-block:: python
@@ -394,7 +399,7 @@ def ask(self, text, *args, **kwargs):
 
     def stop_listening(self, *args, **kwargs):
         """Bound method *stop_listening* of :obj:`~pyrogram.types.User`.
-        
+
         Use as a shortcut for:
 
         .. code-block:: python
diff --git a/pyrogram/types/user_and_chats/username.py b/pyrogram/types/user_and_chats/username.py
index cc57a3069..68708fa43 100644
--- a/pyrogram/types/user_and_chats/username.py
+++ b/pyrogram/types/user_and_chats/username.py
@@ -35,12 +35,7 @@ class Username(Object):
             Is the username active.
     """
 
-    def __init__(
-        self, *,
-        username: str,
-        editable: bool = None,
-        active: bool = None
-    ):
+    def __init__(self, *, username: str, editable: bool = None, active: bool = None):
         super().__init__()
 
         self.username = username
@@ -50,9 +45,8 @@ def __init__(
     @staticmethod
     def _parse(action: "raw.types.Username") -> "Username":
 
-
         return Username(
-            username=getattr(action,"username", None),
-            editable=getattr(action,"editable", None),
-            active=getattr(action,"active", None)
+            username=getattr(action, "username", None),
+            editable=getattr(action, "editable", None),
+            active=getattr(action, "active", None),
         )
diff --git a/pyrogram/types/user_and_chats/video_chat_ended.py b/pyrogram/types/user_and_chats/video_chat_ended.py
index 8c9fac6a0..5f7688aa7 100644
--- a/pyrogram/types/user_and_chats/video_chat_ended.py
+++ b/pyrogram/types/user_and_chats/video_chat_ended.py
@@ -28,10 +28,7 @@ class VideoChatEnded(Object):
             Voice chat duration; in seconds.
     """
 
-    def __init__(
-        self, *,
-        duration: int
-    ):
+    def __init__(self, *, duration: int):
         super().__init__()
 
         self.duration = duration
diff --git a/pyrogram/types/user_and_chats/video_chat_members_invited.py b/pyrogram/types/user_and_chats/video_chat_members_invited.py
index 9f2e3d1ef..751c642f0 100644
--- a/pyrogram/types/user_and_chats/video_chat_members_invited.py
+++ b/pyrogram/types/user_and_chats/video_chat_members_invited.py
@@ -31,10 +31,7 @@ class VideoChatMembersInvited(Object):
             New members that were invited to the voice chat.
     """
 
-    def __init__(
-        self, *,
-        users: List["types.User"]
-    ):
+    def __init__(self, *, users: List["types.User"]):
         super().__init__()
 
         self.users = users
@@ -43,7 +40,7 @@ def __init__(
     def _parse(
         client,
         action: "raw.types.MessageActionInviteToGroupCall",
-        users: Dict[int, "raw.types.User"]
+        users: Dict[int, "raw.types.User"],
     ) -> "VideoChatMembersInvited":
         users = [types.User._parse(client, users[i]) for i in action.users]
 
diff --git a/pyrogram/types/user_and_chats/video_chat_scheduled.py b/pyrogram/types/user_and_chats/video_chat_scheduled.py
index 5bdd59251..b99ec297d 100644
--- a/pyrogram/types/user_and_chats/video_chat_scheduled.py
+++ b/pyrogram/types/user_and_chats/video_chat_scheduled.py
@@ -30,14 +30,15 @@ class VideoChatScheduled(Object):
             Point in time when the voice chat is supposed to be started by a chat administrator.
     """
 
-    def __init__(
-        self, *,
-        start_date: datetime
-    ):
+    def __init__(self, *, start_date: datetime):
         super().__init__()
 
         self.start_date = start_date
 
     @staticmethod
-    def _parse(action: "raw.types.MessageActionGroupCallScheduled") -> "VideoChatScheduled":
-        return VideoChatScheduled(start_date=utils.timestamp_to_datetime(action.schedule_date))
+    def _parse(
+        action: "raw.types.MessageActionGroupCallScheduled",
+    ) -> "VideoChatScheduled":
+        return VideoChatScheduled(
+            start_date=utils.timestamp_to_datetime(action.schedule_date)
+        )
diff --git a/pyrogram/utils.py b/pyrogram/utils.py
index 853d9a8a2..06785d8b3 100644
--- a/pyrogram/utils.py
+++ b/pyrogram/utils.py
@@ -42,7 +42,7 @@
     unallowed_click_alert=True,
     unallowed_click_alert_text=("[pyromod] You're not expected to click this button."),
 )
-    
+
 
 async def ainput(prompt: str = "", *, hide: bool = False):
     """Just like the built-in input, but async"""
@@ -52,9 +52,7 @@ async def ainput(prompt: str = "", *, hide: bool = False):
 
 
 def get_input_media_from_file_id(
-    file_id: str,
-    expected_file_type: FileType = None,
-    ttl_seconds: int = None
+    file_id: str, expected_file_type: FileType = None, ttl_seconds: int = None
 ) -> Union["raw.types.InputMediaPhoto", "raw.types.InputMediaDocument"]:
     try:
         decoded = FileId.decode(file_id)
@@ -67,7 +65,9 @@ def get_input_media_from_file_id(
     file_type = decoded.file_type
 
     if expected_file_type is not None and file_type != expected_file_type:
-        raise ValueError(f"Expected {expected_file_type.name}, got {file_type.name} file id instead")
+        raise ValueError(
+            f"Expected {expected_file_type.name}, got {file_type.name} file id instead"
+        )
 
     if file_type in (FileType.THUMBNAIL, FileType.CHAT_PHOTO):
         raise ValueError(f"This file id can only be used for download: {file_id}")
@@ -77,9 +77,9 @@ def get_input_media_from_file_id(
             id=raw.types.InputPhoto(
                 id=decoded.media_id,
                 access_hash=decoded.access_hash,
-                file_reference=decoded.file_reference
+                file_reference=decoded.file_reference,
             ),
-            ttl_seconds=ttl_seconds
+            ttl_seconds=ttl_seconds,
         )
 
     if file_type in DOCUMENT_TYPES:
@@ -87,18 +87,16 @@ def get_input_media_from_file_id(
             id=raw.types.InputDocument(
                 id=decoded.media_id,
                 access_hash=decoded.access_hash,
-                file_reference=decoded.file_reference
+                file_reference=decoded.file_reference,
             ),
-            ttl_seconds=ttl_seconds
+            ttl_seconds=ttl_seconds,
         )
 
     raise ValueError(f"Unknown file id: {file_id}")
 
 
 async def parse_messages(
-    client,
-    messages: "raw.types.messages.Messages",
-    replies: int = 1
+    client, messages: "raw.types.messages.Messages", replies: int = 1
 ) -> List["types.Message"]:
     users = {i.id: i for i in messages.users}
     chats = {i.id: i for i in messages.chats}
@@ -112,19 +110,25 @@ async def parse_messages(
     parsed_messages = []
 
     for message in messages.messages:
-        parsed_messages.append(await types.Message._parse(client, message, users, chats, topics, replies=0))
+        parsed_messages.append(
+            await types.Message._parse(client, message, users, chats, topics, replies=0)
+        )
 
     if replies:
         messages_with_replies = {
             i.id: i.reply_to
             for i in messages.messages
-            if not isinstance(i, raw.types.MessageEmpty) and i.reply_to and isinstance(i.reply_to, raw.types.MessageReplyHeader)
+            if not isinstance(i, raw.types.MessageEmpty)
+            and i.reply_to
+            and isinstance(i.reply_to, raw.types.MessageReplyHeader)
         }
 
         message_reply_to_story = {
-            i.id: {'user_id': i.reply_to.user_id, 'story_id': i.reply_to.story_id}
+            i.id: {"user_id": i.reply_to.user_id, "story_id": i.reply_to.story_id}
             for i in messages.messages
-            if not isinstance(i, raw.types.MessageEmpty) and i.reply_to and isinstance(i.reply_to, raw.types.MessageReplyStoryHeader)
+            if not isinstance(i, raw.types.MessageEmpty)
+            and i.reply_to
+            and isinstance(i.reply_to, raw.types.MessageReplyStoryHeader)
         }
 
         if messages_with_replies:
@@ -141,8 +145,7 @@ async def parse_messages(
                 chat_id = 0
 
             is_all_within_chat = not any(
-                value.reply_to_peer_id
-                for value in messages_with_replies.values()
+                value.reply_to_peer_id for value in messages_with_replies.values()
             )
             reply_messages: List[pyrogram.types.Message] = []
             if is_all_within_chat:
@@ -150,7 +153,7 @@ async def parse_messages(
                 reply_messages = await client.get_messages(
                     chat_id,
                     reply_to_message_ids=messages_with_replies.keys(),
-                    replies=replies - 1
+                    replies=replies - 1,
                 )
             else:
                 # slow path: fetch all messages individually
@@ -158,11 +161,13 @@ async def parse_messages(
                     to_be_added_msg = None
                     the_chat_id = chat_id
                     if target_reply_to.reply_to_peer_id:
-                        the_chat_id = get_channel_id(target_reply_to.reply_to_peer_id.channel_id)
+                        the_chat_id = get_channel_id(
+                            target_reply_to.reply_to_peer_id.channel_id
+                        )
                     to_be_added_msg = await client.get_messages(
                         chat_id=the_chat_id,
                         message_ids=target_reply_to.reply_to_msg_id,
-                        replies=replies - 1
+                        replies=replies - 1,
                     )
                     if isinstance(to_be_added_msg, list):
                         for current_to_be_added in to_be_added_msg:
@@ -195,8 +200,8 @@ async def parse_messages(
             reply_messages = {}
             for msg_id in message_reply_to_story:
                 reply_messages[msg_id] = await client.get_stories(
-                    message_reply_to_story[msg_id]['user_id'],
-                    message_reply_to_story[msg_id]['story_id']
+                    message_reply_to_story[msg_id]["user_id"],
+                    message_reply_to_story[msg_id]["story_id"],
                 )
 
             for message in parsed_messages:
@@ -219,9 +224,11 @@ def parse_deleted_messages(client, update) -> List["types.Message"]:
                 chat=types.Chat(
                     id=get_channel_id(channel_id),
                     type=enums.ChatType.CHANNEL,
-                    client=client
-                ) if channel_id is not None else None,
-                client=client
+                    client=client,
+                )
+                if channel_id is not None
+                else None,
+                client=client,
             )
         )
 
@@ -231,24 +238,19 @@ def parse_deleted_messages(client, update) -> List["types.Message"]:
 def pack_inline_message_id(msg_id: "raw.base.InputBotInlineMessageID"):
     if isinstance(msg_id, raw.types.InputBotInlineMessageID):
         inline_message_id_packed = struct.pack(
-            " "raw.base.InputBotInlineMessageID":
     padded = inline_message_id + "=" * (-len(inline_message_id) % 4)
     decoded = base64.urlsafe_b64decode(padded)
 
@@ -256,9 +258,7 @@ def unpack_inline_message_id(inline_message_id: str) -> "raw.base.InputBotInline
         unpacked = struct.unpack(" "raw.base.InputBotInline
             dc_id=unpacked[0],
             owner_id=unpacked[1],
             id=unpacked[2],
-            access_hash=unpacked[3]
+            access_hash=unpacked[3],
         )
 
 
@@ -341,7 +341,7 @@ def xor(a: bytes, b: bytes) -> bytes:
 
 def compute_password_hash(
     algo: raw.types.PasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow,
-    password: str
+    password: str,
 ) -> bytes:
     hash1 = sha256(algo.salt1 + password.encode() + algo.salt1)
     hash2 = sha256(algo.salt2 + hash1 + algo.salt2)
@@ -352,8 +352,7 @@ def compute_password_hash(
 
 # noinspection PyPep8Naming
 def compute_password_check(
-    r: raw.types.account.Password,
-    password: str
+    r: raw.types.account.Password, password: str
 ) -> raw.types.InputCheckPasswordSRP:
     algo = r.current_algo
 
@@ -415,7 +414,7 @@ async def parse_text_entities(
     client: "pyrogram.Client",
     text: str,
     parse_mode: enums.ParseMode,
-    entities: List["types.MessageEntity"]
+    entities: List["types.MessageEntity"],
 ) -> Dict[str, Union[str, List[raw.base.MessageEntity]]]:
     if entities:
         # Inject the client instance because parsing user mentions requires it
@@ -426,10 +425,7 @@ async def parse_text_entities(
     else:
         text, entities = (await client.parser.parse(text, parse_mode)).values()
 
-    return {
-        "message": text,
-        "entities": entities
-    }
+    return {"message": text, "entities": entities}
 
 
 def zero_datetime() -> datetime:
@@ -443,25 +439,31 @@ def timestamp_to_datetime(ts: Optional[int]) -> Optional[datetime]:
 def datetime_to_timestamp(dt: Optional[datetime]) -> Optional[int]:
     return int(dt.timestamp()) if dt else None
 
-async def run_sync(func: Callable[..., TypeVar("Result")], *args: Any, **kwargs: Any) -> TypeVar("Result"):
+
+async def run_sync(
+    func: Callable[..., TypeVar("Result")], *args: Any, **kwargs: Any
+) -> TypeVar("Result"):
     loop = asyncio.get_event_loop()
     return await loop.run_in_executor(None, functools.partial(func, *args, **kwargs))
 
+
 async def get_reply_to(
     client: "pyrogram.Client",
-    chat_id: Union[int,str] = None,
+    chat_id: Union[int, str] = None,
     reply_to_message_id: int = None,
     reply_to_story_id: int = None,
     message_thread_id: int = None,
-    reply_to_chat_id: Union[int,str] = None,
+    reply_to_chat_id: Union[int, str] = None,
     quote_text: str = None,
     quote_entities: List["types.MessageEntity"] = None,
-    parse_mode: "enums.ParseMode" = None
+    parse_mode: "enums.ParseMode" = None,
 ):
     reply_to = None
     reply_to_chat = None
     if reply_to_message_id or message_thread_id:
-        text, entities = (await parse_text_entities(client, quote_text, parse_mode, quote_entities)).values()
+        text, entities = (
+            await parse_text_entities(client, quote_text, parse_mode, quote_entities)
+        ).values()
         if reply_to_chat_id is not None:
             reply_to_chat = await client.resolve_peer(reply_to_chat_id)
         reply_to = types.InputReplyToMessage(
@@ -469,12 +471,9 @@ async def get_reply_to(
             message_thread_id=message_thread_id,
             reply_to_chat=reply_to_chat,
             quote_text=text,
-            quote_entities=entities
+            quote_entities=entities,
         )
     if reply_to_story_id:
         user_id = await client.resolve_peer(chat_id)
-        reply_to = types.InputReplyToStory(
-            user_id=user_id,
-            story_id=reply_to_story_id
-        )
+        reply_to = types.InputReplyToStory(user_id=user_id, story_id=reply_to_story_id)
     return reply_to
diff --git a/tests/filters/__init__.py b/tests/filters/__init__.py
index 6711b51b4..dc4115a6f 100644
--- a/tests/filters/__init__.py
+++ b/tests/filters/__init__.py
@@ -16,6 +16,7 @@
 #  You should have received a copy of the GNU Lesser General Public License
 #  along with Pyrogram.  If not, see .
 
+
 class Client:
     def __init__(self):
         self.me = User("username")
diff --git a/tests/filters/test_command.py b/tests/filters/test_command.py
index 234ed69fc..bb9c70bec 100644
--- a/tests/filters/test_command.py
+++ b/tests/filters/test_command.py
@@ -119,7 +119,7 @@ async def test_with_args():
     await f(c, m)
     assert m.command == ["start"] + list("abc")
 
-    m = Message('/start@username a b c')
+    m = Message("/start@username a b c")
     await f(c, m)
     assert m.command == ["start"] + list("abc")
 
diff --git a/tests/parser/test_html.py b/tests/parser/test_html.py
index b9138f3cf..429ce6a8d 100644
--- a/tests/parser/test_html.py
+++ b/tests/parser/test_html.py
@@ -24,11 +24,17 @@
 # text: original text without entities
 # entities: message entities coming from the server
 
+
 def test_html_unparse_bold():
     expected = "bold"
     text = "bold"
     entities = pyrogram.types.List(
-        [pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.BOLD, offset=0, length=4)])
+        [
+            pyrogram.types.MessageEntity(
+                type=pyrogram.enums.MessageEntityType.BOLD, offset=0, length=4
+            )
+        ]
+    )
 
     assert HTML.unparse(text=text, entities=entities) == expected
 
@@ -37,7 +43,12 @@ def test_html_unparse_italic():
     expected = "italic"
     text = "italic"
     entities = pyrogram.types.List(
-        [pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.ITALIC, offset=0, length=6)])
+        [
+            pyrogram.types.MessageEntity(
+                type=pyrogram.enums.MessageEntityType.ITALIC, offset=0, length=6
+            )
+        ]
+    )
 
     assert HTML.unparse(text=text, entities=entities) == expected
 
@@ -46,7 +57,12 @@ def test_html_unparse_underline():
     expected = "underline"
     text = "underline"
     entities = pyrogram.types.List(
-        [pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.UNDERLINE, offset=0, length=9)])
+        [
+            pyrogram.types.MessageEntity(
+                type=pyrogram.enums.MessageEntityType.UNDERLINE, offset=0, length=9
+            )
+        ]
+    )
 
     assert HTML.unparse(text=text, entities=entities) == expected
 
@@ -55,7 +71,12 @@ def test_html_unparse_strike():
     expected = "strike"
     text = "strike"
     entities = pyrogram.types.List(
-        [pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.STRIKETHROUGH, offset=0, length=6)])
+        [
+            pyrogram.types.MessageEntity(
+                type=pyrogram.enums.MessageEntityType.STRIKETHROUGH, offset=0, length=6
+            )
+        ]
+    )
 
     assert HTML.unparse(text=text, entities=entities) == expected
 
@@ -64,7 +85,12 @@ def test_html_unparse_spoiler():
     expected = "spoiler"
     text = "spoiler"
     entities = pyrogram.types.List(
-        [pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.SPOILER, offset=0, length=7)])
+        [
+            pyrogram.types.MessageEntity(
+                type=pyrogram.enums.MessageEntityType.SPOILER, offset=0, length=7
+            )
+        ]
+    )
 
     assert HTML.unparse(text=text, entities=entities) == expected
 
@@ -72,17 +98,30 @@ def test_html_unparse_spoiler():
 def test_html_unparse_url():
     expected = 'URL'
     text = "URL"
-    entities = pyrogram.types.List([pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.TEXT_LINK,
-                                                                 offset=0, length=3, url='https://pyrogram.org/')])
+    entities = pyrogram.types.List(
+        [
+            pyrogram.types.MessageEntity(
+                type=pyrogram.enums.MessageEntityType.TEXT_LINK,
+                offset=0,
+                length=3,
+                url="https://pyrogram.org/",
+            )
+        ]
+    )
 
     assert HTML.unparse(text=text, entities=entities) == expected
 
 
 def test_html_unparse_code():
-    expected = 'code'
+    expected = "code"
     text = "code"
     entities = pyrogram.types.List(
-        [pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.CODE, offset=0, length=4)])
+        [
+            pyrogram.types.MessageEntity(
+                type=pyrogram.enums.MessageEntityType.CODE, offset=0, length=4
+            )
+        ]
+    )
 
     assert HTML.unparse(text=text, entities=entities) == expected
 
@@ -94,28 +133,65 @@ def test_html_unparse_pre():
     text = """for i in range(10):
     print(i)"""
 
-    entities = pyrogram.types.List([pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.PRE, offset=0,
-                                                                 length=32, language='python')])
+    entities = pyrogram.types.List(
+        [
+            pyrogram.types.MessageEntity(
+                type=pyrogram.enums.MessageEntityType.PRE,
+                offset=0,
+                length=32,
+                language="python",
+            )
+        ]
+    )
 
     assert HTML.unparse(text=text, entities=entities) == expected
 
 
 def test_html_unparse_mixed():
-    expected = "aaaaaaaaaabbbbbbbbbbccccccccccdddddddddd" \
-               "eeeeeeeeeeffffffffffgggggggggghhhhhhhhhh"
+    expected = (
+        "aaaaaaaaaabbbbbbbbbbccccccccccdddddddddd"
+        "eeeeeeeeeeffffffffffgggggggggghhhhhhhhhh"
+    )
     text = "aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffffffffffgggggggggghhhhhhhhhh"
     entities = pyrogram.types.List(
-        [pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.BOLD, offset=0, length=14),
-         pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.ITALIC, offset=7, length=7),
-         pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.UNDERLINE, offset=10, length=4),
-         pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.UNDERLINE, offset=14, length=9),
-         pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.ITALIC, offset=14, length=9),
-         pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.UNDERLINE, offset=23, length=10),
-         pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.STRIKETHROUGH, offset=30, length=3),
-         pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.STRIKETHROUGH, offset=33, length=10),
-         pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.SPOILER, offset=38, length=5),
-         pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.SPOILER, offset=43, length=10),
-         pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.CODE, offset=57, length=10)])
+        [
+            pyrogram.types.MessageEntity(
+                type=pyrogram.enums.MessageEntityType.BOLD, offset=0, length=14
+            ),
+            pyrogram.types.MessageEntity(
+                type=pyrogram.enums.MessageEntityType.ITALIC, offset=7, length=7
+            ),
+            pyrogram.types.MessageEntity(
+                type=pyrogram.enums.MessageEntityType.UNDERLINE, offset=10, length=4
+            ),
+            pyrogram.types.MessageEntity(
+                type=pyrogram.enums.MessageEntityType.UNDERLINE, offset=14, length=9
+            ),
+            pyrogram.types.MessageEntity(
+                type=pyrogram.enums.MessageEntityType.ITALIC, offset=14, length=9
+            ),
+            pyrogram.types.MessageEntity(
+                type=pyrogram.enums.MessageEntityType.UNDERLINE, offset=23, length=10
+            ),
+            pyrogram.types.MessageEntity(
+                type=pyrogram.enums.MessageEntityType.STRIKETHROUGH, offset=30, length=3
+            ),
+            pyrogram.types.MessageEntity(
+                type=pyrogram.enums.MessageEntityType.STRIKETHROUGH,
+                offset=33,
+                length=10,
+            ),
+            pyrogram.types.MessageEntity(
+                type=pyrogram.enums.MessageEntityType.SPOILER, offset=38, length=5
+            ),
+            pyrogram.types.MessageEntity(
+                type=pyrogram.enums.MessageEntityType.SPOILER, offset=43, length=10
+            ),
+            pyrogram.types.MessageEntity(
+                type=pyrogram.enums.MessageEntityType.CODE, offset=57, length=10
+            ),
+        ]
+    )
 
     assert HTML.unparse(text=text, entities=entities) == expected
 
@@ -124,7 +200,12 @@ def test_html_unparse_escaped():
     expected = "<b>bold</b>"
     text = "bold"
     entities = pyrogram.types.List(
-        [pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.BOLD, offset=0, length=11)])
+        [
+            pyrogram.types.MessageEntity(
+                type=pyrogram.enums.MessageEntityType.BOLD, offset=0, length=11
+            )
+        ]
+    )
 
     assert HTML.unparse(text=text, entities=entities) == expected
 
@@ -133,8 +214,15 @@ def test_html_unparse_escaped_nested():
     expected = "<b>bold <u>underline</u> bold</b>"
     text = "bold underline bold"
     entities = pyrogram.types.List(
-        [pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.BOLD, offset=0, length=33),
-         pyrogram.types.MessageEntity(type=pyrogram.enums.MessageEntityType.UNDERLINE, offset=8, length=16)])
+        [
+            pyrogram.types.MessageEntity(
+                type=pyrogram.enums.MessageEntityType.BOLD, offset=0, length=33
+            ),
+            pyrogram.types.MessageEntity(
+                type=pyrogram.enums.MessageEntityType.UNDERLINE, offset=8, length=16
+            ),
+        ]
+    )
 
     assert HTML.unparse(text=text, entities=entities) == expected
 
diff --git a/tests/test_file_id.py b/tests/test_file_id.py
index 96152e48c..2a15ae640 100644
--- a/tests/test_file_id.py
+++ b/tests/test_file_id.py
@@ -36,7 +36,9 @@ def check_unique(file_unique_id: str, expected_file_unique_type: FileUniqueType)
 
 
 def test_audio():
-    audio = "CQACAgIAAx0CAAGgr9AAAgmQX7b4XPBstC1fFUuJBooHTHFd7HMAAgUAA4GkuUnVOGG5P196yR4E"
+    audio = (
+        "CQACAgIAAx0CAAGgr9AAAgmQX7b4XPBstC1fFUuJBooHTHFd7HMAAgUAA4GkuUnVOGG5P196yR4E"
+    )
     audio_unique = "AgADBQADgaS5SQ"
     audio_thumb = "AAMCAgADHQIAAaCv0AACCZBftvhc8Gy0LV8VS4kGigdMcV3scwACBQADgaS5SdU4Ybk_X3rJIH3qihAAAwEAB20AA_OeAQABHgQ"
     audio_thumb_unique = "AQADIH3qihAAA_OeAQAB"
@@ -48,7 +50,9 @@ def test_audio():
 
 
 def test_video():
-    video = "BAACAgIAAx0CAAGgr9AAAgmRX7b4Xv9f-4BK5VR_5ppIOF6UIp0AAgYAA4GkuUmhnZz2xC37wR4E"
+    video = (
+        "BAACAgIAAx0CAAGgr9AAAgmRX7b4Xv9f-4BK5VR_5ppIOF6UIp0AAgYAA4GkuUmhnZz2xC37wR4E"
+    )
     video_unique = "AgADBgADgaS5SQ"
     video_thumb = "AAMCAgADHQIAAaCv0AACCZFftvhe_1_7gErlVH_mmkg4XpQinQACBgADgaS5SaGdnPbELfvBIH3qihAAAwEAB20AA_WeAQABHgQ"
     video_thumb_unique = "AQADIH3qihAAA_WeAQAB"
@@ -60,7 +64,9 @@ def test_video():
 
 
 def test_document():
-    document = "BQACAgIAAx0CAAGgr9AAAgmPX7b4UxbjNoFEO_L0I4s6wrXNJA8AAgQAA4GkuUm9FFvIaOhXWR4E"
+    document = (
+        "BQACAgIAAx0CAAGgr9AAAgmPX7b4UxbjNoFEO_L0I4s6wrXNJA8AAgQAA4GkuUm9FFvIaOhXWR4E"
+    )
     document_unique = "AgADBAADgaS5SQ"
     document_thumb = "AAMCAgADHQIAAaCv0AACCY9ftvhTFuM2gUQ78vQjizrCtc0kDwACBAADgaS5Sb0UW8ho6FdZIH3qihAAAwEAB3MAA_GeAQABHgQ"
     document_thumb_unique = "AQADIH3qihAAA_GeAQAB"
@@ -72,7 +78,9 @@ def test_document():
 
 
 def test_animation():
-    animation = "CgACAgIAAx0CAAGgr9AAAgmSX7b4Y2g8_QW2XFd49iUmRnHOyG8AAgcAA4GkuUnry9gWDzF_5R4E"
+    animation = (
+        "CgACAgIAAx0CAAGgr9AAAgmSX7b4Y2g8_QW2XFd49iUmRnHOyG8AAgcAA4GkuUnry9gWDzF_5R4E"
+    )
     animation_unique = "AgADBwADgaS5SQ"
 
     check(animation, FileType.ANIMATION)
@@ -80,7 +88,9 @@ def test_animation():
 
 
 def test_voice():
-    voice = "AwACAgIAAx0CAAGgr9AAAgmUX7b4c1KQyHVwzffxC2EnSYWsMAQAAgkAA4GkuUlsZUZ4_I97AR4E"
+    voice = (
+        "AwACAgIAAx0CAAGgr9AAAgmUX7b4c1KQyHVwzffxC2EnSYWsMAQAAgkAA4GkuUlsZUZ4_I97AR4E"
+    )
     voice_unique = "AgADCQADgaS5SQ"
 
     check(voice, FileType.VOICE)
@@ -88,7 +98,9 @@ def test_voice():
 
 
 def test_video_note():
-    video_note = "DQACAgIAAx0CAAGgr9AAAgmVX7b53qrRzCEO13BaLQJaYuFbdlwAAgoAA4GkuUmlqIzDy_PCsx4E"
+    video_note = (
+        "DQACAgIAAx0CAAGgr9AAAgmVX7b53qrRzCEO13BaLQJaYuFbdlwAAgoAA4GkuUmlqIzDy_PCsx4E"
+    )
     video_note_unique = "AgADCgADgaS5SQ"
     video_note_thumb = "AAMCAgADHQIAAaCv0AACCZVftvneqtHMIQ7XcFotAlpi4Vt2XAACCgADgaS5SaWojMPL88KzIH3qihAAAwEAB20AA_meAQABHgQ"
     video_note_thumb_unique = "AQADIH3qihAAA_meAQAB"
@@ -165,7 +177,9 @@ def test_old_file_id():
 
 
 def test_unknown_file_type():
-    unknown = "RQACAgIAAx0CAAGgr9AAAgmPX7b4UxbjNoFEO_L0I4s6wrXNJA8AAgQAA4GkuUm9FFvIaOhXWR4E"
+    unknown = (
+        "RQACAgIAAx0CAAGgr9AAAgmPX7b4UxbjNoFEO_L0I4s6wrXNJA8AAgQAA4GkuUm9FFvIaOhXWR4E"
+    )
 
     with pytest.raises(ValueError, match=r"Unknown file_type \d+ of file_id \w+"):
         check(unknown, FileType.DOCUMENT)
@@ -174,15 +188,21 @@ def test_unknown_file_type():
 def test_unknown_thumbnail_source():
     unknown = "AAMCAgADHQIAAaCv0AACCY9ftvhTFuM2gUQ78vQjizrCtc0kDwACBAADgaS5Sb0UW8ho6FdZIH3qihAAA6QBAAIeBA"
 
-    with pytest.raises(ValueError, match=r"Unknown thumbnail_source \d+ of file_id \w+"):
+    with pytest.raises(
+        ValueError, match=r"Unknown thumbnail_source \d+ of file_id \w+"
+    ):
         check(unknown, FileType.THUMBNAIL)
 
 
 def test_stringify_file_id():
-    file_id = "BQACAgIAAx0CAAGgr9AAAgmPX7b4UxbjNoFEO_L0I4s6wrXNJA8AAgQAA4GkuUm9FFvIaOhXWR4E"
-    string = "{'major': 4, 'minor': 30, 'file_type': , 'dc_id': 2, " \
-             "'file_reference': b'\\x02\\x00\\xa0\\xaf\\xd0\\x00\\x00\\t\\x8f_\\xb6\\xf8S\\x16\\xe36\\x81D;\\xf2\\xf4#\\x8b:\\xc2\\xb5\\xcd$\\x0f', " \
-             "'media_id': 5312458109417947140, 'access_hash': 6437869729085068477, 'thumbnail_size': ''}"
+    file_id = (
+        "BQACAgIAAx0CAAGgr9AAAgmPX7b4UxbjNoFEO_L0I4s6wrXNJA8AAgQAA4GkuUm9FFvIaOhXWR4E"
+    )
+    string = (
+        "{'major': 4, 'minor': 30, 'file_type': , 'dc_id': 2, "
+        "'file_reference': b'\\x02\\x00\\xa0\\xaf\\xd0\\x00\\x00\\t\\x8f_\\xb6\\xf8S\\x16\\xe36\\x81D;\\xf2\\xf4#\\x8b:\\xc2\\xb5\\xcd$\\x0f', "
+        "'media_id': 5312458109417947140, 'access_hash': 6437869729085068477, 'thumbnail_size': ''}"
+    )
 
     assert str(FileId.decode(file_id)) == string