diff --git a/compiler/docs/compiler.py b/compiler/docs/compiler.py index 72f821a8..215ec8e6 100644 --- a/compiler/docs/compiler.py +++ b/compiler/docs/compiler.py @@ -168,11 +168,9 @@ def pyrogram_api(): forward_messages copy_message copy_media_group - send_paid_media send_photo send_audio send_document - send_invoice send_sticker send_video send_animation @@ -367,19 +365,21 @@ def pyrogram_api(): set_chat_menu_button get_chat_menu_button answer_web_app_query - answer_pre_checkout_query - answer_shipping_query - refund_star_payment get_bot_info set_bot_info get_collectible_item_info """, business=""" Telegram Business + answer_pre_checkout_query + answer_shipping_query create_invoice_link get_business_connection get_stars_transactions get_stars_transactions_by_id + refund_star_payment + send_invoice + send_paid_media """, authorization=""" Authorization @@ -503,7 +503,6 @@ def pyrogram_api(): Giveaway GiveawayLaunched GiveawayResult - MessageInvoice MessageStory WebPage WebPageEmpty @@ -530,8 +529,6 @@ def pyrogram_api(): ReactionType MessageReactionUpdated MessageReactionCountUpdated - ExtendedMediaPreview - PaidMedia """, stories=""" Stories @@ -557,12 +554,6 @@ def pyrogram_api(): BotAllowed BotApp BotBusinessConnection - PaymentInfo - PaymentRefunded - ShippingAddress - ShippingOption - ShippingQuery - SuccessfulPayment """, bot_keyboards=""" Bot keyboards @@ -602,9 +593,18 @@ def pyrogram_api(): """, business=""" Telegram Business + ExtendedMediaPreview InputStarsTransaction + Invoice + PaidMedia + PaymentInfo + PaymentRefunded + ShippingAddress + ShippingOption + ShippingQuery StarsStatus StarsTransaction + SuccessfulPayment """, input_media=""" Input Media diff --git a/pyrogram/methods/bots/__init__.py b/pyrogram/methods/bots/__init__.py index 69910a74..003bac3e 100644 --- a/pyrogram/methods/bots/__init__.py +++ b/pyrogram/methods/bots/__init__.py @@ -19,7 +19,6 @@ from .answer_callback_query import AnswerCallbackQuery from .answer_inline_query import AnswerInlineQuery -from .answer_pre_checkout_query import AnswerPreCheckoutQuery from .answer_web_app_query import AnswerWebAppQuery from .delete_bot_commands import DeleteBotCommands from .get_bot_commands import GetBotCommands @@ -29,7 +28,6 @@ from .get_chat_menu_button import GetChatMenuButton from .get_collectible_item_info import GetCollectibleItemInfo from .get_game_high_scores import GetGameHighScores from .get_inline_bot_results import GetInlineBotResults -from .refund_stars_payment import RefundStarPayment from .request_callback_answer import RequestCallbackAnswer from .send_game import SendGame from .send_inline_bot_result import SendInlineBotResult @@ -59,8 +57,6 @@ class Bots( SetChatMenuButton, GetChatMenuButton, AnswerWebAppQuery, - AnswerPreCheckoutQuery, - RefundStarPayment, GetCollectibleItemInfo ): pass diff --git a/pyrogram/methods/business/__init__.py b/pyrogram/methods/business/__init__.py index cf0e4dde..1ef2ad91 100644 --- a/pyrogram/methods/business/__init__.py +++ b/pyrogram/methods/business/__init__.py @@ -16,16 +16,24 @@ # You should have received a copy of the GNU Lesser General Public License # along with Pyrogram. If not, see . +from .answer_pre_checkout_query import AnswerPreCheckoutQuery from .create_invoice_link import CreateInvoiceLink from .get_business_connection import GetBusinessConnection from .get_stars_transactions import GetStarsTransactions from .get_stars_transactions_by_id import GetStarsTransactionsById +from .refund_stars_payment import RefundStarPayment +from .send_invoice import SendInvoice +from .send_paid_media import SendPaidMedia class TelegramBusiness( + AnswerPreCheckoutQuery, CreateInvoiceLink, GetBusinessConnection, GetStarsTransactions, - GetStarsTransactionsById + GetStarsTransactionsById, + RefundStarPayment, + SendInvoice, + SendPaidMedia ): pass diff --git a/pyrogram/methods/bots/answer_pre_checkout_query.py b/pyrogram/methods/business/answer_pre_checkout_query.py similarity index 100% rename from pyrogram/methods/bots/answer_pre_checkout_query.py rename to pyrogram/methods/business/answer_pre_checkout_query.py diff --git a/pyrogram/methods/bots/answer_shipping_query.py b/pyrogram/methods/business/answer_shipping_query.py similarity index 100% rename from pyrogram/methods/bots/answer_shipping_query.py rename to pyrogram/methods/business/answer_shipping_query.py diff --git a/pyrogram/methods/bots/refund_stars_payment.py b/pyrogram/methods/business/refund_stars_payment.py similarity index 100% rename from pyrogram/methods/bots/refund_stars_payment.py rename to pyrogram/methods/business/refund_stars_payment.py diff --git a/pyrogram/methods/messages/send_invoice.py b/pyrogram/methods/business/send_invoice.py similarity index 100% rename from pyrogram/methods/messages/send_invoice.py rename to pyrogram/methods/business/send_invoice.py diff --git a/pyrogram/methods/messages/send_paid_media.py b/pyrogram/methods/business/send_paid_media.py similarity index 100% rename from pyrogram/methods/messages/send_paid_media.py rename to pyrogram/methods/business/send_paid_media.py diff --git a/pyrogram/methods/messages/__init__.py b/pyrogram/methods/messages/__init__.py index 0ad012a9..ed2a352a 100644 --- a/pyrogram/methods/messages/__init__.py +++ b/pyrogram/methods/messages/__init__.py @@ -54,11 +54,9 @@ from .send_chat_action import SendChatAction from .send_contact import SendContact from .send_dice import SendDice from .send_document import SendDocument -from .send_invoice import SendInvoice from .send_location import SendLocation from .send_media_group import SendMediaGroup from .send_message import SendMessage -from .send_paid_media import SendPaidMedia from .send_photo import SendPhoto from .send_poll import SendPoll from .send_reaction import SendReaction @@ -88,11 +86,9 @@ class Messages( SendContact, SendDocument, SendAnimation, - SendInvoice, SendLocation, SendMediaGroup, SendMessage, - SendPaidMedia, SendPhoto, SendSticker, SendVenue, diff --git a/pyrogram/types/bots_and_keyboards/__init__.py b/pyrogram/types/bots_and_keyboards/__init__.py index 5286ba28..6b0d720d 100644 --- a/pyrogram/types/bots_and_keyboards/__init__.py +++ b/pyrogram/types/bots_and_keyboards/__init__.py @@ -44,19 +44,12 @@ from .menu_button import MenuButton from .menu_button_commands import MenuButtonCommands from .menu_button_default import MenuButtonDefault from .menu_button_web_app import MenuButtonWebApp -from .payment_info import PaymentInfo -from .payment_refunded import PaymentRefunded -from .pre_checkout_query import PreCheckoutQuery from .reply_keyboard_markup import ReplyKeyboardMarkup from .reply_keyboard_remove import ReplyKeyboardRemove from .request_peer_type_channel import RequestPeerTypeChannel from .request_peer_type_chat import RequestPeerTypeChat from .request_peer_type_user import RequestPeerTypeUser from .sent_web_app_message import SentWebAppMessage -from .shipping_address import ShippingAddress -from .shipping_option import ShippingOption -from .shipping_query import ShippingQuery -from .successful_payment import SuccessfulPayment from .web_app_info import WebAppInfo __all__ = [ @@ -93,12 +86,5 @@ __all__ = [ "MenuButtonCommands", "MenuButtonWebApp", "MenuButtonDefault", - "SentWebAppMessage", - "ShippingAddress", - "ShippingOption", - "ShippingQuery", - "PaymentInfo", - "PaymentRefunded", - "PreCheckoutQuery", - "SuccessfulPayment" + "SentWebAppMessage" ] diff --git a/pyrogram/types/business/__init__.py b/pyrogram/types/business/__init__.py index 6c2d5df5..e50bebee 100644 --- a/pyrogram/types/business/__init__.py +++ b/pyrogram/types/business/__init__.py @@ -16,12 +16,32 @@ # You should have received a copy of the GNU Lesser General Public License # along with Pyrofork. If not, see . +from .extended_media_preview import ExtendedMediaPreview from .input_stars_transaction import InputStarsTransaction +from .invoice import Invoice +from .paid_media import PaidMedia +from .payment_info import PaymentInfo +from .payment_refunded import PaymentRefunded +from .pre_checkout_query import PreCheckoutQuery +from .shipping_address import ShippingAddress +from .shipping_option import ShippingOption +from .shipping_query import ShippingQuery from .stars_status import StarsStatus from .stars_transaction import StarsTransaction +from .successful_payment import SuccessfulPayment __all__ = [ + "ExtendedMediaPreview", + "Invoice", "InputStarsTransaction", + "PaidMedia", + "PaymentInfo", + "PaymentRefunded", + "PreCheckoutQuery", "StarsStatus", - "StarsTransaction" + "StarsTransaction", + "ShippingAddress", + "ShippingOption", + "ShippingQuery", + "SuccessfulPayment" ] diff --git a/pyrogram/types/messages_and_media/extended_media_preview.py b/pyrogram/types/business/extended_media_preview.py similarity index 100% rename from pyrogram/types/messages_and_media/extended_media_preview.py rename to pyrogram/types/business/extended_media_preview.py diff --git a/pyrogram/types/messages_and_media/message_invoice.py b/pyrogram/types/business/invoice.py similarity index 97% rename from pyrogram/types/messages_and_media/message_invoice.py rename to pyrogram/types/business/invoice.py index 847e2f80..4b4e7038 100644 --- a/pyrogram/types/messages_and_media/message_invoice.py +++ b/pyrogram/types/business/invoice.py @@ -22,7 +22,7 @@ from pyrogram import raw, types, utils from ..object import Object -class MessageInvoice(Object): +class Invoice(Object): """Contains information about an Invoice. Parameters: @@ -78,8 +78,8 @@ class MessageInvoice(Object): @staticmethod def _parse( message_invoice: "raw.types.MessageMediaInvoice" - ) -> "MessageInvoice": - return MessageInvoice( + ) -> "Invoice": + return Invoice( title=message_invoice.title, description=message_invoice.description, currency=message_invoice.currency, diff --git a/pyrogram/types/messages_and_media/paid_media.py b/pyrogram/types/business/paid_media.py similarity index 100% rename from pyrogram/types/messages_and_media/paid_media.py rename to pyrogram/types/business/paid_media.py diff --git a/pyrogram/types/bots_and_keyboards/payment_info.py b/pyrogram/types/business/payment_info.py similarity index 100% rename from pyrogram/types/bots_and_keyboards/payment_info.py rename to pyrogram/types/business/payment_info.py diff --git a/pyrogram/types/bots_and_keyboards/payment_refunded.py b/pyrogram/types/business/payment_refunded.py similarity index 100% rename from pyrogram/types/bots_and_keyboards/payment_refunded.py rename to pyrogram/types/business/payment_refunded.py diff --git a/pyrogram/types/bots_and_keyboards/pre_checkout_query.py b/pyrogram/types/business/pre_checkout_query.py similarity index 100% rename from pyrogram/types/bots_and_keyboards/pre_checkout_query.py rename to pyrogram/types/business/pre_checkout_query.py diff --git a/pyrogram/types/bots_and_keyboards/shipping_address.py b/pyrogram/types/business/shipping_address.py similarity index 100% rename from pyrogram/types/bots_and_keyboards/shipping_address.py rename to pyrogram/types/business/shipping_address.py diff --git a/pyrogram/types/bots_and_keyboards/shipping_option.py b/pyrogram/types/business/shipping_option.py similarity index 100% rename from pyrogram/types/bots_and_keyboards/shipping_option.py rename to pyrogram/types/business/shipping_option.py diff --git a/pyrogram/types/bots_and_keyboards/shipping_query.py b/pyrogram/types/business/shipping_query.py similarity index 100% rename from pyrogram/types/bots_and_keyboards/shipping_query.py rename to pyrogram/types/business/shipping_query.py diff --git a/pyrogram/types/bots_and_keyboards/successful_payment.py b/pyrogram/types/business/successful_payment.py similarity index 100% rename from pyrogram/types/bots_and_keyboards/successful_payment.py rename to pyrogram/types/business/successful_payment.py diff --git a/pyrogram/types/messages_and_media/__init__.py b/pyrogram/types/messages_and_media/__init__.py index 85a67a98..2eda28f9 100644 --- a/pyrogram/types/messages_and_media/__init__.py +++ b/pyrogram/types/messages_and_media/__init__.py @@ -23,7 +23,6 @@ from .available_effect import AvailableEffect from .contact import Contact from .dice import Dice from .document import Document -from .extended_media_preview import ExtendedMediaPreview from .game import Game from .gifted_premium import GiftedPremium from .giveaway import Giveaway @@ -36,7 +35,6 @@ from .media_area_channel_post import MediaAreaChannelPost from .media_area_coordinates import MediaAreaCoordinates from .message import Message from .message_entity import MessageEntity -from .paid_media import PaidMedia from .photo import Photo from .poll import Poll from .poll_option import PollOption @@ -56,7 +54,6 @@ from .web_app_data import WebAppData from .web_page import WebPage from .web_page_empty import WebPageEmpty from .web_page_preview import WebPagePreview -from .message_invoice import MessageInvoice from .message_reactions import MessageReactions from .message_reaction_updated import MessageReactionUpdated from .message_reaction_count_updated import MessageReactionCountUpdated @@ -69,7 +66,7 @@ from .story_views import StoryViews from .exported_story_link import ExportedStoryLink __all__ = [ - "Animation", "Audio", "AvailableEffect", "Contact", "Document", "ExtendedMediaPreview", "Game", "GiftedPremium", "Giveaway", "GiveawayLaunched", "GiveawayResult", "LabeledPrice", "Location", "MediaArea", "MediaAreaChannelPost", "MediaAreaCoordinates", "Message", "MessageEntity", "PaidMedia", "Photo", "Thumbnail", + "Animation", "Audio", "AvailableEffect", "Contact", "Document", "Game", "GiftedPremium", "Giveaway", "GiveawayLaunched", "GiveawayResult", "LabeledPrice", "Location", "MediaArea", "MediaAreaChannelPost", "MediaAreaCoordinates", "Message", "MessageEntity", "Photo", "Thumbnail", "StrippedThumbnail", "Poll", "PollOption", "Sticker", "StickerSet", "Venue", "Video", "VideoNote", "Voice", "WebPage", "WebPageEmpty", "WebPagePreview", "Dice", - "Reaction", "WebAppData", "MessageInvoice", "MessageReactions", "ReactionCount", "ReactionType", "MessageReactionUpdated", "MessageReactionCountUpdated", "MessageStory", "Story", "StoryDeleted", "StorySkipped", "StoryViews", "StoryForwardHeader", "StoriesPrivacyRules", "ExportedStoryLink" + "Reaction", "WebAppData", "MessageReactions", "ReactionCount", "ReactionType", "MessageReactionUpdated", "MessageReactionCountUpdated", "MessageStory", "Story", "StoryDeleted", "StorySkipped", "StoryViews", "StoryForwardHeader", "StoriesPrivacyRules", "ExportedStoryLink" ] diff --git a/pyrogram/types/messages_and_media/message.py b/pyrogram/types/messages_and_media/message.py index 57a1dce3..f24523e7 100644 --- a/pyrogram/types/messages_and_media/message.py +++ b/pyrogram/types/messages_and_media/message.py @@ -226,7 +226,7 @@ class Message(Object, Update): giveaway_result (:obj:`~pyrogram.types.GiveawayResult`, *optional*): Message is a giveaway result, information about the giveaway result. - invoice (:obj:`~pyrogram.types.MessageInvoice`, *optional*): + invoice (:obj:`~pyrogram.types.Invoice`, *optional*): Message is an invoice for a payment, information about the invoice. story (:obj:`~pyrogram.types.MessageStory` | :obj:`~pyrogram.types.Story`, *optional*): @@ -485,7 +485,7 @@ class Message(Object, Update): giveaway: "types.Giveaway" = None, giveaway_result: "types.GiveawayResult" = None, boosts_applied: int = None, - invoice: "types.MessageInvoice" = None, + invoice: "types.Invoice" = None, story: Union["types.MessageStory", "types.Story"] = None, video: "types.Video" = None, voice: "types.Voice" = None, @@ -1092,7 +1092,7 @@ class Message(Object, Update): dice = types.Dice._parse(client, media) media_type = enums.MessageMediaType.DICE elif isinstance(media, raw.types.MessageMediaInvoice): - invoice = types.MessageInvoice._parse(media) + invoice = types.Invoice._parse(media) media = enums.MessageMediaType.INVOICE elif isinstance(media, raw.types.MessageMediaPaidMedia): paid_media = types.PaidMedia._parse(client, media)