Compare commits

...

14 commits

Author SHA1 Message Date
wulan17
aac5425334
pyrofork: Bump version to 2.3.60
Some checks failed
Pyrofork / build (macos-latest, 3.10) (push) Has been cancelled
Pyrofork / build (macos-latest, 3.11) (push) Has been cancelled
Pyrofork / build (macos-latest, 3.12) (push) Has been cancelled
Pyrofork / build (macos-latest, 3.13) (push) Has been cancelled
Pyrofork / build (macos-latest, 3.9) (push) Has been cancelled
Pyrofork / build (ubuntu-latest, 3.10) (push) Has been cancelled
Pyrofork / build (ubuntu-latest, 3.11) (push) Has been cancelled
Pyrofork / build (ubuntu-latest, 3.12) (push) Has been cancelled
Pyrofork / build (ubuntu-latest, 3.13) (push) Has been cancelled
Pyrofork / build (ubuntu-latest, 3.9) (push) Has been cancelled
Signed-off-by: wulan17 <wulan17@komodos.id>
2025-03-29 00:26:26 +07:00
wulan17
3e24f006e0
pyrofork: Cleanup codes
Signed-off-by: wulan17 <wulan17@komodos.id>
2025-03-29 00:25:16 +07:00
wulan17
f5296145cd
pyrofork: Add support for parsing Reaction as channel
Signed-off-by: wulan17 <wulan17@komodos.id>
2025-03-29 00:24:52 +07:00
wulan17
24d3ea0e48
pyrofork: Update API schema to Layer 201
Signed-off-by: wulan17 <wulan17@komodos.id>
2025-03-29 00:24:47 +07:00
wulan17
70fc7d9eff
pyrofork: Refactor GiveawayResult
Signed-off-by: wulan17 <wulan17@komodos.id>
2025-03-29 00:24:42 +07:00
wulan17
8c47410bba
pyrofork: Refactor ShippingQuery
Signed-off-by: wulan17 <wulan17@komodos.id>
2025-03-29 00:24:35 +07:00
wulan17
c427601210
pyrofork: Refactor Giveaway
Signed-off-by: wulan17 <wulan17@komodos.id>
2025-03-29 00:24:29 +07:00
wulan17
aa1757676c
pyrofork: utils: Don't append message to messages_with_replies if reply_to_msg_id is None
Signed-off-by: wulan17 <wulan17@komodos.id>
2025-03-29 00:23:03 +07:00
wulan17
c4166957d3
Revert "Pyrofork: types: message: Fix cross chat reply parsing"
This reverts commit b4cb8ff17c.

Signed-off-by: wulan17 <wulan17@komodos.id>
2025-03-29 00:22:41 +07:00
KurimuzonAkuma
389a135883
Add ExternalReplyInfo
Signed-off-by: wulan17 <wulan17@komodos.id>
2025-03-29 00:21:47 +07:00
KurimuzonAkuma
6b28d305c0
Add MessageOriginImport
Signed-off-by: wulan17 <wulan17@komodos.id>
2025-03-29 00:21:26 +07:00
KurimuzonAkuma
7ae98099db
Refactor Message
- Refactor Message.quote
- Add forward_origin

Signed-off-by: wulan17 <wulan17@komodos.id>
2025-03-29 00:20:53 +07:00
KurimuzonAkuma
96917949a9
Make url parameter optional for send_web_page
Signed-off-by: wulan17 <wulan17@komodos.id>
2025-03-29 00:20:31 +07:00
wulan17
757b081eeb
pyrofork: Update API schema to Layer 200
Signed-off-by: wulan17 <wulan17@komodos.id>
2025-03-29 00:19:52 +07:00
120 changed files with 1476 additions and 437 deletions

View file

@ -130,7 +130,7 @@ def get_type_hint(type: str) -> str:
return f"Optional[{type}] = None" if is_flag else type
else:
ns, name = type.split(".") if "." in type else ("", type)
type = f'"raw.base.' + ".".join([ns, name]).strip(".") + '"'
type = '"raw.base.' + ".".join([ns, name]).strip(".") + '"'
return f'{type}{" = None" if is_flag else ""}'
@ -430,11 +430,11 @@ def start(format: bool = False):
if function_docs:
docstring += function_docs["desc"] + "\n"
else:
docstring += f"Telegram API function."
docstring += "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 += " Parameters:\n " + \
("\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 +442,12 @@ 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 " \
docstring += "\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
" .. currentmodule:: pyrogram.raw.functions\n\n" \
" .. autosummary::\n" \
" :nosignatures:\n\n" \
" " + references
write_types = read_types = "" if c.has_flags else "# No flags\n "

View file

@ -93,7 +93,7 @@ storage.fileMp4#b3cea0e4 = storage.FileType;
storage.fileWebp#1081464c = storage.FileType;
userEmpty#d3bc4b7a id:long = User;
user#4b46c37e flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true premium:flags.28?true attach_menu_enabled:flags.29?true flags2:# bot_can_edit:flags2.1?true close_friend:flags2.2?true stories_hidden:flags2.3?true stories_unavailable:flags2.4?true contact_require_premium:flags2.10?true bot_business:flags2.11?true bot_has_main_app:flags2.13?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector<RestrictionReason> bot_inline_placeholder:flags.19?string lang_code:flags.22?string emoji_status:flags.30?EmojiStatus usernames:flags2.0?Vector<Username> stories_max_id:flags2.5?int color:flags2.8?PeerColor profile_color:flags2.9?PeerColor bot_active_users:flags2.12?int bot_verification_icon:flags2.14?long = User;
user#20b1422 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true premium:flags.28?true attach_menu_enabled:flags.29?true flags2:# bot_can_edit:flags2.1?true close_friend:flags2.2?true stories_hidden:flags2.3?true stories_unavailable:flags2.4?true contact_require_premium:flags2.10?true bot_business:flags2.11?true bot_has_main_app:flags2.13?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector<RestrictionReason> bot_inline_placeholder:flags.19?string lang_code:flags.22?string emoji_status:flags.30?EmojiStatus usernames:flags2.0?Vector<Username> stories_max_id:flags2.5?int color:flags2.8?PeerColor profile_color:flags2.9?PeerColor bot_active_users:flags2.12?int bot_verification_icon:flags2.14?long send_paid_messages_stars:flags2.15?long = User;
userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto;
userProfilePhoto#82d1f706 flags:# has_video:flags.0?true personal:flags.2?true photo_id:long stripped_thumb:flags.1?bytes dc_id:int = UserProfilePhoto;
@ -108,11 +108,11 @@ userStatusLastMonth#65899777 flags:# by_me:flags.0?true = UserStatus;
chatEmpty#29562865 id:long = Chat;
chat#41cbf256 flags:# creator:flags.0?true left:flags.2?true deactivated:flags.5?true call_active:flags.23?true call_not_empty:flags.24?true noforwards:flags.25?true id:long title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel admin_rights:flags.14?ChatAdminRights default_banned_rights:flags.18?ChatBannedRights = Chat;
chatForbidden#6592a1a7 id:long title:string = Chat;
channel#e00998b7 flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true scam:flags.19?true has_link:flags.20?true has_geo:flags.21?true slowmode_enabled:flags.22?true call_active:flags.23?true call_not_empty:flags.24?true fake:flags.25?true gigagroup:flags.26?true noforwards:flags.27?true join_to_send:flags.28?true join_request:flags.29?true forum:flags.30?true flags2:# stories_hidden:flags2.1?true stories_hidden_min:flags2.2?true stories_unavailable:flags2.3?true signature_profiles:flags2.12?true id:long access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int restriction_reason:flags.9?Vector<RestrictionReason> admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int usernames:flags2.0?Vector<Username> stories_max_id:flags2.4?int color:flags2.7?PeerColor profile_color:flags2.8?PeerColor emoji_status:flags2.9?EmojiStatus level:flags2.10?int subscription_until_date:flags2.11?int bot_verification_icon:flags2.13?long = Chat;
channel#7482147e flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true scam:flags.19?true has_link:flags.20?true has_geo:flags.21?true slowmode_enabled:flags.22?true call_active:flags.23?true call_not_empty:flags.24?true fake:flags.25?true gigagroup:flags.26?true noforwards:flags.27?true join_to_send:flags.28?true join_request:flags.29?true forum:flags.30?true flags2:# stories_hidden:flags2.1?true stories_hidden_min:flags2.2?true stories_unavailable:flags2.3?true signature_profiles:flags2.12?true id:long access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int restriction_reason:flags.9?Vector<RestrictionReason> admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int usernames:flags2.0?Vector<Username> stories_max_id:flags2.4?int color:flags2.7?PeerColor profile_color:flags2.8?PeerColor emoji_status:flags2.9?EmojiStatus level:flags2.10?int subscription_until_date:flags2.11?int bot_verification_icon:flags2.13?long send_paid_messages_stars:flags2.14?long = Chat;
channelForbidden#17d493d5 flags:# broadcast:flags.5?true megagroup:flags.8?true id:long access_hash:long title:string until_date:flags.16?int = Chat;
chatFull#2633421b flags:# can_set_username:flags.7?true has_scheduled:flags.8?true translations_disabled:flags.19?true id:long about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:flags.13?ExportedChatInvite bot_info:flags.3?Vector<BotInfo> pinned_msg_id:flags.6?int folder_id:flags.11?int call:flags.12?InputGroupCall ttl_period:flags.14?int groupcall_default_join_as:flags.15?Peer theme_emoticon:flags.16?string requests_pending:flags.17?int recent_requesters:flags.17?Vector<long> available_reactions:flags.18?ChatReactions reactions_limit:flags.20?int = ChatFull;
channelFull#52d6806b flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true flags2:# can_delete_channel:flags2.0?true antispam:flags2.1?true participants_hidden:flags2.2?true translations_disabled:flags2.3?true stories_pinned_available:flags2.5?true view_forum_as_messages:flags2.6?true restricted_sponsored:flags2.11?true can_view_revenue:flags2.12?true paid_media_allowed:flags2.14?true can_view_stars_revenue:flags2.15?true paid_reactions_available:flags2.16?true stargifts_available:flags2.19?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector<BotInfo> migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector<string> groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string requests_pending:flags.28?int recent_requesters:flags.28?Vector<long> default_send_as:flags.29?Peer available_reactions:flags.30?ChatReactions reactions_limit:flags2.13?int stories:flags2.4?PeerStories wallpaper:flags2.7?WallPaper boosts_applied:flags2.8?int boosts_unrestrict:flags2.9?int emojiset:flags2.10?StickerSet bot_verification:flags2.17?BotVerification stargifts_count:flags2.18?int = ChatFull;
channelFull#52d6806b flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true flags2:# can_delete_channel:flags2.0?true antispam:flags2.1?true participants_hidden:flags2.2?true translations_disabled:flags2.3?true stories_pinned_available:flags2.5?true view_forum_as_messages:flags2.6?true restricted_sponsored:flags2.11?true can_view_revenue:flags2.12?true paid_media_allowed:flags2.14?true can_view_stars_revenue:flags2.15?true paid_reactions_available:flags2.16?true stargifts_available:flags2.19?true paid_messages_available:flags2.20?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector<BotInfo> migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector<string> groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string requests_pending:flags.28?int recent_requesters:flags.28?Vector<long> default_send_as:flags.29?Peer available_reactions:flags.30?ChatReactions reactions_limit:flags2.13?int stories:flags2.4?PeerStories wallpaper:flags2.7?WallPaper boosts_applied:flags2.8?int boosts_unrestrict:flags2.9?int emojiset:flags2.10?StickerSet bot_verification:flags2.17?BotVerification stargifts_count:flags2.18?int = ChatFull;
chatParticipant#c02d4007 user_id:long inviter_id:long date:int = ChatParticipant;
chatParticipantCreator#e46bcee4 user_id:long = ChatParticipant;
@ -125,7 +125,7 @@ chatPhotoEmpty#37c1011c = ChatPhoto;
chatPhoto#1c6e1c11 flags:# has_video:flags.0?true photo_id:long stripped_thumb:flags.1?bytes dc_id:int = ChatPhoto;
messageEmpty#90a6ca84 flags:# id:int peer_id:flags.0?Peer = Message;
message#96fdbbe9 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true pinned:flags.24?true noforwards:flags.26?true invert_media:flags.27?true flags2:# offline:flags2.1?true video_processing_pending:flags2.4?true id:int from_id:flags.8?Peer from_boosts_applied:flags.29?int peer_id:Peer saved_peer_id:flags.28?Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long via_business_bot_id:flags2.0?long reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector<MessageEntity> views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long reactions:flags.20?MessageReactions restriction_reason:flags.22?Vector<RestrictionReason> ttl_period:flags.25?int quick_reply_shortcut_id:flags.30?int effect:flags2.2?long factcheck:flags2.3?FactCheck report_delivery_until_date:flags2.5?int = Message;
message#eabcdd4d flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true pinned:flags.24?true noforwards:flags.26?true invert_media:flags.27?true flags2:# offline:flags2.1?true video_processing_pending:flags2.4?true id:int from_id:flags.8?Peer from_boosts_applied:flags.29?int peer_id:Peer saved_peer_id:flags.28?Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long via_business_bot_id:flags2.0?long reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector<MessageEntity> views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long reactions:flags.20?MessageReactions restriction_reason:flags.22?Vector<RestrictionReason> ttl_period:flags.25?int quick_reply_shortcut_id:flags.30?int effect:flags2.2?long factcheck:flags2.3?FactCheck report_delivery_until_date:flags2.5?int paid_message_stars:flags2.6?long = Message;
messageService#d3d28540 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true reactions_are_possible:flags.9?true silent:flags.13?true post:flags.14?true legacy:flags.19?true id:int from_id:flags.8?Peer peer_id:Peer reply_to:flags.3?MessageReplyHeader date:int action:MessageAction reactions:flags.20?MessageReactions ttl_period:flags.25?int = Message;
messageMediaEmpty#3ded6320 = MessageMedia;
@ -184,7 +184,7 @@ messageActionTopicEdit#c0944820 flags:# title:flags.0?string icon_emoji_id:flags
messageActionSuggestProfilePhoto#57de635e photo:Photo = MessageAction;
messageActionRequestedPeer#31518e9b button_id:int peers:Vector<Peer> = MessageAction;
messageActionSetChatWallPaper#5060a3f4 flags:# same:flags.0?true for_both:flags.1?true wallpaper:WallPaper = MessageAction;
messageActionGiftCode#56d03994 flags:# via_giveaway:flags.0?true unclaimed:flags.2?true boost_peer:flags.1?Peer months:int slug:string currency:flags.2?string amount:flags.2?long crypto_currency:flags.3?string crypto_amount:flags.3?long message:flags.4?TextWithEntities = MessageAction;
messageActionGiftCode#56d03994 flags:# via_giveaway:flags.0?true unclaimed:flags.5?true boost_peer:flags.1?Peer months:int slug:string currency:flags.2?string amount:flags.2?long crypto_currency:flags.3?string crypto_amount:flags.3?long message:flags.4?TextWithEntities = MessageAction;
messageActionGiveawayLaunch#a80f51e4 flags:# stars:flags.0?long = MessageAction;
messageActionGiveawayResults#87e2f155 flags:# stars:flags.0?true winners_count:int unclaimed_count:int = MessageAction;
messageActionBoostApply#cc02aa6d boosts:int = MessageAction;
@ -194,6 +194,8 @@ messageActionGiftStars#45d5b021 flags:# currency:string amount:long stars:long c
messageActionPrizeStars#b00c47a2 flags:# unclaimed:flags.0?true stars:long transaction_id:string boost_peer:Peer giveaway_msg_id:int = MessageAction;
messageActionStarGift#4717e8a4 flags:# name_hidden:flags.0?true saved:flags.2?true converted:flags.3?true upgraded:flags.5?true refunded:flags.9?true can_upgrade:flags.10?true gift:StarGift message:flags.1?TextWithEntities convert_stars:flags.4?long upgrade_msg_id:flags.5?int upgrade_stars:flags.8?long from_id:flags.11?Peer peer:flags.12?Peer saved_id:flags.12?long = MessageAction;
messageActionStarGiftUnique#acdfcb81 flags:# upgrade:flags.0?true transferred:flags.1?true saved:flags.2?true refunded:flags.5?true gift:StarGift can_export_at:flags.3?int transfer_stars:flags.4?long from_id:flags.6?Peer peer:flags.7?Peer saved_id:flags.7?long = MessageAction;
messageActionPaidMessagesRefunded#ac1f1fcd count:int stars:long = MessageAction;
messageActionPaidMessagesPrice#bcd71419 stars:long = MessageAction;
dialog#d58a08c6 flags:# pinned:flags.2?true unread_mark:flags.3?true view_forum_as_messages:flags.6?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int ttl_period:flags.5?int = Dialog;
dialogFolder#71bd134c flags:# pinned:flags.2?true folder:Folder peer:Peer top_message:int unread_muted_peers_count:int unread_unmuted_peers_count:int unread_muted_messages_count:int unread_unmuted_messages_count:int = Dialog;
@ -213,6 +215,7 @@ geoPoint#b2a2f663 flags:# long:double lat:double access_hash:long accuracy_radiu
auth.sentCode#5e002502 flags:# type:auth.SentCodeType phone_code_hash:string next_type:flags.1?auth.CodeType timeout:flags.2?int = auth.SentCode;
auth.sentCodeSuccess#2390fe44 authorization:auth.Authorization = auth.SentCode;
auth.sentCodePaymentRequired#d7cef980 store_product:string phone_code_hash:string = auth.SentCode;
auth.authorization#2ea2c0d4 flags:# setup_password_required:flags.1?true otherwise_relogin_days:flags.1?int tmp_sessions:flags.0?int future_auth_token:flags.2?bytes user:User = auth.Authorization;
auth.authorizationSignUpRequired#44747e9a flags:# terms_of_service:flags.0?help.TermsOfService = auth.Authorization;
@ -229,7 +232,7 @@ inputPeerNotifySettings#cacb6ae2 flags:# show_previews:flags.0?Bool silent:flags
peerNotifySettings#99622c0c flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int ios_sound:flags.3?NotificationSound android_sound:flags.4?NotificationSound other_sound:flags.5?NotificationSound stories_muted:flags.6?Bool stories_hide_sender:flags.7?Bool stories_ios_sound:flags.8?NotificationSound stories_android_sound:flags.9?NotificationSound stories_other_sound:flags.10?NotificationSound = PeerNotifySettings;
peerSettings#acd66c5e flags:# report_spam:flags.0?true add_contact:flags.1?true block_contact:flags.2?true share_contact:flags.3?true need_contacts_exception:flags.4?true report_geo:flags.5?true autoarchived:flags.7?true invite_members:flags.8?true request_chat_broadcast:flags.10?true business_bot_paused:flags.11?true business_bot_can_reply:flags.12?true geo_distance:flags.6?int request_chat_title:flags.9?string request_chat_date:flags.9?int business_bot_id:flags.13?long business_bot_manage_url:flags.13?string = PeerSettings;
peerSettings#f47741f7 flags:# report_spam:flags.0?true add_contact:flags.1?true block_contact:flags.2?true share_contact:flags.3?true need_contacts_exception:flags.4?true report_geo:flags.5?true autoarchived:flags.7?true invite_members:flags.8?true request_chat_broadcast:flags.10?true business_bot_paused:flags.11?true business_bot_can_reply:flags.12?true geo_distance:flags.6?int request_chat_title:flags.9?string request_chat_date:flags.9?int business_bot_id:flags.13?long business_bot_manage_url:flags.13?string charge_paid_message_stars:flags.14?long registration_month:flags.15?string phone_country:flags.16?string name_change_date:flags.17?int photo_change_date:flags.18?int = PeerSettings;
wallPaper#a437c3ed id:long flags:# creator:flags.0?true default:flags.1?true pattern:flags.3?true dark:flags.4?true access_hash:long slug:string document:Document settings:flags.2?WallPaperSettings = WallPaper;
wallPaperNoFile#e0804116 id:long flags:# default:flags.1?true dark:flags.4?true settings:flags.2?WallPaperSettings = WallPaper;
@ -245,7 +248,7 @@ inputReportReasonFake#f5ddd6e7 = ReportReason;
inputReportReasonIllegalDrugs#a8eb2be = ReportReason;
inputReportReasonPersonalDetails#9ec7863d = ReportReason;
userFull#4d975bbc flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true wallpaper_overridden:flags.28?true contact_require_premium:flags.29?true read_dates_private:flags.30?true flags2:# sponsored_enabled:flags2.7?true can_view_revenue:flags2.9?true bot_can_manage_emoji_status:flags2.10?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights premium_gifts:flags.19?Vector<PremiumGiftOption> wallpaper:flags.24?WallPaper stories:flags.25?PeerStories business_work_hours:flags2.0?BusinessWorkHours business_location:flags2.1?BusinessLocation business_greeting_message:flags2.2?BusinessGreetingMessage business_away_message:flags2.3?BusinessAwayMessage business_intro:flags2.4?BusinessIntro birthday:flags2.5?Birthday personal_channel_id:flags2.6?long personal_channel_message:flags2.6?int stargifts_count:flags2.8?int starref_program:flags2.11?StarRefProgram bot_verification:flags2.12?BotVerification = UserFull;
userFull#99e78045 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true stories_pinned_available:flags.26?true blocked_my_stories_from:flags.27?true wallpaper_overridden:flags.28?true contact_require_premium:flags.29?true read_dates_private:flags.30?true flags2:# sponsored_enabled:flags2.7?true can_view_revenue:flags2.9?true bot_can_manage_emoji_status:flags2.10?true display_gifts_button:flags2.16?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights wallpaper:flags.24?WallPaper stories:flags.25?PeerStories business_work_hours:flags2.0?BusinessWorkHours business_location:flags2.1?BusinessLocation business_greeting_message:flags2.2?BusinessGreetingMessage business_away_message:flags2.3?BusinessAwayMessage business_intro:flags2.4?BusinessIntro birthday:flags2.5?Birthday personal_channel_id:flags2.6?long personal_channel_message:flags2.6?int stargifts_count:flags2.8?int starref_program:flags2.11?StarRefProgram bot_verification:flags2.12?BotVerification send_paid_messages_stars:flags2.14?long disallowed_gifts:flags2.15?DisallowedGiftsSettings = UserFull;
contact#145ade0b user_id:long mutual:Bool = Contact;
@ -436,6 +439,7 @@ updateBusinessBotCallbackQuery#1ea2fda7 flags:# query_id:long user_id:long conne
updateStarsRevenueStatus#a584b019 peer:Peer status:StarsRevenueStatus = Update;
updateBotPurchasedPaidMedia#283bd312 user_id:long payload:string qts:int = Update;
updatePaidReactionPrivacy#8b725fce private:PaidReactionPrivacy = Update;
updateSentPhoneCode#504aa18f sent_code:auth.SentCode = Update;
updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State;
@ -543,6 +547,7 @@ inputPrivacyKeyVoiceMessages#aee69d68 = InputPrivacyKey;
inputPrivacyKeyAbout#3823cc40 = InputPrivacyKey;
inputPrivacyKeyBirthday#d65a11cc = InputPrivacyKey;
inputPrivacyKeyStarGiftsAutoSave#e1732341 = InputPrivacyKey;
inputPrivacyKeyNoPaidMessages#bdc597b4 = InputPrivacyKey;
privacyKeyStatusTimestamp#bc2eab30 = PrivacyKey;
privacyKeyChatInvite#500e6dfa = PrivacyKey;
@ -556,6 +561,7 @@ privacyKeyVoiceMessages#697f414 = PrivacyKey;
privacyKeyAbout#a486b761 = PrivacyKey;
privacyKeyBirthday#2000a518 = PrivacyKey;
privacyKeyStarGiftsAutoSave#2ca4fdf8 = PrivacyKey;
privacyKeyNoPaidMessages#17d348d2 = PrivacyKey;
inputPrivacyValueAllowContacts#d09e07b = InputPrivacyRule;
inputPrivacyValueAllowAll#184b35ce = InputPrivacyRule;
@ -1318,7 +1324,7 @@ statsGroupTopInviter#535f779d user_id:long invitations:int = StatsGroupTopInvite
stats.megagroupStats#ef7ff916 period:StatsDateRangeDays members:StatsAbsValueAndPrev messages:StatsAbsValueAndPrev viewers:StatsAbsValueAndPrev posters:StatsAbsValueAndPrev growth_graph:StatsGraph members_graph:StatsGraph new_members_by_source_graph:StatsGraph languages_graph:StatsGraph messages_graph:StatsGraph actions_graph:StatsGraph top_hours_graph:StatsGraph weekdays_graph:StatsGraph top_posters:Vector<StatsGroupTopPoster> top_admins:Vector<StatsGroupTopAdmin> top_inviters:Vector<StatsGroupTopInviter> users:Vector<User> = stats.MegagroupStats;
globalPrivacySettings#734c4ccb flags:# archive_and_mute_new_noncontact_peers:flags.0?true keep_archived_unmuted:flags.1?true keep_archived_folders:flags.2?true hide_read_marks:flags.3?true new_noncontact_peers_require_premium:flags.4?true = GlobalPrivacySettings;
globalPrivacySettings#fe41b34f flags:# archive_and_mute_new_noncontact_peers:flags.0?true keep_archived_unmuted:flags.1?true keep_archived_folders:flags.2?true hide_read_marks:flags.3?true new_noncontact_peers_require_premium:flags.4?true display_gifts_button:flags.7?true noncontact_peers_paid_stars:flags.5?long disallowed_gifts:flags.6?DisallowedGiftsSettings = GlobalPrivacySettings;
help.countryCode#4203c5ef flags:# country_code:string prefixes:flags.0?Vector<string> patterns:flags.1?Vector<string> = help.CountryCode;
@ -1486,7 +1492,7 @@ inputInvoiceStars#65f00ce3 purpose:InputStorePaymentPurpose = InputInvoice;
inputInvoiceChatInviteSubscription#34e793f1 hash:string = InputInvoice;
inputInvoiceStarGift#e8625e92 flags:# hide_name:flags.0?true include_upgrade:flags.2?true peer:InputPeer gift_id:long message:flags.1?TextWithEntities = InputInvoice;
inputInvoiceStarGiftUpgrade#4d818d5d flags:# keep_original_details:flags.0?true stargift:InputSavedStarGift = InputInvoice;
inputInvoiceStarGiftTransfer#4a5f5bd9 stargift:InputSavedStarGift to_id:InputPeer = InputInvoice;
inputInvoicePremiumGiftStars#dabab2ef flags:# user_id:InputUser months:int message:flags.0?TextWithEntities = InputInvoice;
payments.exportedInvoice#aed0cbd9 url:string = payments.ExportedInvoice;
@ -1501,8 +1507,7 @@ inputStorePaymentPremiumGiveaway#160544ca flags:# only_new_subscribers:flags.0?t
inputStorePaymentStarsTopup#dddd0f56 stars:long currency:string amount:long = InputStorePaymentPurpose;
inputStorePaymentStarsGift#1d741ef7 user_id:InputUser stars:long currency:string amount:long = InputStorePaymentPurpose;
inputStorePaymentStarsGiveaway#751f08fa flags:# only_new_subscribers:flags.0?true winners_are_visible:flags.3?true stars:long boost_peer:InputPeer additional_peers:flags.1?Vector<InputPeer> countries_iso2:flags.2?Vector<string> prize_description:flags.4?string random_id:long until_date:int currency:string amount:long users:int = InputStorePaymentPurpose;
premiumGiftOption#74c34319 flags:# months:int currency:string amount:long bot_url:string store_product:flags.0?string = PremiumGiftOption;
inputStorePaymentAuthCode#9bb2636d flags:# restore:flags.0?true phone_number:string phone_code_hash:string currency:string amount:long = InputStorePaymentPurpose;
paymentFormMethod#88f8f21b url:string title:string = PaymentFormMethod;
@ -1761,7 +1766,7 @@ inputQuickReplyShortcutId#1190cf1 shortcut_id:int = InputQuickReplyShortcut;
messages.quickReplies#c68d6695 quick_replies:Vector<QuickReply> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> = messages.QuickReplies;
messages.quickRepliesNotModified#5f91eb5b = messages.QuickReplies;
connectedBot#bd068601 flags:# can_reply:flags.0?true bot_id:long recipients:BusinessBotRecipients = ConnectedBot;
connectedBot#cd64636c flags:# bot_id:long recipients:BusinessBotRecipients rights:BusinessBotRights = ConnectedBot;
account.connectedBots#17d7f87b connected_bots:Vector<ConnectedBot> users:Vector<User> = account.ConnectedBots;
@ -1769,7 +1774,7 @@ messages.dialogFilters#2ad93719 flags:# tags_enabled:flags.0?true filters:Vector
birthday#6c8e1e06 flags:# day:int month:int year:flags.0?int = Birthday;
botBusinessConnection#896433b4 flags:# can_reply:flags.0?true disabled:flags.1?true connection_id:string user_id:long dc_id:int date:int = BotBusinessConnection;
botBusinessConnection#8f34b2f5 flags:# disabled:flags.1?true connection_id:string user_id:long dc_id:int date:int rights:flags.2?BusinessBotRights = BotBusinessConnection;
inputBusinessIntro#9c469cd flags:# title:string description:string sticker:flags.0?InputDocument = InputBusinessIntro;
@ -1847,7 +1852,7 @@ starsTransactionPeerAPI#f9677aad = StarsTransactionPeer;
starsTopupOption#bd915c0 flags:# extended:flags.1?true stars:long store_product:flags.0?string currency:string amount:long = StarsTopupOption;
starsTransaction#64dfc926 flags:# refund:flags.3?true pending:flags.4?true failed:flags.6?true gift:flags.10?true reaction:flags.11?true stargift_upgrade:flags.18?true id:string stars:StarsAmount date:int peer:StarsTransactionPeer title:flags.0?string description:flags.1?string photo:flags.2?WebDocument transaction_date:flags.5?int transaction_url:flags.5?string bot_payload:flags.7?bytes msg_id:flags.8?int extended_media:flags.9?Vector<MessageMedia> subscription_period:flags.12?int giveaway_post_id:flags.13?int stargift:flags.14?StarGift floodskip_number:flags.15?int starref_commission_permille:flags.16?int starref_peer:flags.17?Peer starref_amount:flags.17?StarsAmount = StarsTransaction;
starsTransaction#a39fd94a flags:# refund:flags.3?true pending:flags.4?true failed:flags.6?true gift:flags.10?true reaction:flags.11?true stargift_upgrade:flags.18?true id:string stars:StarsAmount date:int peer:StarsTransactionPeer title:flags.0?string description:flags.1?string photo:flags.2?WebDocument transaction_date:flags.5?int transaction_url:flags.5?string bot_payload:flags.7?bytes msg_id:flags.8?int extended_media:flags.9?Vector<MessageMedia> subscription_period:flags.12?int giveaway_post_id:flags.13?int stargift:flags.14?StarGift floodskip_number:flags.15?int starref_commission_permille:flags.16?int starref_peer:flags.17?Peer starref_amount:flags.17?StarsAmount paid_messages:flags.19?int premium_gift_months:flags.20?int = StarsTransaction;
payments.starsStatus#6c9ce8ed flags:# balance:StarsAmount subscriptions:flags.1?Vector<StarsSubscription> subscriptions_next_offset:flags.2?string subscriptions_missing_balance:flags.4?long history:flags.3?Vector<StarsTransaction> next_offset:flags.0?string chats:Vector<Chat> users:Vector<User> = payments.StarsStatus;
@ -1934,7 +1939,7 @@ payments.uniqueStarGift#caa2f60b gift:StarGift users:Vector<User> = payments.Uni
messages.webPagePreview#b53e8b21 media:MessageMedia users:Vector<User> = messages.WebPagePreview;
savedStarGift#6056dba5 flags:# name_hidden:flags.0?true unsaved:flags.5?true refunded:flags.9?true can_upgrade:flags.10?true from_id:flags.1?Peer date:int gift:StarGift message:flags.2?TextWithEntities msg_id:flags.3?int saved_id:flags.11?long convert_stars:flags.4?long upgrade_stars:flags.6?long can_export_at:flags.7?int transfer_stars:flags.8?long = SavedStarGift;
savedStarGift#6056dba5 flags:# name_hidden:flags.0?true unsaved:flags.5?true refunded:flags.9?true can_upgrade:flags.10?true pinned_to_top:flags.12?true from_id:flags.1?Peer date:int gift:StarGift message:flags.2?TextWithEntities msg_id:flags.3?int saved_id:flags.11?long convert_stars:flags.4?long upgrade_stars:flags.6?long can_export_at:flags.7?int transfer_stars:flags.8?long = SavedStarGift;
payments.savedStarGifts#95f389b1 flags:# count:int chat_notifications_enabled:flags.1?Bool gifts:Vector<SavedStarGift> next_offset:flags.0?string chats:Vector<Chat> users:Vector<User> = payments.SavedStarGifts;
@ -1947,6 +1952,21 @@ paidReactionPrivacyDefault#206ad49e = PaidReactionPrivacy;
paidReactionPrivacyAnonymous#1f0c1ad9 = PaidReactionPrivacy;
paidReactionPrivacyPeer#dc6cfcf0 peer:InputPeer = PaidReactionPrivacy;
account.paidMessagesRevenue#1e109708 stars_amount:long = account.PaidMessagesRevenue;
requirementToContactEmpty#50a9839 = RequirementToContact;
requirementToContactPremium#e581e4e9 = RequirementToContact;
requirementToContactPaidMessages#b4f67e93 stars_amount:long = RequirementToContact;
businessBotRights#a0624cf7 flags:# reply:flags.0?true read_messages:flags.1?true delete_sent_messages:flags.2?true delete_received_messages:flags.3?true edit_name:flags.4?true edit_bio:flags.5?true edit_profile_photo:flags.6?true edit_username:flags.7?true view_gifts:flags.8?true sell_gifts:flags.9?true change_gift_settings:flags.10?true transfer_and_upgrade_gifts:flags.11?true transfer_stars:flags.12?true manage_stories:flags.13?true = BusinessBotRights;
disallowedGiftsSettings#71f276c4 flags:# disallow_unlimited_stargifts:flags.0?true disallow_limited_stargifts:flags.1?true disallow_unique_stargifts:flags.2?true disallow_premium_gifts:flags.3?true = DisallowedGiftsSettings;
sponsoredPeer#c69708d3 flags:# random_id:bytes peer:Peer sponsor_info:flags.0?string additional_info:flags.1?string = SponsoredPeer;
contacts.sponsoredPeersEmpty#ea32b4b1 = contacts.SponsoredPeers;
contacts.sponsoredPeers#eb032884 peers:Vector<SponsoredPeer> chats:Vector<Chat> users:Vector<User> = contacts.SponsoredPeers;
---functions---
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
@ -2081,7 +2101,7 @@ account.updateBusinessWorkHours#4b00e066 flags:# business_work_hours:flags.0?Bus
account.updateBusinessLocation#9e6b131a flags:# geo_point:flags.1?InputGeoPoint address:flags.0?string = Bool;
account.updateBusinessGreetingMessage#66cdafc4 flags:# message:flags.0?InputBusinessGreetingMessage = Bool;
account.updateBusinessAwayMessage#a26a7fa5 flags:# message:flags.0?InputBusinessAwayMessage = Bool;
account.updateConnectedBot#43d8521d flags:# can_reply:flags.0?true deleted:flags.1?true bot:InputUser recipients:InputBusinessBotRecipients = Updates;
account.updateConnectedBot#66a08c7e flags:# deleted:flags.1?true rights:flags.0?BusinessBotRights bot:InputUser recipients:InputBusinessBotRecipients = Updates;
account.getConnectedBots#4ea4c80f = account.ConnectedBots;
account.getBotBusinessConnection#76a86270 connection_id:string = Updates;
account.updateBusinessIntro#a614d034 flags:# intro:flags.0?InputBusinessIntro = Bool;
@ -2098,11 +2118,13 @@ account.toggleSponsoredMessages#b9d9a38d enabled:Bool = Bool;
account.getReactionsNotifySettings#6dd654c = ReactionsNotifySettings;
account.setReactionsNotifySettings#316ce548 settings:ReactionsNotifySettings = ReactionsNotifySettings;
account.getCollectibleEmojiStatuses#2e7b4543 hash:long = account.EmojiStatuses;
account.addNoPaidMessagesException#6f688aa7 flags:# refund_charged:flags.0?true user_id:InputUser = Bool;
account.getPaidMessagesRevenue#f1266f38 user_id:InputUser = account.PaidMessagesRevenue;
users.getUsers#d91a548 id:Vector<InputUser> = Vector<User>;
users.getFullUser#b60f5918 id:InputUser = users.UserFull;
users.setSecureValueErrors#90c894b5 id:InputUser errors:Vector<SecureValueError> = Bool;
users.getIsPremiumRequiredToContact#a622aa10 id:Vector<InputUser> = Vector<Bool>;
users.getRequirementsToContact#d89a83a3 id:Vector<InputUser> = Vector<RequirementToContact>;
contacts.getContactIDs#7adc669d hash:long = Vector<int>;
contacts.getStatuses#c4a353ee = Vector<ContactStatus>;
@ -2130,6 +2152,7 @@ contacts.importContactToken#13005788 token:string = User;
contacts.editCloseFriends#ba6705f0 id:Vector<long> = Bool;
contacts.setBlocked#94c65c76 flags:# my_stories_from:flags.0?true id:Vector<InputPeer> limit:int = Bool;
contacts.getBirthdays#daeda864 = contacts.ContactBirthdays;
contacts.getSponsoredPeers#b6c8c393 q:string = contacts.SponsoredPeers;
messages.getMessages#63c66506 id:Vector<InputMessage> = messages.Messages;
messages.getDialogs#a0f4cb4f flags:# exclude_pinned:flags.0?true folder_id:flags.1?int offset_date:int offset_id:int offset_peer:InputPeer limit:int hash:long = messages.Dialogs;
@ -2140,9 +2163,9 @@ messages.deleteHistory#b08f922a flags:# just_clear:flags.0?true revoke:flags.1?t
messages.deleteMessages#e58e95d2 flags:# revoke:flags.0?true id:Vector<int> = messages.AffectedMessages;
messages.receivedMessages#5a954c0 max_id:int = Vector<ReceivedNotifyMessage>;
messages.setTyping#58943ee2 flags:# peer:InputPeer top_msg_id:flags.0?int action:SendMessageAction = Bool;
messages.sendMessage#983f9745 flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true allow_paid_floodskip:flags.19?true peer:InputPeer reply_to:flags.0?InputReplyTo message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long = Updates;
messages.sendMedia#7852834e flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true allow_paid_floodskip:flags.19?true peer:InputPeer reply_to:flags.0?InputReplyTo media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long = Updates;
messages.forwardMessages#6d74da08 flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true drop_author:flags.11?true drop_media_captions:flags.12?true noforwards:flags.14?true allow_paid_floodskip:flags.19?true from_peer:InputPeer id:Vector<int> random_id:Vector<long> to_peer:InputPeer top_msg_id:flags.9?int schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut video_timestamp:flags.20?int = Updates;
messages.sendMessage#fbf2340a flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true allow_paid_floodskip:flags.19?true peer:InputPeer reply_to:flags.0?InputReplyTo message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long allow_paid_stars:flags.21?long = Updates;
messages.sendMedia#a550cd78 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true allow_paid_floodskip:flags.19?true peer:InputPeer reply_to:flags.0?InputReplyTo media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long allow_paid_stars:flags.21?long = Updates;
messages.forwardMessages#bb9fa475 flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true drop_author:flags.11?true drop_media_captions:flags.12?true noforwards:flags.14?true allow_paid_floodskip:flags.19?true from_peer:InputPeer id:Vector<int> random_id:Vector<long> to_peer:InputPeer top_msg_id:flags.9?int schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut video_timestamp:flags.20?int allow_paid_stars:flags.21?long = Updates;
messages.reportSpam#cf1592db peer:InputPeer = Bool;
messages.getPeerSettings#efd9a6a2 peer:InputPeer = messages.PeerSettings;
messages.report#fc78af9b peer:InputPeer id:Vector<int> option:bytes message:string = ReportResult;
@ -2185,7 +2208,7 @@ messages.getSavedGifs#5cf09635 hash:long = messages.SavedGifs;
messages.saveGif#327a30cb id:InputDocument unsave:Bool = Bool;
messages.getInlineBotResults#514e999d flags:# bot:InputUser peer:InputPeer geo_point:flags.0?InputGeoPoint query:string offset:string = messages.BotResults;
messages.setInlineBotResults#bb12a419 flags:# gallery:flags.0?true private:flags.1?true query_id:long results:Vector<InputBotInlineResult> cache_time:int next_offset:flags.2?string switch_pm:flags.3?InlineBotSwitchPM switch_webview:flags.4?InlineBotWebView = Bool;
messages.sendInlineBotResult#3ebee86a flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true hide_via:flags.11?true peer:InputPeer reply_to:flags.0?InputReplyTo random_id:long query_id:long id:string schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut = Updates;
messages.sendInlineBotResult#c0cf7646 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true hide_via:flags.11?true peer:InputPeer reply_to:flags.0?InputReplyTo random_id:long query_id:long id:string schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut allow_paid_stars:flags.21?long = Updates;
messages.getMessageEditData#fda68d36 peer:InputPeer id:int = messages.MessageEditData;
messages.editMessage#dfd14005 flags:# no_webpage:flags.1?true invert_media:flags.16?true peer:InputPeer id:int message:flags.11?string media:flags.14?InputMedia reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.15?int quick_reply_shortcut_id:flags.17?int = Updates;
messages.editInlineBotMessage#83557dba flags:# no_webpage:flags.1?true invert_media:flags.16?true id:InputBotInlineMessageID message:flags.11?string media:flags.14?InputMedia reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> = Bool;
@ -2220,7 +2243,7 @@ messages.faveSticker#b9ffc55b id:InputDocument unfave:Bool = Bool;
messages.getUnreadMentions#f107e790 flags:# peer:InputPeer top_msg_id:flags.0?int offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages;
messages.readMentions#36e5bf4d flags:# peer:InputPeer top_msg_id:flags.0?int = messages.AffectedHistory;
messages.getRecentLocations#702a40e0 peer:InputPeer limit:int hash:long = messages.Messages;
messages.sendMultiMedia#37b74355 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true allow_paid_floodskip:flags.19?true peer:InputPeer reply_to:flags.0?InputReplyTo multi_media:Vector<InputSingleMedia> schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long = Updates;
messages.sendMultiMedia#1bf89d74 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true invert_media:flags.16?true allow_paid_floodskip:flags.19?true peer:InputPeer reply_to:flags.0?InputReplyTo multi_media:Vector<InputSingleMedia> schedule_date:flags.10?int send_as:flags.13?InputPeer quick_reply_shortcut:flags.17?InputQuickReplyShortcut effect:flags.18?long allow_paid_stars:flags.21?long = Updates;
messages.uploadEncryptedFile#5057c497 peer:InputEncryptedChat file:InputEncryptedFile = EncryptedFile;
messages.searchStickerSets#35705b8a flags:# exclude_featured:flags.0?true q:string hash:long = messages.FoundStickerSets;
messages.getSplitRanges#1cff7e08 = Vector<MessageRange>;
@ -2348,9 +2371,9 @@ messages.requestMainWebView#c9e01e7b flags:# compact:flags.7?true fullscreen:fla
messages.sendPaidReaction#58bbcb50 flags:# peer:InputPeer msg_id:int count:int random_id:long private:flags.0?PaidReactionPrivacy = Updates;
messages.togglePaidReactionPrivacy#435885b5 peer:InputPeer msg_id:int private:PaidReactionPrivacy = Bool;
messages.getPaidReactionPrivacy#472455aa = Updates;
messages.viewSponsoredMessage#673ad8f1 peer:InputPeer random_id:bytes = Bool;
messages.clickSponsoredMessage#f093465 flags:# media:flags.0?true fullscreen:flags.1?true peer:InputPeer random_id:bytes = Bool;
messages.reportSponsoredMessage#1af3dbb8 peer:InputPeer random_id:bytes option:bytes = channels.SponsoredMessageReportResult;
messages.viewSponsoredMessage#269e3643 random_id:bytes = Bool;
messages.clickSponsoredMessage#8235057e flags:# media:flags.0?true fullscreen:flags.1?true random_id:bytes = Bool;
messages.reportSponsoredMessage#12cbf0c4 random_id:bytes option:bytes = channels.SponsoredMessageReportResult;
messages.getSponsoredMessages#9bd2f439 peer:InputPeer = messages.SponsoredMessages;
messages.savePreparedInlineMessage#f21f7f2f flags:# result:InputBotInlineResult user_id:InputUser peer_types:flags.0?Vector<InlineQueryPeerType> = messages.BotPreparedInlineMessage;
messages.getPreparedInlineMessage#857ebdb8 bot:InputUser id:string = messages.PreparedInlineMessage;
@ -2463,6 +2486,7 @@ channels.setBoostsToUnblockRestrictions#ad399cee channel:InputChannel boosts:int
channels.setEmojiStickers#3cd930b7 channel:InputChannel stickerset:InputStickerSet = Bool;
channels.restrictSponsoredMessages#9ae91519 channel:InputChannel restricted:Bool = Updates;
channels.searchPosts#d19f987b hashtag:string offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages;
channels.updatePaidMessagesPrice#fc84653f channel:InputChannel send_paid_messages_stars:long = Updates;
bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON;
bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool;
@ -2505,7 +2529,6 @@ payments.getBankCardData#2e79d779 number:string = payments.BankCardData;
payments.exportInvoice#f91b065 invoice_media:InputMedia = payments.ExportedInvoice;
payments.assignAppStoreTransaction#80ed747d receipt:bytes purpose:InputStorePaymentPurpose = Updates;
payments.assignPlayMarketTransaction#dffd50d3 receipt:DataJSON purpose:InputStorePaymentPurpose = Updates;
payments.canPurchasePremium#9fc19eb6 purpose:InputStorePaymentPurpose = Bool;
payments.getPremiumGiftCodeOptions#2757ba54 flags:# boost_peer:flags.0?InputPeer = Vector<PremiumGiftCodeOption>;
payments.checkGiftCode#8e51b4c1 slug:string = payments.CheckedGiftCode;
payments.applyGiftCode#f6e26854 slug:string = Updates;
@ -2542,6 +2565,8 @@ payments.getSavedStarGifts#23830de9 flags:# exclude_unsaved:flags.0?true exclude
payments.getSavedStarGift#b455a106 stargift:Vector<InputSavedStarGift> = payments.SavedStarGifts;
payments.getStarGiftWithdrawalUrl#d06e93a8 stargift:InputSavedStarGift password:InputCheckPasswordSRP = payments.StarGiftWithdrawalUrl;
payments.toggleChatStarGiftNotifications#60eaefa1 flags:# enabled:flags.0?true peer:InputPeer = Bool;
payments.toggleStarGiftsPinnedToTop#1513e7b0 peer:InputPeer stargift:Vector<InputSavedStarGift> = Bool;
payments.canPurchaseStore#4fdc5ea7 purpose:InputStorePaymentPurpose = Bool;
stickers.createStickerSet#9021ab67 flags:# masks:flags.0?true emojis:flags.5?true text_color:flags.6?true user_id:InputUser title:string short_name:string thumb:flags.2?InputDocument stickers:Vector<InputStickerSetItem> software:flags.3?string = messages.StickerSet;
stickers.removeStickerFromSet#f7760f51 sticker:InputDocument = messages.StickerSet;
@ -2662,4 +2687,4 @@ smsjobs.finishJob#4f1ebf24 flags:# job_id:string error:flags.0?string = Bool;
fragment.getCollectibleInfo#be1e85ba collectible:InputCollectible = fragment.CollectibleInfo;
// LAYER 199
// LAYER 201

View file

@ -449,7 +449,7 @@ def pyrogram_api():
fmt_keys = {}
for k, v in categories.items():
name, *methods = get_title_list(v)
_, *methods = get_title_list(v)
fmt_keys.update({k: "\n ".join("{0} <{0}>".format(m) for m in methods)})
for method in methods:
@ -513,11 +513,18 @@ def pyrogram_api():
Messages & Media
Message
MessageEntity
MessageOriginChannel
MessageOriginChat
MessageOriginHiddenUser
MessageOriginImport
MessageOriginUser
MessageOrigin
Photo
Thumbnail
Audio
AvailableEffect
Document
ExternalReplyInfo
AlternativeVideo
Animation
Video
@ -540,6 +547,7 @@ def pyrogram_api():
WebPagePreview
TranscribedAudio
TranslatedText
TextQuote
Poll
PollOption
Dice
@ -732,7 +740,7 @@ def pyrogram_api():
fmt_keys = {}
for k, v in categories.items():
name, *types = get_title_list(v)
_, *types = get_title_list(v)
fmt_keys.update({k: "\n ".join(types)})

View file

@ -29,7 +29,7 @@ from pygments.styles.friendly import FriendlyStyle
FriendlyStyle.background_color = "#f3f2f1"
project = "Pyrofork"
copyright = f"2022-present, Mayuri-Chan"
copyright = "2022-present, Mayuri-Chan"
author = "Mayuri-Chan"
version = ".".join(__version__.split(".")[:-1])

View file

@ -18,7 +18,7 @@
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
__fork_name__ = "PyroFork"
__version__ = "2.3.59"
__version__ = "2.3.60"
__license__ = "GNU Lesser General Public License v3.0 (LGPL-3.0)"
__copyright__ = "Copyright (C) 2022-present Mayuri-Chan <https://github.com/Mayuri-Chan>"
@ -37,8 +37,24 @@ class ContinuePropagation(StopAsyncIteration):
pass
from . import raw, types, filters, handlers, emoji, enums
from .client import Client
from .sync import idle, compose
from . import raw, types, filters, handlers, emoji, enums # pylint: disable=wrong-import-position
from .client import Client # pylint: disable=wrong-import-position
from .sync import idle, compose # pylint: disable=wrong-import-position
crypto_executor = ThreadPoolExecutor(1, thread_name_prefix="CryptoWorker")
__all__ = [
"Client",
"idle",
"compose",
"crypto_executor",
"StopTransmission",
"StopPropagation",
"ContinuePropagation",
"raw",
"types",
"filters",
"handlers",
"emoji",
"enums",
]

View file

@ -33,7 +33,7 @@ from importlib import import_module
from io import StringIO, BytesIO
from mimetypes import MimeTypes
from pathlib import Path
from typing import Union, List, Optional, Callable, AsyncGenerator, Type, Tuple
from typing import Union, List, Optional, Callable, AsyncGenerator, Tuple
import pyrogram
from pyrogram import __version__, __license__
@ -51,24 +51,26 @@ from pyrogram.handlers.handler import Handler
from pyrogram.methods import Methods
from pyrogram.session import Auth, Session
from pyrogram.storage import FileStorage, MemoryStorage, Storage
from pyrogram.types import User, TermsOfService
from pyrogram.utils import ainput
from .connection import Connection
from .connection.transport import TCPAbridged
from .dispatcher import Dispatcher
from .file_id import FileId, FileType, ThumbnailSource
from .mime_types import mime_types
from .parser import Parser
from .session.internals import MsgId
log = logging.getLogger(__name__)
MONGO_AVAIL = False
try:
import pymongo
except Exception:
pass
else:
from pyrogram.storage import MongoStorage
from pyrogram.types import User, TermsOfService
from pyrogram.utils import ainput
from .connection import Connection
from .connection.transport import TCP, TCPAbridged
from .dispatcher import Dispatcher
from .file_id import FileId, FileType, ThumbnailSource
from .filters import Filter
from .mime_types import mime_types
from .parser import Parser
from .session.internals import MsgId
log = logging.getLogger(__name__)
MONGO_AVAIL = True
class Client(Methods):
@ -316,9 +318,7 @@ class Client(Methods):
elif self.in_memory:
self.storage = MemoryStorage(self.name)
elif self.mongodb:
try:
import pymongo
except Exception:
if not MONGO_AVAIL:
log.warning(
"pymongo is missing! "
"Using MemoryStorage as session storage"
@ -888,7 +888,7 @@ class Client(Methods):
count = 0
if not include:
for current_root, dirnames, filenames in os.walk(root.replace(".", "/")):
for current_root, _, filenames in os.walk(root.replace(".", "/")):
namespace = current_root.replace("/", ".").replace("\\", ".")
if "__pycache__" in namespace:
continue
@ -953,7 +953,7 @@ class Client(Methods):
)
count += 1
except Exception as e:
except Exception:
pass
else:
for path, handlers in include:
@ -1042,7 +1042,7 @@ class Client(Methods):
)
count += 1
except Exception as e:
except Exception:
pass
if handlers is None:
@ -1106,7 +1106,7 @@ class Client(Methods):
async def handle_download(self, 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
_ = 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"
file = BytesIO() if in_memory else open(temp_file_path, "wb")

View file

@ -18,3 +18,7 @@
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
from .connection import Connection
__all__ = [
"Connection"
]

View file

@ -52,7 +52,7 @@ class Connection:
self.protocol: Optional[TCP] = None
async def connect(self) -> None:
for i in range(Connection.MAX_CONNECTION_ATTEMPTS):
for _ in range(Connection.MAX_CONNECTION_ATTEMPTS):
self.protocol = self.protocol_factory(ipv6=self.ipv6, proxy=self.proxy)
try:

View file

@ -23,3 +23,13 @@ from .tcp_abridged_o import TCPAbridgedO
from .tcp_full import TCPFull
from .tcp_intermediate import TCPIntermediate
from .tcp_intermediate_o import TCPIntermediateO
__all__ = [
"TCP",
"Proxy",
"TCPAbridged",
"TCPAbridgedO",
"TCPFull",
"TCPIntermediate",
"TCPIntermediateO"
]

View file

@ -21,7 +21,6 @@ import asyncio
import ipaddress
import logging
import socket
from concurrent.futures import ThreadPoolExecutor
from typing import Tuple, Dict, TypedDict, Optional
import socks

View file

@ -71,7 +71,7 @@ def unpack(
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("Received empty data. Check your internet connection.")
left = data.read().hex()

View file

@ -55,7 +55,7 @@ def decompose(pq: int) -> int:
while g == 1:
x = y
for i in range(r):
for _ in range(r):
y = (pow(y, 2, pq) + c) % pq
k = 0
@ -63,7 +63,7 @@ def decompose(pq: int) -> int:
while k < r and g == 1:
ys = y
for i in range(min(m, r - k)):
for _ in range(min(m, r - k)):
y = (pow(y, 2, pq) + c) % pq
q = q * (abs(x - y)) % pq

View file

@ -23,7 +23,7 @@ import logging
from collections import OrderedDict
import pyrogram
from pyrogram import errors, raw, types, utils
from pyrogram import raw, types, utils
from pyrogram.handlers.handler import Handler
from pyrogram.handlers import (
BotBusinessConnectHandler,
@ -266,7 +266,7 @@ class Dispatcher:
async def start(self):
if not self.client.no_updates:
for i in range(self.client.workers):
for _ in range(self.client.workers):
self.locks_list.append(asyncio.Lock())
self.handler_worker_tasks.append(

View file

@ -30,6 +30,7 @@ from .gift_attribute_type import GiftAttributeType
from .listerner_types import ListenerTypes
from .message_entity_type import MessageEntityType
from .message_media_type import MessageMediaType
from .message_origin_type import MessageOriginType
from .message_service_type import MessageServiceType
from .messages_filter import MessagesFilter
from .next_code_type import NextCodeType
@ -57,6 +58,7 @@ __all__ = [
'ListenerTypes',
'MessageEntityType',
'MessageMediaType',
'MessageOriginType',
'MessageServiceType',
'MessagesFilter',
'NextCodeType',

View file

@ -35,13 +35,13 @@ class ChatEventAction(AutoName):
"The linked chat has been changed (see ``old_linked_chat`` and ``new_linked_chat``)"
# LOCATION_CHANGED = auto()
""
# ""
PHOTO_CHANGED = auto()
"The chat photo has been changed (see ``old_photo`` and ``new_photo``)"
# STICKER_SET_CHANGED = auto()
""
# ""
TITLE_CHANGED = auto()
"the chat title has been changed (see ``old_title`` and ``new_title``)"
@ -56,7 +56,7 @@ class ChatEventAction(AutoName):
"a message has been deleted (see ``deleted_message``)"
# VOICE_CHAT_DISCARDED = auto()
""
# ""
MESSAGE_EDITED = auto()
"a message has been edited (see ``old_message`` and ``new_message``)"
@ -77,13 +77,13 @@ class ChatEventAction(AutoName):
"a member joined by themselves. (see ``user``)"
# MEMBER_JOINED_BY_LINK = auto()
""
# ""
MEMBER_LEFT = auto()
"a member left by themselves. (see ``user``)"
# MEMBER_MUTED = auto()
""
# ""
ADMINISTRATOR_PRIVILEGES_CHANGED = auto()
"a chat member has been promoted/demoted or their administrator privileges has changed (see ``old_administrator_privileges`` and ``new_administrator_privileges``)"
@ -92,19 +92,19 @@ class ChatEventAction(AutoName):
"a chat member has been restricted/unrestricted or banned/unbanned, or their permissions has changed (see ``old_member_permissions`` and ``new_member_permissions``)"
# MEMBER_UNMUTED = auto()
""
# ""
# MEMBER_VOLUME_CHANGED = auto()
""
# ""
# VIDEO_CHAT_STARTED = auto()
""
# ""
POLL_STOPPED = auto()
"a poll has been stopped (see ``stopped_poll``)"
# VOICE_CHAT_SETTINGS_CHANGED = auto()
""
# ""
INVITES_ENABLED = auto()
"the chat invitation has been enabled or disabled (see ``invites_enabled``)"

View file

@ -0,0 +1,42 @@
# Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-present Dan <https://github.com/delivrance>
# Copyright (C) 2022-present Mayuri-Chan <https://github.com/Mayuri-Chan>
#
# This file is part of Pyrogram.
#
# Pyrogram is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Pyrogram is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
from enum import auto
from .auto_name import AutoName
class MessageOriginType(AutoName):
"""Message origin type enumeration used in :obj:`~pyrogram.types.MessageOrigin`."""
CHANNEL = auto()
"The message was originally a post in a channel"
CHAT = auto()
"The message was originally sent on behalf of a chat"
HIDDEN_USER = auto()
"The message was originally sent by a user, which is hidden by their privacy settings"
IMPORT = auto()
"The message was imported from a foreign chat service"
USER = auto()
"The message was originally sent by a known user"

View file

@ -65,3 +65,11 @@ class CDNFileHashMismatch(SecurityError):
def __init__(self, msg: str = None):
super().__init__("A CDN file hash mismatch has occurred." if msg is None else msg)
__all__ = [
"BadMsgNotification",
"SecurityError",
"SecurityCheckMismatch",
"CDNFileHashMismatch",
"UnknownError"
]

View file

@ -33,7 +33,6 @@ from .error_handler import ErrorHandler
from .inline_query_handler import InlineQueryHandler
from .message_handler import MessageHandler
from .poll_handler import PollHandler
from .pre_checkout_query_handler import PreCheckoutQueryHandler
from .purchased_paid_media_handler import PurchasedPaidMediaHandler
from .raw_update_handler import RawUpdateHandler
from .user_status_handler import UserStatusHandler
@ -42,3 +41,31 @@ from .message_reaction_updated_handler import MessageReactionUpdatedHandler
from .message_reaction_count_updated_handler import MessageReactionCountUpdatedHandler
from .pre_checkout_query_handler import PreCheckoutQueryHandler
from .shipping_query_handler import ShippingQueryHandler
__all__ = [
"BotBusinessConnectHandler",
"BotBusinessMessageHandler",
"CallbackQueryHandler",
"ChatJoinRequestHandler",
"ChatMemberUpdatedHandler",
"ConversationHandler",
"ChosenInlineResultHandler",
"DeletedMessagesHandler",
"DeletedBotBusinessMessagesHandler",
"DisconnectHandler",
"EditedMessageHandler",
"EditedBotBusinessMessageHandler",
"ErrorHandler",
"InlineQueryHandler",
"MessageHandler",
"PollHandler",
"PreCheckoutQueryHandler",
"PurchasedPaidMediaHandler",
"RawUpdateHandler",
"UserStatusHandler",
"StoryHandler",
"MessageReactionUpdatedHandler",
"MessageReactionCountUpdatedHandler",
"PreCheckoutQueryHandler",
"ShippingQueryHandler",
]

View file

@ -61,6 +61,7 @@ class ConversationHandler(MessageHandler, CallbackQueryHandler):
return True
@staticmethod
# pylint: disable=method-hidden
async def callback(_, __):
pass

View file

@ -58,5 +58,4 @@ class DeletedBotBusinessMessagesHandler(Handler):
for message in messages:
if await super().check(client, message):
return True
else:
return False
return False

View file

@ -58,5 +58,4 @@ class DeletedMessagesHandler(Handler):
for message in messages:
if await super().check(client, message):
return True
else:
return False
return False

View file

@ -14,3 +14,14 @@ You should have received a copy of the GNU General Public License
along with pyromod. If not, see <https://www.gnu.org/licenses/>.
"""
from .helpers import ikb, bki, ntb, btn, kb, kbtn, array_chunk, force_reply
__all__ = [
"ikb",
"bki",
"ntb",
"btn",
"kb",
"kbtn",
"array_chunk",
"force_reply"
]

View file

@ -101,9 +101,9 @@ def kb(rows=None, **kwargs):
line = []
for button in row:
button_type = type(button)
if button_type == str:
if isinstance(button_type, str):
button = KeyboardButton(button)
elif button_type == dict:
elif isinstance(button_type, dict):
button = KeyboardButton(**button)
line.append(button)

View file

@ -23,7 +23,6 @@ import inspect
import io
import logging
import math
import os
from hashlib import md5
from pathlib import PurePath
from typing import Union, BinaryIO, Callable

View file

@ -35,6 +35,7 @@ class Connect:
Raises:
ConnectionError: In case you try to connect an already connected client.
"""
# pylint: disable=access-member-before-definition
if self.is_connected:
raise ConnectionError("Client is already connected")

View file

@ -30,6 +30,7 @@ class Disconnect:
ConnectionError: In case you try to disconnect an already disconnected client or in case you try to
disconnect a client that needs to be terminated first.
"""
# pylint: disable=access-member-before-definition
if not self.is_connected:
raise ConnectionError("Client is already disconnected")

View file

@ -16,8 +16,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
from typing import List
import pyrogram
from pyrogram import raw, types

View file

@ -41,6 +41,7 @@ class Initialize:
if not self.is_connected:
raise ConnectionError("Can't initialize a disconnected client")
# pylint: disable=access-member-before-definition
if self.is_initialized:
raise ConnectionError("Client is already initialized")

View file

@ -61,6 +61,7 @@ class SendCode:
)
)
except (PhoneMigrate, NetworkMigrate) as e:
# pylint: disable=access-member-before-definition
await self.session.stop()
await self.storage.dc_id(e.value)

View file

@ -58,6 +58,7 @@ class SignInBot:
)
)
except UserMigrate as e:
# pylint: disable=access-member-before-definition
await self.session.stop()
await self.storage.dc_id(e.value)

View file

@ -37,6 +37,7 @@ class Terminate:
Raises:
ConnectionError: In case you try to terminate a client that is already terminated.
"""
# pylint: disable=access-member-before-definition
if not self.is_initialized:
raise ConnectionError("Client is already terminated")

View file

@ -16,11 +16,8 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
from datetime import datetime
from typing import Union, List
import pyrogram
from pyrogram import types, utils, raw
from pyrogram import types, raw
class GetBusinessConnection:

View file

@ -117,5 +117,4 @@ class BanChatMember:
{i.id: i for i in r.users},
{i.id: i for i in r.chats}
)
else:
return True
return True

View file

@ -15,9 +15,9 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
import pyrogram
from pyrogram import raw
from pyrogram import types
from typing import Union

View file

@ -15,9 +15,9 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
import pyrogram
from pyrogram import raw
from pyrogram import types
from typing import Union

View file

@ -15,9 +15,9 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
import pyrogram
from pyrogram import raw
from pyrogram import types
from typing import Union

View file

@ -15,9 +15,9 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
import pyrogram
from pyrogram import raw
from pyrogram import types
from typing import Union

View file

@ -15,9 +15,9 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
import pyrogram
from pyrogram import raw
from pyrogram import types
from typing import Union

View file

@ -77,8 +77,7 @@ class GetChatMember:
else:
if member.user.id == user.user_id:
return member
else:
raise UserNotParticipant
raise UserNotParticipant
elif isinstance(chat, raw.types.InputPeerChannel):
r = await self.invoke(
raw.functions.channels.GetParticipant(

View file

@ -23,7 +23,6 @@ from typing import Union, Optional, AsyncGenerator
import pyrogram
from pyrogram import raw
from pyrogram import types
from pyrogram import utils
log = logging.getLogger(__name__)

View file

@ -23,7 +23,6 @@ from typing import Union, List, Iterable
import pyrogram
from pyrogram import raw
from pyrogram import types
from pyrogram import utils
log = logging.getLogger(__name__)
@ -63,7 +62,7 @@ class GetForumTopicsByID:
Raises:
ValueError: In case of invalid arguments.
"""
ids, ids_type = (
ids, _ = (
(topic_ids, int) if topic_ids
else (None, None)
)

View file

@ -17,7 +17,6 @@
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
import pyrogram
from pyrogram import raw
from pyrogram import types
from typing import Union

View file

@ -15,9 +15,9 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
import pyrogram
from pyrogram import raw
from pyrogram import types
from typing import Union

View file

@ -15,9 +15,9 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
import pyrogram
from pyrogram import raw
from pyrogram import types
from typing import Union

View file

@ -164,5 +164,4 @@ class SetChatPhoto:
{i.id: i for i in r.users},
{i.id: i for i in r.chats}
)
else:
return True
return True

View file

@ -15,9 +15,9 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
import pyrogram
from pyrogram import raw
from pyrogram import types
from typing import Union

View file

@ -16,7 +16,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
from typing import Callable, Optional, Union
from typing import Callable
import pyrogram
from pyrogram.filters import Filter

View file

@ -180,8 +180,12 @@ class CopyMediaGroup:
**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 "")
message.caption if (
message.caption
and message.caption != "None"
and not isinstance(captions, str)
) else ""
)
)
)

View file

@ -104,7 +104,7 @@ class GetMessages:
is_iterable = not isinstance(ids, int)
ids = list(ids) if is_iterable else [ids]
ids = [ids_type(id=i) for i in ids]
ids = [ids_type(id=i) for i in ids] # pylint: disable=not-callable
if replies < 0:
replies = (1 << 31) - 1

View file

@ -109,9 +109,11 @@ class SendReaction:
add_to_recent=add_to_recent
)
)
users = {i.id: i for i in r.users}
chats = {i.id: i for i in r.chats}
for i in r.updates:
if isinstance(i, raw.types.UpdateMessageReactions):
return types.MessageReactions._parse(self, i.reactions)
return types.MessageReactions._parse(self, i.reactions, users, chats)
elif story_id is not None:
await self.invoke(
raw.functions.stories.SendReaction(

View file

@ -16,7 +16,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
import re
from datetime import datetime
from typing import Union, List, Optional
@ -28,7 +27,7 @@ class SendWebPage:
async def send_web_page(
self: "pyrogram.Client",
chat_id: Union[int, str],
url: str,
url: str = None,
text: str = "",
parse_mode: Optional["enums.ParseMode"] = None,
entities: List["types.MessageEntity"] = None,
@ -53,7 +52,7 @@ class SendWebPage:
"types.ForceReply"
] = None
) -> "types.Message":
"""Send text Web Page Preview.
"""Send Web Page Preview.
.. include:: /_includes/usable-by/users-bots.rst
@ -64,12 +63,13 @@ class SendWebPage:
For a contact that exists in your Telegram address book you can use his phone number (str).
You can also use chat public link in form of *t.me/<username>* (str).
url (``str``):
Link that will be previewed.
text (``str``, *optional*):
Text of the message to be sent.
url (``str``, *optional*):
Link that will be previewed.
If url not specified, the first URL found in the text will be used.
parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
By default, texts are parsed using both Markdown and HTML styles.
You can combine both syntaxes together.
@ -131,7 +131,7 @@ class SendWebPage:
instructions to remove reply keyboard or to force a reply from the user.
Returns:
:obj:`~pyrogram.types.Message`: On success, the sent text message is returned.
:obj:`~pyrogram.types.Message`: On success, the sent message is returned.
Example:
.. code-block:: python
@ -141,6 +141,18 @@ class SendWebPage:
"""
message, entities = (await utils.parse_text_entities(self, text, parse_mode, entities)).values()
if not url:
if entities:
for entity in entities:
if isinstance(entity, enums.MessageEntityType.URL):
url = entity.url
break
if not url:
url = utils.get_first_url(message)
if not url:
raise ValueError("URL not specified")
reply_to = await utils.get_reply_to(
client=self,

View file

@ -17,9 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
from typing import Union
import pyrogram
from pyrogram import raw

View file

@ -68,7 +68,8 @@ class SendPaidReaction:
)
)
users = {i.id: i for i in r.users}
chats = {i.id: i for i in r.chats}
for i in r.updates:
if isinstance(i, raw.types.UpdateMessageReactions):
return types.MessageReactions._parse(self, i.reactions, users)
return types.MessageReactions._parse(self, i.reactions, users, chats)

View file

@ -17,11 +17,10 @@
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
import logging
from typing import Union, List, Iterable
from typing import Union, Iterable
import pyrogram
from pyrogram import raw
from pyrogram import types
log = logging.getLogger(__name__)

View file

@ -222,14 +222,13 @@ class EditStory:
if caption:
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_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))

View file

@ -213,14 +213,13 @@ class SendStory:
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_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))

View file

@ -18,3 +18,7 @@
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
from .pagination import Pagination
__all__ = [
"Pagination"
]

View file

@ -18,3 +18,7 @@
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
from .parser import Parser
__all__ = [
"Parser"
]

View file

@ -18,7 +18,6 @@
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
import html
import logging
import re
from typing import Optional
@ -251,7 +250,7 @@ class Markdown:
# Handle multiline blockquotes
text_subset = text[s:e]
lines = text_subset.splitlines()
for line_num, line in enumerate(lines):
for line_num, _ in enumerate(lines):
line_start = s + sum(len(l) + 1 for l in lines[:line_num])
if entity.collapsed:
insert_at.append((line_start, i, BLOCKQUOTE_EXPANDABLE_DELIM))

View file

@ -25,3 +25,11 @@ from .all import objects
for k, v in objects.items():
path, name = v.rsplit(".", 1)
objects[k] = getattr(import_module(path), name)
__all__ = [
"types",
"functions",
"base",
"core",
"objects"
]

View file

@ -30,3 +30,24 @@ from .primitives.int import Int, Long, Int128, Int256
from .primitives.string import String
from .primitives.vector import Vector
from .tl_object import TLObject
__all__ = [
"FutureSalt",
"FutureSalts",
"GzipPacked",
"List",
"Message",
"MsgContainer",
"Bool",
"BoolFalse",
"BoolTrue",
"Bytes",
"Double",
"Int",
"Long",
"Int128",
"Int256",
"String",
"Vector",
"TLObject"
]

View file

@ -23,3 +23,17 @@ from .double import Double
from .int import Int, Long, Int128, Int256
from .string import String
from .vector import Vector
__all__ = [
"Bool",
"BoolFalse",
"BoolTrue",
"Bytes",
"Double",
"Int",
"Long",
"Int128",
"Int256",
"String",
"Vector"
]

View file

@ -19,3 +19,8 @@
from .auth import Auth
from .session import Session
__all__ = [
"Auth",
"Session"
]

View file

@ -20,3 +20,9 @@
from .data_center import DataCenter
from .msg_factory import MsgFactory
from .msg_id import MsgId
__all__ = [
"DataCenter",
"MsgFactory",
"MsgId"
]

View file

@ -19,10 +19,20 @@
from .file_storage import FileStorage
from .memory_storage import MemoryStorage
MONGO_AVAIL = False
try:
import pymongo
except Exception:
pass
else:
MONGO_AVAIL = True
from .mongo_storage import MongoStorage
from .storage import Storage
__all__ = [
"FileStorage",
"MemoryStorage",
"Storage"
]
if MONGO_AVAIL:
__all__.append("MongoStorage")

View file

@ -30,3 +30,8 @@ from .update import *
from .user_and_chats import *
from .payments import *
from .pyromod import *
__all__ = [
"List",
"Object"
]

View file

@ -18,8 +18,7 @@
from typing import List
import pyrogram
from pyrogram import raw, types, utils
from pyrogram import raw, types
from ..object import Object

View file

@ -20,6 +20,7 @@
import pyrogram
from pyrogram import raw, utils
from pyrogram import types
from typing import Dict
from ..object import Object
@ -52,7 +53,11 @@ class GameHighScore(Object):
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[int, "raw.types.User"]
) -> "GameHighScore":
users = {i.id: i for i in users}
return GameHighScore(
@ -63,7 +68,11 @@ class GameHighScore(Object):
)
@staticmethod
def _parse_action(client, service: raw.types.MessageService, users: dict):
def _parse_action(
client,
service: raw.types.MessageService,
users: Dict[int, "raw.types.User"]
) -> "GameHighScore":
return GameHighScore(
user=types.User._parse(client, users[utils.get_raw_peer_id(service.from_id or service.peer_id)]),
score=service.action.score,

View file

@ -17,7 +17,7 @@
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
from ..object import Object
from pyrogram import enums, raw, types
from pyrogram import raw, types
from typing import Union, List
class RequestedChats(Object):

View file

@ -17,7 +17,7 @@
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
from ..object import Object
from pyrogram import enums, raw, types
from pyrogram import raw, types
from typing import Union
class RequestedUser(Object):

View file

@ -17,14 +17,12 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
from typing import Union, List, Match, Optional
import pyrogram
from pyrogram import raw, enums
from pyrogram import types
from pyrogram import raw, types
from typing import Dict
from ..object import Object
from ..update import Update
from ... import utils
class PreCheckoutQuery(Object, Update):
@ -76,7 +74,11 @@ class PreCheckoutQuery(Object, Update):
self.payment_info = payment_info
@staticmethod
async def _parse(client: "pyrogram.Client", pre_checkout_query, users) -> "PreCheckoutQuery":
async def _parse(
client: "pyrogram.Client",
pre_checkout_query: "raw.types.UpdateBotPrecheckoutQuery",
users: Dict[int, "raw.types.User"] = None
) -> "PreCheckoutQuery":
# Try to decode pre-checkout query payload into string. If that fails, fallback to bytes instead of decoding by
# ignoring/replacing errors, this way, button clicks will still work.
try:
@ -95,14 +97,7 @@ class PreCheckoutQuery(Object, Update):
name=pre_checkout_query.info.name,
phone_number=pre_checkout_query.info.phone,
email=pre_checkout_query.info.email,
shipping_address=types.ShippingAddress(
street_line1=pre_checkout_query.info.shipping_address.street_line1,
street_line2=pre_checkout_query.info.shipping_address.street_line2,
city=pre_checkout_query.info.shipping_address.city,
state=pre_checkout_query.info.shipping_address.state,
post_code=pre_checkout_query.info.shipping_address.post_code,
country_code=pre_checkout_query.info.shipping_address.country_iso2
)
shipping_address=types.ShippingAddress._parse(pre_checkout_query.info.shipping_address)
) if pre_checkout_query.info else None,
client=client
)

View file

@ -17,6 +17,8 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
from pyrogram import raw
from ..object import Object
@ -60,3 +62,17 @@ class ShippingAddress(Object):
self.state = state
self.post_code = post_code
self.country_code = country_code
@staticmethod
def _parse(shipping_address: "raw.types.raw.types.PostAddress") -> "ShippingAddress":
if shipping_address is None:
return None
return ShippingAddress(
street_line1=shipping_address.street_line1,
street_line2=shipping_address.street_line2,
city=shipping_address.city,
state=shipping_address.state,
post_code=shipping_address.post_code,
country_code=shipping_address.country_code
)

View file

@ -1,5 +1,6 @@
# Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-present Dan <https://github.com/delivrance>
# Copyright (C) 2022-present Mayuri-Chan <https://github.com/Mayuri-Chan>
#
# This file is part of Pyrogram.
#
@ -16,9 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
from typing import List
import pyrogram
from pyrogram import raw, types
from ..object import Object

View file

@ -1,5 +1,6 @@
# Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-present Dan <https://github.com/delivrance>
# Copyright (C) 2022-present Mayuri-Chan <https://github.com/Mayuri-Chan>
#
# This file is part of Pyrogram.
#
@ -16,10 +17,9 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
from typing import Union, Optional
import pyrogram
from pyrogram import raw, types
from typing import Dict
from ..object import Object
from ..update import Update
@ -49,21 +49,21 @@ class ShippingQuery(Object, Update):
client: "pyrogram.Client" = None,
id: str,
from_user: "types.User",
invoice_payload: str,
payload: str,
shipping_address: "types.ShippingAddress" = None
):
super().__init__(client)
self.id = id
self.from_user = from_user
self.invoice_payload = invoice_payload
self.payload = payload
self.shipping_address = shipping_address
@staticmethod
async def _parse(
client: "pyrogram.Client",
shipping_query: "raw.types.updateBotShippingQuery",
users: dict
shipping_query: "raw.types.UpdateBotShippingQuery",
users: Dict[int, "raw.types.User"]
) -> "types.PreCheckoutQuery":
# Try to decode pre-checkout query payload into string. If that fails, fallback to bytes instead of decoding by
# ignoring/replacing errors, this way, button clicks will still work.
@ -72,19 +72,12 @@ class ShippingQuery(Object, Update):
except (UnicodeDecodeError, AttributeError):
payload = shipping_query.payload
return types.PreCheckoutQuery(
id=str(shipping_query.query_id),
from_user=types.User._parse(client, users[shipping_query.user_id]),
invoice_payload=payload,
shipping_address=types.ShippingAddress(
country_code=shipping_query.shipping_address.country_iso2,
state=shipping_query.shipping_address.state,
city=shipping_query.shipping_address.city,
street_line1=shipping_query.shipping_address.street_line1,
street_line2=shipping_query.shipping_address.street_line2,
post_code=shipping_query.shipping_address.post_code
),
client=client
return ShippingQuery(
client=client,
id=shipping_query.query_id,
from_user=types.User._parse(client, users.get(shipping_query.user_id)),
payload=payload,
shipping_address=types.ShippingAddress._parse(shipping_query.shipping_address)
)
async def answer(

View file

@ -17,7 +17,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
from typing import List, Match
from typing import List, Match, Dict
import pyrogram
from pyrogram import raw
@ -78,7 +78,11 @@ class InlineQuery(Object, Update):
self.matches = matches
@staticmethod
def _parse(client, inline_query: raw.types.UpdateBotInlineQuery, users: dict) -> "InlineQuery":
def _parse(
client,
inline_query: raw.types.UpdateBotInlineQuery,
users: Dict[int, "raw.types.User"]
) -> "InlineQuery":
peer_type = inline_query.peer_type
chat_type = None

View file

@ -27,6 +27,7 @@ from .contact import Contact
from .contact_registered import ContactRegistered
from .dice import Dice
from .document import Document
from .external_reply_info import ExternalReplyInfo
from .game import Game
from .giveaway import Giveaway
from .giveaway_launched import GiveawayLaunched
@ -37,6 +38,12 @@ from .media_area_channel_post import MediaAreaChannelPost
from .media_area_coordinates import MediaAreaCoordinates
from .message import Message
from .message_entity import MessageEntity
from .message_origin import MessageOrigin
from .message_origin_channel import MessageOriginChannel
from .message_origin_chat import MessageOriginChat
from .message_origin_hidden_user import MessageOriginHiddenUser
from .message_origin_import import MessageOriginImport
from .message_origin_user import MessageOriginUser
from .photo import Photo
from .poll import Poll
from .poll_option import PollOption
@ -71,6 +78,7 @@ from .wallpaper import Wallpaper
from .wallpaper_settings import WallpaperSettings
from .transcribed_audio import TranscribedAudio
from .translated_text import TranslatedText
from .text_quote import TextQuote
__all__ = [
"AlternativeVideo",
@ -82,6 +90,7 @@ __all__ = [
"Contact",
"ContactRegistered",
"Document",
"ExternalReplyInfo",
"Game",
"Giveaway",
"GiveawayLaunched",
@ -92,6 +101,12 @@ __all__ = [
"MediaAreaCoordinates",
"Message",
"MessageEntity",
"MessageOrigin",
"MessageOriginChannel",
"MessageOriginChat",
"MessageOriginHiddenUser",
"MessageOriginImport",
"MessageOriginUser",
"Photo",
"Thumbnail",
"StrippedThumbnail",
@ -126,5 +141,6 @@ __all__ = [
"Wallpaper",
"WallpaperSettings",
"TranscribedAudio",
"TranslatedText"
"TranslatedText",
"TextQuote"
]

View file

@ -22,7 +22,7 @@ from typing import List
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
from ..object import Object

View file

@ -17,7 +17,6 @@
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
from pyrogram import raw
from typing import List
from ..object import Object
class ExportedStoryLink(Object):

View file

@ -0,0 +1,327 @@
# Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-present Dan <https://github.com/delivrance>
# Copyright (C) 2022-present Mayuri-Chan <https://github.com/Mayuri-Chan>
#
# This file is part of Pyrogram.
#
# Pyrogram is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Pyrogram is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
from typing import Dict, Optional
import pyrogram
from pyrogram import enums, raw, types, utils
from ..object import Object
class ExternalReplyInfo(Object):
"""This object contains information about a message that is being replied to, which may come from another chat or forum topic.
Parameters:
origin (:obj:`~pyrogram.types.MessageOrigin`, *optional*):
Origin of the message replied to by the given message.
chat (:obj:`~pyrogram.types.Chat`, *optional*):
Chat the original message belongs to.
Available only if the chat is a supergroup or a channel.
message_id (``int``, *optional*):
Unique message identifier inside the original chat.
Available only if the original chat is a supergroup or a channel.
media (:obj:`~pyrogram.enums.MessageMediaType`, *optional*):
The message is a media message.
This field will contain the enumeration type of the media message.
You can use ``media = getattr(message, message.media.value)`` to access the media message.
animation (:obj:`~pyrogram.types.Animation`, *optional*):
Message is an animation, information about the animation.
audio (:obj:`~pyrogram.types.Audio`, *optional*):
Message is an audio file, information about the file.
document (:obj:`~pyrogram.types.Document`, *optional*):
Message is a general file, information about the file.
paid_media (:obj:`~pyrogram.types.PaidMediaInfo`, *optional*):
Message contains paid media; information about the paid media.
photo (:obj:`~pyrogram.types.Photo`, *optional*):
Message is a photo, information about the photo.
sticker (:obj:`~pyrogram.types.Sticker`, *optional*):
Message is a sticker, information about the sticker.
story (:obj:`~pyrogram.types.Story`, *optional*):
Message is a forwarded story.
video (:obj:`~pyrogram.types.Video`, *optional*):
Message is a video, information about the video.
video_note (:obj:`~pyrogram.types.VideoNote`, *optional*):
Message is a video note, information about the video message.
voice (:obj:`~pyrogram.types.Voice`, *optional*):
Message is a voice message, information about the file.
has_media_spoiler (``bool``, *optional*):
True, if the message media is covered by a spoiler animation.
contact (:obj:`~pyrogram.types.Contact`, *optional*):
Message is a shared contact, information about the contact.
dice (:obj:`~pyrogram.types.Dice`, *optional*):
A dice containing a value that is randomly generated by Telegram.
game (:obj:`~pyrogram.types.Game`, *optional*):
Message is a game, information about the game.
giveaway (:obj:`~pyrogram.types.Giveaway`, *optional*):
Message is a scheduled giveaway, information about the giveaway.
giveaway_result (:obj:`~pyrogram.types.GiveawayResult`, *optional*):
Message is a giveaway result, information about the giveaway result.
invoice (:obj:`~pyrogram.types.Invoice`, *optional*):
Message is a invoice, information about the invoice.
`More about payments » <https://core.telegram.org/bots/api#payments>`_
location (:obj:`~pyrogram.types.Location`, *optional*):
Message is a shared location, information about the location.
poll (:obj:`~pyrogram.types.Poll`, *optional*):
Message is a native poll, information about the poll.
venue (:obj:`~pyrogram.types.Venue`, *optional*):
Message is a venue, information about the venue.
"""
def __init__(
self,
*,
client: "pyrogram.Client" = None,
origin: "types.MessageOrigin" = None,
chat: "types.Chat" = None,
message_id: int,
media: Optional["enums.MessageMediaType"] = None,
animation: Optional["types.Animation"] = None,
audio: Optional["types.Audio"] = None,
document: Optional["types.Document"] = None,
paid_media: Optional["types.PaidMediaInfo"] = None,
photo: Optional["types.Photo"] = None,
sticker: Optional["types.Sticker"] = None,
story: Optional["types.Story"] = None,
video: Optional["types.Video"] = None,
video_note: Optional["types.VideoNote"] = None,
voice: Optional["types.Voice"] = None,
has_media_spoiler: Optional[bool] = None,
contact: Optional["types.Contact"] = None,
dice: Optional["types.Dice"] = None,
game: Optional["types.Game"] = None,
giveaway: Optional["types.Giveaway"] = None,
giveaway_result: Optional["types.GiveawayResult"] = None,
invoice: Optional["types.Invoice"] = None,
location: Optional["types.Location"] = None,
poll: Optional["types.Poll"] = None,
venue: Optional["types.Venue"] = None,
):
super().__init__(client)
self.origin = origin
self.chat = chat
self.message_id = message_id
self.media = media
self.animation = animation
self.audio = audio
self.document = document
self.paid_media = paid_media
self.photo = photo
self.sticker = sticker
self.story = story
self.video = video
self.video_note = video_note
self.voice = voice
self.has_media_spoiler = has_media_spoiler
self.contact = contact
self.dice = dice
self.game = game
self.giveaway = giveaway
self.giveaway_result = giveaway_result
self.invoice = invoice
self.location = location
self.poll = poll
self.venue = venue
@staticmethod
async def _parse(
client,
reply: "raw.types.MessageReplyHeader",
users: Dict[int, "raw.types.User"],
chats: Dict[int, "raw.types.Chat"],
) -> Optional["ExternalReplyInfo"]:
if not isinstance(reply, raw.types.MessageReplyHeader):
return None
if not reply.reply_from:
return None
animation = None
audio = None
document = None
paid_media = None
photo = None
sticker = None
story = None
video = None
video_note = None
voice = None
contact = None
dice = None
game = None
giveaway = None
giveaway_result = None
invoice = None
location = None
poll = None
venue = None
media = reply.reply_media
media_type = None
has_media_spoiler = None
if media:
if isinstance(media, raw.types.MessageMediaPhoto):
photo = types.Photo._parse(client, media.photo, media.ttl_seconds)
media_type = enums.MessageMediaType.PHOTO
has_media_spoiler = media.spoiler
elif isinstance(media, raw.types.MessageMediaGeo):
location = types.Location._parse(client, media.geo)
media_type = enums.MessageMediaType.LOCATION
elif isinstance(media, raw.types.MessageMediaContact):
contact = types.Contact._parse(client, media)
media_type = enums.MessageMediaType.CONTACT
elif isinstance(media, raw.types.MessageMediaVenue):
venue = types.Venue._parse(client, media)
media_type = enums.MessageMediaType.VENUE
elif isinstance(media, raw.types.MessageMediaGame):
game = types.Game._parse(client, media)
media_type = enums.MessageMediaType.GAME
elif isinstance(media, raw.types.MessageMediaGiveaway):
giveaway = types.Giveaway._parse(client, reply, chats)
media_type = enums.MessageMediaType.GIVEAWAY
elif isinstance(media, raw.types.MessageMediaGiveawayResults):
giveaway_result = await types.GiveawayResult._parse(client, media, users, chats)
media_type = enums.MessageMediaType.GIVEAWAY_RESULT
elif isinstance(media, raw.types.MessageMediaInvoice):
invoice = types.Invoice._parse(media)
media_type = enums.MessageMediaType.INVOICE
elif isinstance(media, raw.types.MessageMediaStory):
story = await types.Story._parse(client, media, media.peer)
media_type = enums.MessageMediaType.STORY
elif isinstance(media, raw.types.MessageMediaDocument):
doc = media.document
if isinstance(doc, raw.types.Document):
attributes = {type(i): i for i in doc.attributes}
file_name = getattr(
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)
media_type = enums.MessageMediaType.ANIMATION
has_media_spoiler = media.spoiler
elif raw.types.DocumentAttributeSticker in 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]
if video_attributes.round_message:
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,
media.video_cover,
media.video_timestamp
)
media_type = enums.MessageMediaType.VIDEO
has_media_spoiler = media.spoiler
elif raw.types.DocumentAttributeAudio in attributes:
audio_attributes = attributes[raw.types.DocumentAttributeAudio]
if audio_attributes.voice:
voice = types.Voice._parse(client, doc, audio_attributes)
media_type = enums.MessageMediaType.VOICE
else:
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.MessageMediaPoll):
poll = types.Poll._parse(client, media, users)
media_type = enums.MessageMediaType.POLL
elif isinstance(media, raw.types.MessageMediaDice):
dice = types.Dice._parse(client, media)
media_type = enums.MessageMediaType.DICE
elif isinstance(media, raw.types.MessageMediaPaidMedia):
paid_media = types.PaidMedia._parse(client, media)
media_type = enums.MessageMediaType.PAID_MEDIA
else:
media = None
return ExternalReplyInfo(
origin=types.MessageOrigin._parse(
client,
reply.reply_from,
users,
chats,
),
chat=types.Chat._parse_chat(
client,
chats.get(utils.get_raw_peer_id(reply.reply_to_peer_id)),
),
message_id=reply.reply_to_msg_id,
media=media_type,
animation=animation,
audio=audio,
document=document,
paid_media=paid_media,
photo=photo,
sticker=sticker,
story=story,
video=video,
video_note=video_note,
voice=voice,
has_media_spoiler=has_media_spoiler,
contact=contact,
dice=dice,
game=game,
giveaway=giveaway,
giveaway_result=giveaway_result,
invoice=invoice,
location=location,
poll=poll,
venue=venue
)

View file

@ -69,12 +69,11 @@ class Game(Object):
self.animation = animation
@staticmethod
def _parse(client, message: "raw.types.Message") -> "Game":
game: "raw.types.Game" = message.media.game
def _parse(client, media: "raw.types.MessageMediaGame") -> "Game":
animation = None
if game.document:
attributes = {type(i): i for i in game.document.attributes}
if media.game.document:
attributes = {type(i): i for i in media.game.document.attributes}
file_name = getattr(
attributes.get(
@ -84,17 +83,17 @@ class Game(Object):
animation = types.Animation._parse(
client,
game.document,
media.game.document,
attributes.get(raw.types.DocumentAttributeVideo, None),
file_name
)
return Game(
id=game.id,
title=game.title,
short_name=game.short_name,
description=game.description,
photo=types.Photo._parse(client, game.photo),
id=media.game.id,
title=media.game.title,
short_name=media.game.short_name,
description=media.game.description,
photo=types.Photo._parse(client, media.game.photo),
animation=animation,
client=client
)

View file

@ -16,14 +16,12 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
import asyncio
import pyrogram
from datetime import datetime
from pyrogram import raw, types, utils
from pyrogram.errors import FloodWait
from ..object import Object
from typing import List
from typing import List, Dict
class Giveaway(Object):
@ -73,7 +71,6 @@ class Giveaway(Object):
stars: int = None,
additional_price: str = None,
allowed_countries: List[str] = None,
private_channel_ids: List[int] = None,
is_winners_hidden: bool = None
):
super().__init__(client)
@ -86,28 +83,16 @@ class Giveaway(Object):
self.new_subscribers = new_subscribers
self.additional_price = additional_price
self.allowed_countries = allowed_countries
self.private_channel_ids = private_channel_ids
self.is_winners_hidden = is_winners_hidden
@staticmethod
async def _parse(client, message: "raw.types.Message") -> "Giveaway":
async def _parse(
client,
message: "raw.types.Message",
chats: Dict[int, "raw.types.Chat"] = None
) -> "Giveaway":
giveaway: "raw.types.MessageMediaGiveaway" = message.media
chats = []
private_ids = []
for raw_chat_id in giveaway.channels:
chat_id = utils.get_channel_id(raw_chat_id)
try:
chat = await client.invoke(
raw.functions.channels.GetChannels(
id=[await client.resolve_peer(chat_id)]
)
)
except FloodWait as e:
await asyncio.sleep(e.value)
except Exception:
private_ids.append(chat_id)
else:
chats.append(types.Chat._parse_chat(client, chat.chats[0]))
chats = types.List([types.Chat._parse_channel_chat(client, chats.get(i)) for i in giveaway.channels])
return Giveaway(
chats=chats,
@ -118,7 +103,6 @@ class Giveaway(Object):
new_subscribers=giveaway.only_new_subscribers,
additional_price=giveaway.prize_description,
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,
is_winners_hidden=not giveaway.winners_are_visible,
client=client
)

View file

@ -21,7 +21,7 @@ import pyrogram
from datetime import datetime
from pyrogram import raw, types, utils
from ..object import Object
from typing import List, Union
from typing import List, Union, Dict
class GiveawayResult(Object):
@ -104,7 +104,9 @@ class GiveawayResult(Object):
"raw.types.MessageActionGiveawayResults",
"raw.types.MessageMediaGiveawayResults"
],
hide_winners: bool = False
hide_winners: bool = False,
users: Dict[int, "raw.types.User"] = None,
chats: Dict[int, "raw.types.Chat"] = None
) -> "GiveawayResult":
chat = None
giveaway_message = None
@ -112,17 +114,12 @@ class GiveawayResult(Object):
winners = None
if not hide_winners:
chat_id = utils.get_channel_id(giveaway_result.channel_id)
chat = await client.invoke(
raw.functions.channels.GetChannels(
id=[await client.resolve_peer(chat_id)]
)
)
chat = types.Chat._parse_chat(client, chat.chats[0])
chat = types.Chat._parse_channel_chat(client, chats.get(giveaway_result.channel_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:
winners.append(await client.get_users(winner))
winners.append(types.User._parse(client, users.get(winner, None)))
stars = getattr(giveaway_result, "stars", None)

View file

@ -16,7 +16,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
from pyrogram import types, raw
from pyrogram import raw
from ..object import Object

View file

@ -20,7 +20,7 @@
import logging
from datetime import datetime
from functools import partial
from typing import List, Match, Union, BinaryIO, Optional, Callable
from typing import List, Match, Union, BinaryIO, Optional, Callable, Dict
import pyrogram
from pyrogram import enums, raw, types, utils
@ -88,23 +88,8 @@ class Message(Object, Update):
Topic the message belongs to.
only returned using when client.get_messages.
forward_from (:obj:`~pyrogram.types.User`, *optional*):
For forwarded messages, sender of the original message.
forward_sender_name (``str``, *optional*):
For messages forwarded from users who have hidden their accounts, name of the user.
forward_from_chat (:obj:`~pyrogram.types.Chat`, *optional*):
For messages forwarded from channels, information about the original channel. For messages forwarded from anonymous group administrators, information about the original supergroup.
forward_from_message_id (``int``, *optional*):
For messages forwarded from channels, identifier of the original message in the channel.
forward_signature (``str``, *optional*):
For messages forwarded from channels, signature of the post author if present.
forward_date (:py:obj:`~datetime.datetime`, *optional*):
For forwarded messages, date the original message was sent.
forward_origin (:obj:`~pyrogram.types.MessageOrigin`, *optional*):
Information about the original message for forwarded messages.
is_topic_message (``bool``, *optional*):
True, if the message is sent to a forum topic
@ -187,11 +172,8 @@ class Message(Object, Update):
For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear
in the caption.
quote_text (``str``, *optional*):
Quoted reply text.
quote_entities (List of :obj:`~pyrogram.types.MessageEntity`, *optional*):
For quote text, special entities like usernames, URLs, bot commands, etc. that appear in the quote text.
quote (:obj:`~pyrogram.types.TextQuote`, *optional*):
Chosen quote from the replied message.
effect_id (``str``, *optional*):
Unique identifier of the message effect added to the message.
@ -336,6 +318,9 @@ class Message(Object, Update):
Messages sent from yourself to other chats are outgoing (*outgoing* is True).
An exception is made for your own personal chat; messages sent there will be incoming.
external_reply (:obj:`~pyrogram.types.ExternalReplyInfo`, *optional*):
Information about the message that is being replied to, which may come from another chat or forum topic.
matches (List of regex Matches, *optional*):
A list containing all `Match Objects <https://docs.python.org/3/library/re.html#match-objects>`_ that match
the text of this message. Only applicable when using :obj:`Filters.regex <pyrogram.Filters.regex>`.
@ -451,12 +436,7 @@ class Message(Object, Update):
date: datetime = None,
chat: "types.Chat" = None,
topic: "types.ForumTopic" = None,
forward_from: "types.User" = None,
forward_sender_name: str = None,
forward_from_chat: "types.Chat" = None,
forward_from_message_id: int = None,
forward_signature: str = None,
forward_date: datetime = None,
forward_origin: "types.MessageOrigin" = None,
is_topic_message: bool = None,
reply_to_chat_id: int = None,
reply_to_message_id: int = None,
@ -481,8 +461,7 @@ class Message(Object, Update):
text: Str = None,
entities: List["types.MessageEntity"] = None,
caption_entities: List["types.MessageEntity"] = None,
quote_text: str = None,
quote_entities: List["types.MessageEntity"] = None,
quote: "types.TextQuote" = None,
effect_id: str = None,
invert_media: bool = None,
audio: "types.Audio" = None,
@ -531,6 +510,7 @@ class Message(Object, Update):
forwards: int = None,
via_bot: "types.User" = None,
outgoing: bool = None,
external_reply: Optional["types.ExternalReplyInfo"] = None,
matches: List[Match] = None,
command: List[str] = None,
bot_allowed: "types.BotAllowed" = None,
@ -570,13 +550,8 @@ class Message(Object, Update):
self.sender_business_bot = sender_business_bot
self.date = date
self.chat = chat
self.topic = topic
self.forward_from = forward_from
self.forward_sender_name = forward_sender_name
self.forward_from_chat = forward_from_chat
self.forward_from_message_id = forward_from_message_id
self.forward_signature = forward_signature
self.forward_date = forward_date
self.forward_origin = forward_origin
self.external_reply = external_reply
self.is_topic_message = is_topic_message
self.reply_to_chat_id = reply_to_chat_id
self.reply_to_message_id = reply_to_message_id
@ -601,8 +576,7 @@ class Message(Object, Update):
self.text = text
self.entities = entities
self.caption_entities = caption_entities
self.quote_text = quote_text
self.quote_entities = quote_entities
self.quote = quote
self.effect_id = effect_id
self.invert_media = invert_media
self.audio = audio
@ -716,9 +690,9 @@ class Message(Object, Update):
async def _parse(
client: "pyrogram.Client",
message: raw.base.Message,
users: dict,
chats: dict,
topics: dict = None,
users: Dict[int, "raw.types.User"],
chats: Dict[int, "raw.types.Chat"],
topics: Dict[int, "raw.types.ForumTopic"] = None,
is_scheduled: bool = False,
business_connection_id: str = None,
replies: int = 1
@ -878,7 +852,7 @@ class Message(Object, Update):
giveaway_launched = types.GiveawayLaunched._parse(client, action)
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, users, chats)
service_type = enums.MessageServiceType.GIVEAWAY_RESULT
elif isinstance(action, raw.types.MessageActionBoostApply):
boosts_applied = action.boosts
@ -1008,31 +982,18 @@ class Message(Object, Update):
entities = types.List(filter(lambda x: x is not None, entities))
sender_business_bot = None
forward_from = None
forward_sender_name = None
forward_from_chat = None
forward_from_message_id = None
forward_signature = None
forward_date = None
is_topic_message = None
forward_header = message.fwd_from # type: raw.types.MessageFwdHeader
forward_origin = None
if forward_header:
forward_date = utils.timestamp_to_datetime(forward_header.date)
if forward_header.from_id:
raw_peer_id = utils.get_raw_peer_id(forward_header.from_id)
peer_id = utils.get_peer_id(forward_header.from_id)
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_message_id = forward_header.channel_post
forward_signature = forward_header.post_author
elif forward_header.from_name:
forward_sender_name = forward_header.from_name
forward_origin = types.MessageOrigin._parse(
client,
forward_header,
users,
chats,
)
photo = None
paid_media = None
@ -1075,13 +1036,13 @@ class Message(Object, Update):
venue = types.Venue._parse(client, media)
media_type = enums.MessageMediaType.VENUE
elif isinstance(media, raw.types.MessageMediaGame):
game = types.Game._parse(client, message)
game = types.Game._parse(client, media)
media_type = enums.MessageMediaType.GAME
elif isinstance(media, raw.types.MessageMediaGiveaway):
giveaway = await types.Giveaway._parse(client, message)
giveaway = await types.Giveaway._parse(client, message, chats)
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, users=users, chats=chats)
media_type = enums.MessageMediaType.GIVEAWAY_RESULT
elif isinstance(media, raw.types.MessageMediaStory):
story = await types.MessageStory._parse(client, media)
@ -1182,7 +1143,7 @@ class Message(Object, Update):
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
reactions = types.MessageReactions._parse(client, message.reactions, users)
reactions = types.MessageReactions._parse(client, message.reactions, users, chats)
if message.via_business_bot_id:
sender_business_bot = types.User._parse(client, users.get(message.via_business_bot_id, None))
@ -1219,12 +1180,7 @@ class Message(Object, Update):
author_signature=message.post_author,
has_protected_content=message.noforwards,
has_media_spoiler=has_media_spoiler,
forward_from=forward_from,
forward_sender_name=forward_sender_name,
forward_from_chat=forward_from_chat,
forward_from_message_id=forward_from_message_id,
forward_signature=forward_signature,
forward_date=forward_date,
forward_origin=forward_origin,
is_topic_message=is_topic_message,
mentioned=message.mentioned,
scheduled=is_scheduled,
@ -1269,11 +1225,19 @@ class Message(Object, Update):
parsed_message.sender_chat = sender_chat
if message.reply_to:
parsed_message.external_reply = await types.ExternalReplyInfo._parse(
client,
message.reply_to,
users,
chats
)
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))
if message.reply_to.quote:
parsed_message.quote = types.TextQuote._parse(
client,
users,
message.reply_to
)
if message.reply_to.forum_topic:
if message.reply_to.reply_to_top_id:
thread_id = message.reply_to.reply_to_top_id
@ -1309,20 +1273,15 @@ class Message(Object, Update):
if replies:
if parsed_message.reply_to_message_id:
if rtci is not None and parsed_message.chat.id != reply_to_chat_id:
key = (reply_to_chat_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}
try:
key = (parsed_message.chat.id, parsed_message.reply_to_message_id)
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
parsed_message.chat.id,
reply_to_message_ids=message.id,
replies=replies - 1
)
if reply_to_message and not reply_to_message.forum_topic_created:
parsed_message.reply_to_message = reply_to_message
@ -1363,6 +1322,60 @@ class Message(Object, Update):
def content(self) -> str:
return self.text or self.caption or Str("").init([])
# region Deprecated
# TODO: Remove later
@property
def forward_from(self) -> Optional["types.User"]:
log.warning(
"`message.forward_from` is deprecated and will be removed in future updates. Use `message.forward_origin.sender_user` instead."
)
return getattr(self.forward_origin, "sender_user", None)
@property
def forward_sender_name(self) -> Optional[str]:
log.warning(
"`message.forward_sender_name` property is deprecated and will be removed in future updates. Use `message.forward_origin.sender_user_name` instead."
)
return getattr(self.forward_origin, "sender_user_name", None)
@property
def forward_from_chat(self) -> Optional["types.Chat"]:
log.warning(
"`message.forward_from_chat` property is deprecated and will be removed in future updates. Use `message.forward_origin.chat.sender_chat` instead."
)
return getattr(
self.forward_origin,
"chat",
getattr(
self.forward_origin,
"sender_chat",
None
)
)
@property
def forward_from_message_id(self) -> Optional[int]:
log.warning(
"`message.forward_from_message_id` property is deprecated and will be removed in future updates. Use `message.forward_origin.message_id` instead."
)
return getattr(self.forward_origin, "message_id", None)
@property
def forward_signature(self) -> Optional[str]:
log.warning(
"`message.forward_signature` property is deprecated and will be removed in future updates. Use `message.forward_origin.author_signature` instead."
)
return getattr(self.forward_origin, "author_signature", None)
@property
def forward_date(self) -> Optional[datetime]:
log.warning(
"`message.forward_date` property is deprecated and will be removed in future updates. Use `message.forward_origin.date` instead."
)
return getattr(self.forward_origin, "date", None)
# endregion
async def get_media_group(self) -> List["types.Message"]:
"""Bound method *get_media_group* of :obj:`~pyrogram.types.Message`.

View file

@ -17,7 +17,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
from typing import Optional
from typing import Optional, Dict
import pyrogram
from pyrogram import raw, enums
@ -82,7 +82,11 @@ class MessageEntity(Object):
self.collapsed = collapsed
@staticmethod
def _parse(client, entity: "raw.base.MessageEntity", users: dict) -> Optional["MessageEntity"]:
def _parse(
client,
entity: "raw.base.MessageEntity",
users: Dict[int, "raw.types.User"] = None
) -> 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):

View file

@ -0,0 +1,95 @@
# Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-present <https://github.com/TelegramPlayGround>
# Copyright (C) 2022-present Mayuri-Chan <https://github.com/Mayuri-Chan>
#
# This file is part of Pyrogram.
#
# Pyrogram is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Pyrogram is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
from datetime import datetime
from typing import Dict, Optional
import pyrogram
from pyrogram import enums, raw, types, utils
from ..object import Object
class MessageOrigin(Object):
"""This object describes the origin of a message.
It can be one of:
- :obj:`~pyrogram.types.MessageOriginChannel`
- :obj:`~pyrogram.types.MessageOriginChat`
- :obj:`~pyrogram.types.MessageOriginHiddenUser`
- :obj:`~pyrogram.types.MessageOriginImport`
- :obj:`~pyrogram.types.MessageOriginUser`
"""
def __init__(
self,
type: "enums.MessageOriginType",
date: Optional[datetime] = None
):
super().__init__()
self.type = type
self.date = date
@staticmethod
def _parse(
client: "pyrogram.Client",
fwd_from: "raw.types.MessageFwdHeader",
users: Dict[int, "raw.base.User"],
chats: Dict[int, "raw.base.Chat"]
) -> Optional["MessageOrigin"]:
if not fwd_from:
return None
forward_date = utils.timestamp_to_datetime(fwd_from.date)
if fwd_from.from_id:
raw_peer_id = utils.get_raw_peer_id(fwd_from.from_id)
peer_id = utils.get_peer_id(fwd_from.from_id)
peer_type = utils.get_peer_type(peer_id)
if peer_type == "user":
return types.MessageOriginUser(
date=forward_date,
sender_user=types.User._parse(client, users.get(raw_peer_id))
)
else:
if fwd_from.channel_post:
return types.MessageOriginChannel(
date=forward_date,
chat=types.Chat._parse_channel_chat(client, chats.get(raw_peer_id)),
message_id=fwd_from.channel_post,
author_signature=fwd_from.post_author
)
else:
return types.MessageOriginChat(
date=forward_date,
sender_chat=types.Chat._parse_channel_chat(client, chats.get(raw_peer_id)),
author_signature=fwd_from.post_author
)
elif fwd_from.from_name:
return types.MessageOriginHiddenUser(
date=forward_date,
sender_user_name=fwd_from.from_name
)
elif fwd_from.imported:
return types.MessageOriginImport(
date=forward_date,
sender_user_name=fwd_from.post_author
)

View file

@ -0,0 +1,62 @@
# Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-present <https://github.com/TelegramPlayGround>
# Copyright (C) 2022-present Mayuri-Chan <https://github.com/Mayuri-Chan>
#
# This file is part of Pyrogram.
#
# Pyrogram is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Pyrogram is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
from datetime import datetime
from pyrogram import enums, types
from .message_origin import MessageOrigin
class MessageOriginChannel(MessageOrigin):
"""The message was originally sent to a channel chat.
Parameters:
type (:obj:`~pyrogram.enums.MessageOriginType`):
Type of the message origin.
date (:py:obj:`~datetime.datetime`):
Date the message was sent originally.
chat (:obj:`~pyrogram.types.Chat`):
Channel chat to which the message was originally sent.
message_id (``int``):
Unique message identifier inside the chat.
author_signature (``str``, *optional*):
Signature of the original post author.
"""
def __init__(
self,
*,
type: "enums.MessageOriginType" = enums.MessageOriginType.CHANNEL,
date: datetime = None,
chat: "types.Chat" = None,
message_id: int = None,
author_signature: str = None
):
super().__init__(
type=type,
date=date
)
self.chat = chat
self.message_id = message_id
self.author_signature = author_signature

View file

@ -0,0 +1,57 @@
# Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-present <https://github.com/TelegramPlayGround>
# Copyright (C) 2022-present Mayuri-Chan <https://github.com/Mayuri-Chan>
#
# This file is part of Pyrogram.
#
# Pyrogram is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Pyrogram is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
from datetime import datetime
from pyrogram import enums, types
from .message_origin import MessageOrigin
class MessageOriginChat(MessageOrigin):
"""The message was originally sent on behalf of a chat to a group chat.
Parameters:
type (:obj:`~pyrogram.enums.MessageOriginType`):
Type of the message origin.
date (:py:obj:`~datetime.datetime`):
Date the message was sent originally.
sender_chat (:obj:`~pyrogram.types.Chat`):
Chat that sent the message originally.
author_signature (``str``, *optional*):
For messages originally sent by an anonymous chat administrator, original message author signature.
"""
def __init__(
self,
*,
type: "enums.MessageOriginType" = enums.MessageOriginType.CHAT,
date: datetime = None,
sender_chat: "types.Chat" = None,
author_signature: str = None
):
super().__init__(
type=type,
date=date
)
self.sender_chat = sender_chat
self.author_signature = author_signature

View file

@ -0,0 +1,52 @@
# Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-present <https://github.com/TelegramPlayGround>
# Copyright (C) 2022-present Mayuri-Chan <https://github.com/Mayuri-Chan>
#
# This file is part of Pyrogram.
#
# Pyrogram is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Pyrogram is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
from datetime import datetime
from pyrogram import enums
from .message_origin import MessageOrigin
class MessageOriginHiddenUser(MessageOrigin):
"""The message was originally sent by an unknown user.
Parameters:
type (:obj:`~pyrogram.enums.MessageOriginType`):
Type of the message origin.
date (:py:obj:`~datetime.datetime`):
Date the message was sent originally.
sender_user_name (``str``):
Name of the user that sent the message originally.
"""
def __init__(
self,
*,
type: "enums.MessageOriginType" = enums.MessageOriginType.HIDDEN_USER,
date: datetime = None,
sender_user_name: str = None
):
super().__init__(
type=type,
date=date
)
self.sender_user_name = sender_user_name

View file

@ -0,0 +1,51 @@
# Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-present <https://github.com/TelegramPlayGround>
# Copyright (C) 2022-present Mayuri-Chan <https://github.com/Mayuri-Chan>
#
# This file is part of Pyrogram.
#
# Pyrogram is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Pyrogram is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
from datetime import datetime
from pyrogram import enums
from .message_origin import MessageOrigin
class MessageOriginImport(MessageOrigin):
"""Contains information about a message imported from a foreign chat service.
Parameters:
type (:obj:`~pyrogram.enums.MessageOriginType`):
Type of the message origin.
date (:py:obj:`~datetime.datetime`):
Date the message was sent originally.
sender_user_name (``str``):
Name of the original sender.
"""
def __init__(
self,
*,
date: datetime = None,
sender_user_name: str = None
):
super().__init__(
type=enums.MessageOriginType.IMPORT,
date=date
)
self.sender_user_name = sender_user_name

View file

@ -0,0 +1,52 @@
# Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-present <https://github.com/TelegramPlayGround>
# Copyright (C) 2022-present Mayuri-Chan <https://github.com/Mayuri-Chan>
#
# This file is part of Pyrogram.
#
# Pyrogram is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Pyrogram is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
from datetime import datetime
from pyrogram import enums, types
from .message_origin import MessageOrigin
class MessageOriginUser(MessageOrigin):
"""The message was originally sent by a known user.
Parameters:
type (:obj:`~pyrogram.enums.MessageOriginType`):
Type of the message origin.
date (:py:obj:`~datetime.datetime`):
Date the message was sent originally.
sender_user (:obj:`~pyrogram.types.User`):
User that sent the message originally.
"""
def __init__(
self,
*,
type: "enums.MessageOriginType" = enums.MessageOriginType.USER,
date: datetime = None,
sender_user: "types.User" = None
):
super().__init__(
type=type,
date=date
)
self.sender_user = sender_user

View file

@ -51,7 +51,8 @@ class MessageReactions(Object):
def _parse(
client: "pyrogram.Client",
message_reactions: Optional["raw.base.MessageReactions"] = None,
users: Optional[Dict[int, "raw.types.User"]] = None
users: Optional[Dict[int, "raw.types.User"]] = None,
chats: Dict[int, "raw.types.Chat"] = None
) -> Optional["MessageReactions"]:
if not message_reactions:
return None
@ -63,7 +64,7 @@ class MessageReactions(Object):
for reaction in message_reactions.results
],
top_reactors=[
types.MessageReactor._parse(client, reactor, users)
types.MessageReactor._parse(client, reactor, users, chats)
for reactor in message_reactions.top_reactors
]
)

View file

@ -42,6 +42,9 @@ class MessageReactor(Object):
from_user (:obj:`~pyrogram.types.User`, *optional*):
Information about the reactor.
sender_chat (:obj:`~pyrogram.types.Chat`, *optional*):
Information about the sender chat.
"""
def __init__(
self,
@ -51,7 +54,8 @@ class MessageReactor(Object):
is_top: bool = None,
is_my: bool = None,
is_anonymous: bool = None,
from_user: "types.User" = None
from_user: "types.User" = None,
sender_chat: "types.Chat" = None
):
super().__init__(client)
@ -60,20 +64,32 @@ class MessageReactor(Object):
self.is_my = is_my
self.is_anonymous = is_anonymous
self.from_user = from_user
self.sender_chat = sender_chat
@staticmethod
def _parse(
client: "pyrogram.Client",
message_reactor: Optional["raw.base.MessageReactor"] = None,
users: Dict[int, "raw.types.User"] = None
users: Dict[int, "raw.types.User"] = None,
chats: Dict[int, "raw.types.Chat"] = None
) -> Optional["MessageReactor"]:
if not message_reactor:
return None
is_anonymous = message_reactor.anonymous
from_user = None
sender_chat = None
if not is_anonymous:
from_user = types.User._parse(client, users.get(message_reactor.peer_id.user_id))
if isinstance(message_reactor.peer, raw.types.PeerUser):
from_user = types.User._parse(
client,
users.get(message_reactor.peer_id.user_id)
)
elif isinstance(message_reactor.peer, raw.types.PeerChannel):
sender_chat = types.Chat._parse_channel_chat(
client,
chats.get(message_reactor.peer_id.channel_id)
)
return MessageReactor(
client=client,
@ -81,5 +97,6 @@ class MessageReactor(Object):
is_top=message_reactor.top,
is_my=message_reactor.my,
is_anonymous=is_anonymous,
from_user=from_user
from_user=from_user,
sender_chat=sender_chat
)

View file

@ -17,7 +17,7 @@
# along with PyroFork. If not, see <http://www.gnu.org/licenses/>.
import pyrogram
from pyrogram import raw, types, utils
from pyrogram import raw, utils
from datetime import datetime
from ..object import Object

View file

@ -145,7 +145,7 @@ class Sticker(Object):
Sticker.cache[(set_id, set_access_hash)] = name
if len(Sticker.cache) > 250:
for i in range(50):
for _ in range(50):
Sticker.cache.pop(next(iter(Sticker.cache)))
return name

View file

@ -16,11 +16,8 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
from typing import List, Optional, Union
import pyrogram
from pyrogram import raw
from pyrogram.file_id import FileId, FileType, FileUniqueId, FileUniqueType, ThumbnailSource
from ..object import Object

View file

@ -193,6 +193,7 @@ class Story(Object, Update):
animation = None
photo = None
video = None
media_type = None
chat = None
from_user = None
sender_chat = None
@ -268,14 +269,13 @@ class Story(Object, Update):
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 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):

View file

@ -0,0 +1,84 @@
# Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-present Dan <https://github.com/delivrance>
# Copyright (C) 2022-present Mayuri-Chan <https://github.com/Mayuri-Chan>
#
# This file is part of Pyrogram.
#
# Pyrogram is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Pyrogram is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
from typing import Dict, List, Optional
import pyrogram
from pyrogram import raw, types
from ..messages_and_media.message import Str
from ..object import Object
class TextQuote(Object):
"""Describes manually or automatically chosen quote from another message.
Parameters:
text (``str``):
Text of the quoted part of a message that is replied to by the given message.
entities (List of :obj:`~pyrogram.types.MessageEntity`, *optional*):
Special entities that appear in the quote.
Currently, only bold, italic, underline, strikethrough, spoiler, and custom_emoji entities are kept in quotes.
position (``int``):
Approximate quote position in the original message in UTF-16 code units as specified by the sender.
is_manual (``bool``, *optional*):
True, if the quote was chosen manually by the message sender.
Otherwise, the quote was added automatically by the server.
"""
def __init__(
self, *,
text: Optional[str] = None,
entities: Optional[List["types.MessageEntity"]] = None,
position: Optional[int] = None,
is_manual: Optional[bool] = None
):
super().__init__()
self.text = text
self.entities = entities
self.position = position
self.is_manual = is_manual
@staticmethod
def _parse(
client: "pyrogram.Client",
users: Dict[int, "raw.types.User"],
reply_to: "raw.types.MessageReplyHeader"
) -> "TextQuote":
if isinstance(reply_to, raw.types.MessageReplyHeader):
entities = types.List(
filter(
lambda x: x is not None,
[
types.MessageEntity._parse(client, entity, users)
for entity in getattr(reply_to, "quote_entities", [])
]
)
)
return TextQuote(
text=Str(reply_to.quote_text).init(entities) or None,
entities=entities or None,
position=reply_to.quote_offset or 0,
is_manual=reply_to.quote
)

View file

@ -57,7 +57,7 @@ class TranscribedAudio(Object):
self.trial_remains_until_date = trial_remains_until_date
@staticmethod
def _parse(transcribe_result: "raw.types.messages.TranscribedAudio") -> "TranscribeAudio":
def _parse(transcribe_result: "raw.types.messages.TranscribedAudio") -> "TranscribedAudio":
return TranscribedAudio(
transcription_id=transcribe_result.transcription_id,
text=transcribe_result.text,

View file

@ -19,7 +19,6 @@
from typing import List
import pyrogram
from pyrogram import raw, types
from ..object import Object

Some files were not shown because too many files have changed in this diff Show more