mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-08 16:04:51 +00:00
Compare commits
17 commits
59869c7404
...
ee8aa30d6b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ee8aa30d6b | ||
|
|
4f9e68db71 | ||
|
|
cb38d6a02b | ||
|
|
cf6141feb4 | ||
|
|
8acc457458 | ||
|
|
413556a3f2 | ||
|
|
4a109b3dc2 | ||
|
|
46e755f297 | ||
|
|
c8b22bb5e7 | ||
|
|
9b670a78b3 | ||
|
|
621c690e55 | ||
|
|
07bdefb017 | ||
|
|
9d795911b4 | ||
|
|
cb19b742ad | ||
|
|
1ba1a051c4 | ||
|
|
6151813555 | ||
|
|
cc4eb21b84 |
10 changed files with 299 additions and 10 deletions
40
.github/workflows/python-publish.yml
vendored
Normal file
40
.github/workflows/python-publish.yml
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
# This workflow will upload a Python Package using Twine when a release is created
|
||||||
|
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
|
||||||
|
|
||||||
|
# This workflow uses actions that are not certified by GitHub.
|
||||||
|
# They are provided by a third-party and are governed by
|
||||||
|
# separate terms of service, privacy policy, and support
|
||||||
|
# documentation.
|
||||||
|
|
||||||
|
name: Upload Python Package
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
environment: release
|
||||||
|
permissions:
|
||||||
|
id-token: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: '3.10'
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip install -e '.[dev]'
|
||||||
|
- name: Build package
|
||||||
|
run: hatch build
|
||||||
|
- name: Publish package
|
||||||
|
uses: pypa/gh-action-pypi-publish@release/v1
|
||||||
|
|
@ -257,7 +257,7 @@ inputReportReasonFake#f5ddd6e7 = ReportReason;
|
||||||
inputReportReasonIllegalDrugs#a8eb2be = ReportReason;
|
inputReportReasonIllegalDrugs#a8eb2be = ReportReason;
|
||||||
inputReportReasonPersonalDetails#9ec7863d = ReportReason;
|
inputReportReasonPersonalDetails#9ec7863d = ReportReason;
|
||||||
|
|
||||||
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;
|
userFull#29de80be 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 stars_rating:flags2.17?StarsRating = UserFull;
|
||||||
|
|
||||||
contact#145ade0b user_id:long mutual:Bool = Contact;
|
contact#145ade0b user_id:long mutual:Bool = Contact;
|
||||||
|
|
||||||
|
|
@ -1353,7 +1353,7 @@ messages.messageViews#b6c4f543 views:Vector<MessageViews> chats:Vector<Chat> use
|
||||||
|
|
||||||
messages.discussionMessage#a6341782 flags:# messages:Vector<Message> max_id:flags.0?int read_inbox_max_id:flags.1?int read_outbox_max_id:flags.2?int unread_count:int chats:Vector<Chat> users:Vector<User> = messages.DiscussionMessage;
|
messages.discussionMessage#a6341782 flags:# messages:Vector<Message> max_id:flags.0?int read_inbox_max_id:flags.1?int read_outbox_max_id:flags.2?int unread_count:int chats:Vector<Chat> users:Vector<User> = messages.DiscussionMessage;
|
||||||
|
|
||||||
messageReplyHeader#afbc09db flags:# reply_to_scheduled:flags.2?true forum_topic:flags.3?true quote:flags.9?true reply_to_msg_id:flags.4?int reply_to_peer_id:flags.0?Peer reply_from:flags.5?MessageFwdHeader reply_media:flags.8?MessageMedia reply_to_top_id:flags.1?int quote_text:flags.6?string quote_entities:flags.7?Vector<MessageEntity> quote_offset:flags.10?int = MessageReplyHeader;
|
messageReplyHeader#6917560b flags:# reply_to_scheduled:flags.2?true forum_topic:flags.3?true quote:flags.9?true reply_to_msg_id:flags.4?int reply_to_peer_id:flags.0?Peer reply_from:flags.5?MessageFwdHeader reply_media:flags.8?MessageMedia reply_to_top_id:flags.1?int quote_text:flags.6?string quote_entities:flags.7?Vector<MessageEntity> quote_offset:flags.10?int todo_item_id:flags.11?int = MessageReplyHeader;
|
||||||
messageReplyStoryHeader#e5af939 peer:Peer story_id:int = MessageReplyHeader;
|
messageReplyStoryHeader#e5af939 peer:Peer story_id:int = MessageReplyHeader;
|
||||||
|
|
||||||
messageReplies#83d60fc2 flags:# comments:flags.0?true replies:int replies_pts:int recent_repliers:flags.1?Vector<Peer> channel_id:flags.0?long max_id:flags.2?int read_max_id:flags.3?int = MessageReplies;
|
messageReplies#83d60fc2 flags:# comments:flags.0?true replies:int replies_pts:int recent_repliers:flags.1?Vector<Peer> channel_id:flags.0?long max_id:flags.2?int read_max_id:flags.3?int = MessageReplies;
|
||||||
|
|
@ -1658,7 +1658,7 @@ stories.storyViewsList#59d78fc5 flags:# count:int views_count:int forwards_count
|
||||||
|
|
||||||
stories.storyViews#de9eed1d views:Vector<StoryViews> users:Vector<User> = stories.StoryViews;
|
stories.storyViews#de9eed1d views:Vector<StoryViews> users:Vector<User> = stories.StoryViews;
|
||||||
|
|
||||||
inputReplyToMessage#b07038b0 flags:# reply_to_msg_id:int top_msg_id:flags.0?int reply_to_peer_id:flags.1?InputPeer quote_text:flags.2?string quote_entities:flags.3?Vector<MessageEntity> quote_offset:flags.4?int monoforum_peer_id:flags.5?InputPeer = InputReplyTo;
|
inputReplyToMessage#869fbe10 flags:# reply_to_msg_id:int top_msg_id:flags.0?int reply_to_peer_id:flags.1?InputPeer quote_text:flags.2?string quote_entities:flags.3?Vector<MessageEntity> quote_offset:flags.4?int monoforum_peer_id:flags.5?InputPeer todo_item_id:flags.6?int = InputReplyTo;
|
||||||
inputReplyToStory#5881323a peer:InputPeer story_id:int = InputReplyTo;
|
inputReplyToStory#5881323a peer:InputPeer story_id:int = InputReplyTo;
|
||||||
inputReplyToMonoForum#69d66c45 monoforum_peer_id:InputPeer = InputReplyTo;
|
inputReplyToMonoForum#69d66c45 monoforum_peer_id:InputPeer = InputReplyTo;
|
||||||
|
|
||||||
|
|
@ -1899,8 +1899,8 @@ starsGiveawayOption#94ce852a flags:# extended:flags.0?true default:flags.1?true
|
||||||
|
|
||||||
starsGiveawayWinnersOption#54236209 flags:# default:flags.0?true users:int per_user_stars:long = StarsGiveawayWinnersOption;
|
starsGiveawayWinnersOption#54236209 flags:# default:flags.0?true users:int per_user_stars:long = StarsGiveawayWinnersOption;
|
||||||
|
|
||||||
starGift#7f853c12 flags:# limited:flags.0?true sold_out:flags.1?true birthday:flags.2?true id:long sticker:Document stars:long availability_remains:flags.0?int availability_total:flags.0?int availability_resale:flags.4?long convert_stars:long first_sale_date:flags.1?int last_sale_date:flags.1?int upgrade_stars:flags.3?long resell_min_stars:flags.4?long title:flags.5?string released_by:flags.6?Peer = StarGift;
|
starGift#bcff5b flags:# limited:flags.0?true sold_out:flags.1?true birthday:flags.2?true require_premium:flags.7?true limited_per_user:flags.8?true id:long sticker:Document stars:long availability_remains:flags.0?int availability_total:flags.0?int availability_resale:flags.4?long convert_stars:long first_sale_date:flags.1?int last_sale_date:flags.1?int upgrade_stars:flags.3?long resell_min_stars:flags.4?long title:flags.5?string released_by:flags.6?Peer per_user_total:flags.8?int per_user_remains:flags.8?int = StarGift;
|
||||||
starGiftUnique#f63778ae flags:# id:long title:string slug:string num:int owner_id:flags.0?Peer owner_name:flags.1?string owner_address:flags.2?string attributes:Vector<StarGiftAttribute> availability_issued:int availability_total:int gift_address:flags.3?string resell_stars:flags.4?long released_by:flags.5?Peer = StarGift;
|
starGiftUnique#f63778ae flags:# require_premium:flags.6?true id:long title:string slug:string num:int owner_id:flags.0?Peer owner_name:flags.1?string owner_address:flags.2?string attributes:Vector<StarGiftAttribute> availability_issued:int availability_total:int gift_address:flags.3?string resell_stars:flags.4?long released_by:flags.5?Peer = StarGift;
|
||||||
|
|
||||||
payments.starGiftsNotModified#a388a368 = payments.StarGifts;
|
payments.starGiftsNotModified#a388a368 = payments.StarGifts;
|
||||||
payments.starGifts#2ed82995 hash:int gifts:Vector<StarGift> chats:Vector<Chat> users:Vector<User> = payments.StarGifts;
|
payments.starGifts#2ed82995 hash:int gifts:Vector<StarGift> chats:Vector<Chat> users:Vector<User> = payments.StarGifts;
|
||||||
|
|
@ -1949,7 +1949,7 @@ payments.uniqueStarGift#caa2f60b gift:StarGift users:Vector<User> = payments.Uni
|
||||||
|
|
||||||
messages.webPagePreview#b53e8b21 media:MessageMedia users:Vector<User> = messages.WebPagePreview;
|
messages.webPagePreview#b53e8b21 media:MessageMedia users:Vector<User> = messages.WebPagePreview;
|
||||||
|
|
||||||
savedStarGift#dfda0499 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 can_transfer_at:flags.13?int can_resell_at:flags.14?int = SavedStarGift;
|
savedStarGift#1ea646df 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 can_transfer_at:flags.13?int can_resell_at:flags.14?int collection_id:flags.15?Vector<int> = 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;
|
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;
|
||||||
|
|
||||||
|
|
@ -1998,6 +1998,11 @@ todoCompletion#4cc120b7 id:int completed_by:long date:int = TodoCompletion;
|
||||||
|
|
||||||
suggestedPost#e8e37e5 flags:# accepted:flags.1?true rejected:flags.2?true price:flags.3?StarsAmount schedule_date:flags.0?int = SuggestedPost;
|
suggestedPost#e8e37e5 flags:# accepted:flags.1?true rejected:flags.2?true price:flags.3?StarsAmount schedule_date:flags.0?int = SuggestedPost;
|
||||||
|
|
||||||
|
starsRating#1b0e4f07 flags:# level:int current_level_stars:long stars:long next_level_stars:flags.0?long = StarsRating;
|
||||||
|
starGiftCollection#9d6b13b0 flags:# collection_id:int title:string icon:flags.0?Document gifts_count:int hash:long = StarGiftCollection;
|
||||||
|
payments.starGiftCollectionsNotModified#a0ba4f17 = payments.StarGiftCollections;
|
||||||
|
payments.starGiftCollections#8a2932f3 collections:Vector<StarGiftCollection> = payments.StarGiftCollections;
|
||||||
|
|
||||||
---functions---
|
---functions---
|
||||||
|
|
||||||
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
|
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
|
||||||
|
|
@ -2599,7 +2604,7 @@ payments.getStarGiftUpgradePreview#9c9abcb1 gift_id:long = payments.StarGiftUpgr
|
||||||
payments.upgradeStarGift#aed6e4f5 flags:# keep_original_details:flags.0?true stargift:InputSavedStarGift = Updates;
|
payments.upgradeStarGift#aed6e4f5 flags:# keep_original_details:flags.0?true stargift:InputSavedStarGift = Updates;
|
||||||
payments.transferStarGift#7f18176a stargift:InputSavedStarGift to_id:InputPeer = Updates;
|
payments.transferStarGift#7f18176a stargift:InputSavedStarGift to_id:InputPeer = Updates;
|
||||||
payments.getUniqueStarGift#a1974d72 slug:string = payments.UniqueStarGift;
|
payments.getUniqueStarGift#a1974d72 slug:string = payments.UniqueStarGift;
|
||||||
payments.getSavedStarGifts#23830de9 flags:# exclude_unsaved:flags.0?true exclude_saved:flags.1?true exclude_unlimited:flags.2?true exclude_limited:flags.3?true exclude_unique:flags.4?true sort_by_value:flags.5?true peer:InputPeer offset:string limit:int = payments.SavedStarGifts;
|
payments.getSavedStarGifts#a319e569 flags:# exclude_unsaved:flags.0?true exclude_saved:flags.1?true exclude_unlimited:flags.2?true exclude_limited:flags.3?true exclude_unique:flags.4?true sort_by_value:flags.5?true peer:InputPeer collection_id:flags.6?int offset:string limit:int = payments.SavedStarGifts;
|
||||||
payments.getSavedStarGift#b455a106 stargift:Vector<InputSavedStarGift> = payments.SavedStarGifts;
|
payments.getSavedStarGift#b455a106 stargift:Vector<InputSavedStarGift> = payments.SavedStarGifts;
|
||||||
payments.getStarGiftWithdrawalUrl#d06e93a8 stargift:InputSavedStarGift password:InputCheckPasswordSRP = payments.StarGiftWithdrawalUrl;
|
payments.getStarGiftWithdrawalUrl#d06e93a8 stargift:InputSavedStarGift password:InputCheckPasswordSRP = payments.StarGiftWithdrawalUrl;
|
||||||
payments.toggleChatStarGiftNotifications#60eaefa1 flags:# enabled:flags.0?true peer:InputPeer = Bool;
|
payments.toggleChatStarGiftNotifications#60eaefa1 flags:# enabled:flags.0?true peer:InputPeer = Bool;
|
||||||
|
|
@ -2607,7 +2612,12 @@ payments.toggleStarGiftsPinnedToTop#1513e7b0 peer:InputPeer stargift:Vector<Inpu
|
||||||
payments.canPurchaseStore#4fdc5ea7 purpose:InputStorePaymentPurpose = Bool;
|
payments.canPurchaseStore#4fdc5ea7 purpose:InputStorePaymentPurpose = Bool;
|
||||||
payments.getResaleStarGifts#7a5fa236 flags:# sort_by_price:flags.1?true sort_by_num:flags.2?true attributes_hash:flags.0?long gift_id:long attributes:flags.3?Vector<StarGiftAttributeId> offset:string limit:int = payments.ResaleStarGifts;
|
payments.getResaleStarGifts#7a5fa236 flags:# sort_by_price:flags.1?true sort_by_num:flags.2?true attributes_hash:flags.0?long gift_id:long attributes:flags.3?Vector<StarGiftAttributeId> offset:string limit:int = payments.ResaleStarGifts;
|
||||||
payments.updateStarGiftPrice#3baea4e1 stargift:InputSavedStarGift resell_stars:long = Updates;
|
payments.updateStarGiftPrice#3baea4e1 stargift:InputSavedStarGift resell_stars:long = Updates;
|
||||||
|
payments.createStarGiftCollection#1f4a0e87 peer:InputPeer title:string stargift:Vector<InputSavedStarGift> = StarGiftCollection;
|
||||||
|
payments.updateStarGiftCollection#4fddbee7 flags:# peer:InputPeer collection_id:int title:flags.0?string delete_stargift:flags.1?Vector<InputSavedStarGift> add_stargift:flags.2?Vector<InputSavedStarGift> order:flags.3?Vector<InputSavedStarGift> = StarGiftCollection;
|
||||||
|
payments.reorderStarGiftCollections#c32af4cc peer:InputPeer order:Vector<int> = Bool;
|
||||||
|
payments.deleteStarGiftCollection#ad5648e8 peer:InputPeer collection_id:int = Bool;
|
||||||
|
|
||||||
|
payments.getStarGiftCollections#981b91dd peer:InputPeer hash:long = payments.StarGiftCollections;
|
||||||
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.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;
|
stickers.removeStickerFromSet#f7760f51 sticker:InputDocument = messages.StickerSet;
|
||||||
stickers.changeStickerPosition#ffb6d4ca sticker:InputDocument position:int = messages.StickerSet;
|
stickers.changeStickerPosition#ffb6d4ca sticker:InputDocument position:int = messages.StickerSet;
|
||||||
|
|
@ -2729,4 +2739,4 @@ smsjobs.finishJob#4f1ebf24 flags:# job_id:string error:flags.0?string = Bool;
|
||||||
|
|
||||||
fragment.getCollectibleInfo#be1e85ba collectible:InputCollectible = fragment.CollectibleInfo;
|
fragment.getCollectibleInfo#be1e85ba collectible:InputCollectible = fragment.CollectibleInfo;
|
||||||
|
|
||||||
// LAYER 207
|
// LAYER 210
|
||||||
|
|
|
||||||
|
|
@ -225,6 +225,7 @@ def pyrogram_api():
|
||||||
get_discussion_replies_count
|
get_discussion_replies_count
|
||||||
get_custom_emoji_stickers
|
get_custom_emoji_stickers
|
||||||
transcribe_audio
|
transcribe_audio
|
||||||
|
translate_message_text
|
||||||
start_bot
|
start_bot
|
||||||
delete_chat_history
|
delete_chat_history
|
||||||
""",
|
""",
|
||||||
|
|
@ -568,6 +569,7 @@ def pyrogram_api():
|
||||||
WebPageEmpty
|
WebPageEmpty
|
||||||
WebPagePreview
|
WebPagePreview
|
||||||
TranscribedAudio
|
TranscribedAudio
|
||||||
|
TranslatedText
|
||||||
TextQuote
|
TextQuote
|
||||||
Poll
|
Poll
|
||||||
PollOption
|
PollOption
|
||||||
|
|
@ -820,6 +822,7 @@ def pyrogram_api():
|
||||||
Message.get_media_group
|
Message.get_media_group
|
||||||
Message.react
|
Message.react
|
||||||
Message.transcribe
|
Message.transcribe
|
||||||
|
Message.translate
|
||||||
Message.wait_for_click
|
Message.wait_for_click
|
||||||
""",
|
""",
|
||||||
chat="""
|
chat="""
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,20 @@ Using async_pymongo (Recommended for python3.9+):
|
||||||
print(await app.get_me())
|
print(await app.get_me())
|
||||||
|
|
||||||
|
|
||||||
Using motor:
|
Using official mongodb driver:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
from pymongo import AsyncMongoClient
|
||||||
|
from pyrogram import Client
|
||||||
|
|
||||||
|
conn = AsyncMongoClient("mongodb://...")
|
||||||
|
|
||||||
|
async with Client("my_account", mongodb=dict(connection=conn, remove_peers=False)) as app:
|
||||||
|
print(await app.get_me())
|
||||||
|
|
||||||
|
|
||||||
|
Using motor (Deprecated, but still works):
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
|
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
__fork_name__ = "PyroFork"
|
__fork_name__ = "PyroFork"
|
||||||
__version__ = "2.3.67"
|
__version__ = "2.3.68"
|
||||||
__license__ = "GNU Lesser General Public License v3.0 (LGPL-3.0)"
|
__license__ = "GNU Lesser General Public License v3.0 (LGPL-3.0)"
|
||||||
__copyright__ = "Copyright (C) 2022-present Mayuri-Chan <https://github.com/Mayuri-Chan>"
|
__copyright__ = "Copyright (C) 2022-present Mayuri-Chan <https://github.com/Mayuri-Chan>"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,7 @@ from .stop_poll import StopPoll
|
||||||
from .stream_media import StreamMedia
|
from .stream_media import StreamMedia
|
||||||
from .vote_poll import VotePoll
|
from .vote_poll import VotePoll
|
||||||
from .transcribe_audio import TranscribeAudio
|
from .transcribe_audio import TranscribeAudio
|
||||||
|
from .translate_text import TranslateText
|
||||||
|
|
||||||
class Messages(
|
class Messages(
|
||||||
AddTaskToTodo,
|
AddTaskToTodo,
|
||||||
|
|
@ -142,6 +143,7 @@ class Messages(
|
||||||
StreamMedia,
|
StreamMedia,
|
||||||
GetCustomEmojiStickers,
|
GetCustomEmojiStickers,
|
||||||
TranscribeAudio,
|
TranscribeAudio,
|
||||||
|
TranslateText,
|
||||||
StartBot
|
StartBot
|
||||||
):
|
):
|
||||||
pass
|
pass
|
||||||
|
|
|
||||||
121
pyrogram/methods/messages/translate_text.py
Normal file
121
pyrogram/methods/messages/translate_text.py
Normal file
|
|
@ -0,0 +1,121 @@
|
||||||
|
# Pyrofork - 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 Pyrofork.
|
||||||
|
#
|
||||||
|
# Pyrofork 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.
|
||||||
|
#
|
||||||
|
# Pyrofork 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 Pyrofork. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from typing import List, Optional, Union
|
||||||
|
|
||||||
|
import pyrogram
|
||||||
|
from pyrogram import enums, raw, types, utils
|
||||||
|
|
||||||
|
|
||||||
|
class TranslateText:
|
||||||
|
async def translate_message_text(
|
||||||
|
self: "pyrogram.Client",
|
||||||
|
to_language_code: str,
|
||||||
|
chat_id: Optional[Union[int, str]] = None,
|
||||||
|
message_ids: Optional[Union[int, List[int]]] = None,
|
||||||
|
text: Optional[str] = None,
|
||||||
|
parse_mode: Optional["enums.ParseMode"] = None,
|
||||||
|
entities: Optional[List["types.MessageEntity"]] = None
|
||||||
|
) -> Union["types.TranslatedText", List["types.TranslatedText"]]:
|
||||||
|
"""Translates a text or message(s) to the given language. If the current user is a Telegram Premium user, then text formatting is preserved.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
to_language_code (``str``):
|
||||||
|
Language code of the language to which the message/text is translated.
|
||||||
|
Must be one of the supported language codes.
|
||||||
|
|
||||||
|
chat_id (``Optional[int | str]``):
|
||||||
|
Unique identifier (int) or username (str) of the target chat.
|
||||||
|
|
||||||
|
message_ids (``Optional[int | List[int]]``):
|
||||||
|
Identifier or list of message identifiers of the target message(s).
|
||||||
|
|
||||||
|
text (``Optional[str]``):
|
||||||
|
Text to translate.
|
||||||
|
|
||||||
|
parse_mode (:obj:`~pyrogram.enums.ParseMode`, *optional*):
|
||||||
|
By default, texts are parsed using both Markdown and HTML styles.
|
||||||
|
You can combine both syntaxes together.
|
||||||
|
|
||||||
|
entities (List of :obj:`~pyrogram.types.MessageEntity`):
|
||||||
|
List of special entities that appear in message text, which can be specified instead of *parse_mode*.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
# Using chat_id and message_ids
|
||||||
|
await app.translate_message_text("en", chat_id, message_ids)
|
||||||
|
|
||||||
|
# Using text
|
||||||
|
await app.translate_message_text("en", text="Hello, how are you?")
|
||||||
|
|
||||||
|
# Using text with parse_mode
|
||||||
|
await app.translate_message_text("en", text="*Hello*, how are you?", parse_mode=ParseMode.MARKDOWN)
|
||||||
|
|
||||||
|
# Using text with entities
|
||||||
|
entities = [types.MessageEntityBold(offset=0, length=5)]
|
||||||
|
await app.translate_message_text("en", text="*Hello*, how are you?", entities=entities)
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
:obj:`~pyrogram.types.TranslatedText` | List of :obj:`~pyrogram.types.TranslatedText`: In case *message_ids* was not
|
||||||
|
a list, a single result is returned, otherwise a list of results is returned.
|
||||||
|
"""
|
||||||
|
if text is not None:
|
||||||
|
message, entities = (
|
||||||
|
await utils.parse_text_entities(
|
||||||
|
self,
|
||||||
|
text,
|
||||||
|
parse_mode,
|
||||||
|
entities
|
||||||
|
)
|
||||||
|
).values()
|
||||||
|
|
||||||
|
r = await self.invoke(
|
||||||
|
raw.functions.messages.TranslateText(
|
||||||
|
to_lang=to_language_code,
|
||||||
|
text=[
|
||||||
|
raw.types.TextWithEntities(
|
||||||
|
text=message,
|
||||||
|
entities=entities or []
|
||||||
|
)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
elif chat_id is not None and message_ids is not None:
|
||||||
|
ids = [message_ids] if not isinstance(message_ids, list) else message_ids
|
||||||
|
|
||||||
|
r = await self.invoke(
|
||||||
|
raw.functions.messages.TranslateText(
|
||||||
|
to_lang=to_language_code,
|
||||||
|
peer=await self.resolve_peer(chat_id),
|
||||||
|
id=ids
|
||||||
|
)
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
raise ValueError("Either 'text' or both 'chat_id' and 'message_ids' must be provided.")
|
||||||
|
|
||||||
|
return (
|
||||||
|
types.TranslatedText._parse(self, r.result[0])
|
||||||
|
if len(r.result) == 1
|
||||||
|
else [
|
||||||
|
types.TranslatedText._parse(self, i)
|
||||||
|
for i in r.result
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
@ -82,6 +82,7 @@ from .exported_story_link import ExportedStoryLink
|
||||||
from .wallpaper import Wallpaper
|
from .wallpaper import Wallpaper
|
||||||
from .wallpaper_settings import WallpaperSettings
|
from .wallpaper_settings import WallpaperSettings
|
||||||
from .transcribed_audio import TranscribedAudio
|
from .transcribed_audio import TranscribedAudio
|
||||||
|
from .translated_text import TranslatedText
|
||||||
from .text_quote import TextQuote
|
from .text_quote import TextQuote
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
|
|
@ -145,6 +146,7 @@ __all__ = [
|
||||||
"Wallpaper",
|
"Wallpaper",
|
||||||
"WallpaperSettings",
|
"WallpaperSettings",
|
||||||
"TranscribedAudio",
|
"TranscribedAudio",
|
||||||
|
"TranslatedText",
|
||||||
"TextQuote",
|
"TextQuote",
|
||||||
"TodoList",
|
"TodoList",
|
||||||
"TodoTask",
|
"TodoTask",
|
||||||
|
|
|
||||||
|
|
@ -5635,3 +5635,40 @@ class Message(Object, Update):
|
||||||
chat_id=self.chat.id,
|
chat_id=self.chat.id,
|
||||||
message_id=self.id
|
message_id=self.id
|
||||||
)
|
)
|
||||||
|
|
||||||
|
async def translate(
|
||||||
|
self,
|
||||||
|
to_language_code: str
|
||||||
|
) -> "types.TranslatedText":
|
||||||
|
"""Bound method *translate* of :obj:`~pyrogram.types.Message`.
|
||||||
|
|
||||||
|
Use as a shortcut for:
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
await client.translate_message_text(
|
||||||
|
chat_id=message.chat.id,
|
||||||
|
message_ids=message_id,
|
||||||
|
to_language_code="en"
|
||||||
|
)
|
||||||
|
|
||||||
|
Example:
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
await Message.translate("en")
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
to_language_code (``str``):
|
||||||
|
Language code of the language to which the message is translated.
|
||||||
|
Must be one of "af", "sq", "am", "ar", "hy", "az", "eu", "be", "bn", "bs", "bg", "ca", "ceb", "zh-CN", "zh", "zh-Hans", "zh-TW", "zh-Hant", "co", "hr", "cs", "da", "nl", "en", "eo", "et", "fi", "fr", "fy", "gl", "ka", "de", "el", "gu", "ht", "ha", "haw", "he", "iw", "hi", "hmn", "hu", "is", "ig", "id", "in", "ga", "it", "ja", "jv", "kn", "kk", "km", "rw", "ko", "ku", "ky", "lo", "la", "lv", "lt", "lb", "mk", "mg", "ms", "ml", "mt", "mi", "mr", "mn", "my", "ne", "no", "ny", "or", "ps", "fa", "pl", "pt", "pa", "ro", "ru", "sm", "gd", "sr", "st", "sn", "sd", "si", "sk", "sl", "so", "es", "su", "sw", "sv", "tl", "tg", "ta", "tt", "te", "th", "tr", "tk", "uk", "ur", "ug", "uz", "vi", "cy", "xh", "yi", "ji", "yo", "zu".
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
:obj:`~pyrogram.types.TranslatedText`: The translated result is returned.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
RPCError: In case of a Telegram RPC error.
|
||||||
|
"""
|
||||||
|
return await self._client.translate_message_text(
|
||||||
|
chat_id=self.chat.id,
|
||||||
|
message_ids=self.id,
|
||||||
|
to_language_code=to_language_code
|
||||||
|
)
|
||||||
|
|
|
||||||
61
pyrogram/types/messages_and_media/translated_text.py
Normal file
61
pyrogram/types/messages_and_media/translated_text.py
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
# Pyrofork - 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 Pyrofork.
|
||||||
|
#
|
||||||
|
# Pyrofork 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.
|
||||||
|
#
|
||||||
|
# Pyrofork 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 Pyrofork. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from typing import List
|
||||||
|
|
||||||
|
from pyrogram import raw, types
|
||||||
|
|
||||||
|
from ..object import Object
|
||||||
|
from .message import Str
|
||||||
|
|
||||||
|
|
||||||
|
class TranslatedText(Object):
|
||||||
|
"""A translated text with entities.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
text (``str``):
|
||||||
|
Translated text.
|
||||||
|
|
||||||
|
entities (``str``, *optional*):
|
||||||
|
Entities of the text.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
*,
|
||||||
|
text: str,
|
||||||
|
entities: List["types.MessageEntity"] = None
|
||||||
|
):
|
||||||
|
self.text = text
|
||||||
|
self.entities = entities
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _parse(
|
||||||
|
client,
|
||||||
|
translate_result: "raw.types.TextWithEntities"
|
||||||
|
) -> "TranslatedText":
|
||||||
|
entities = [
|
||||||
|
types.MessageEntity._parse(client, entity, {})
|
||||||
|
for entity in translate_result.entities
|
||||||
|
]
|
||||||
|
entities = types.List(filter(lambda x: x is not None, entities))
|
||||||
|
|
||||||
|
return TranslatedText(
|
||||||
|
text=Str(translate_result.text).init(entities) or None, entities=entities or None
|
||||||
|
)
|
||||||
Loading…
Reference in a new issue