mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 12:04:51 +00:00
pyrofork: Add paid_message_price_changed field to Message
Signed-off-by: wulan17 <wulan17@komodos.id>
This commit is contained in:
parent
068181682e
commit
1ed7add4dd
5 changed files with 62 additions and 0 deletions
|
|
@ -609,6 +609,7 @@ def pyrogram_api():
|
||||||
Invoice
|
Invoice
|
||||||
LabeledPrice
|
LabeledPrice
|
||||||
PaidMedia
|
PaidMedia
|
||||||
|
PaidMessagePriceChanged
|
||||||
PaymentForm
|
PaymentForm
|
||||||
PaymentInfo
|
PaymentInfo
|
||||||
PaymentRefunded
|
PaymentRefunded
|
||||||
|
|
|
||||||
|
|
@ -132,3 +132,6 @@ class MessageServiceType(AutoName):
|
||||||
|
|
||||||
SCREENSHOT_TAKEN = auto()
|
SCREENSHOT_TAKEN = auto()
|
||||||
"Screenshot taken"
|
"Screenshot taken"
|
||||||
|
|
||||||
|
PAID_MESSAGE_PRICE_CHANGED = auto()
|
||||||
|
"Paid message price changed"
|
||||||
|
|
|
||||||
|
|
@ -480,6 +480,7 @@ class Message(Object, Update):
|
||||||
gift_code: "types.GiftCode" = None,
|
gift_code: "types.GiftCode" = None,
|
||||||
gift: "types.Gift" = None,
|
gift: "types.Gift" = None,
|
||||||
screenshot_taken: "types.ScreenshotTaken" = None,
|
screenshot_taken: "types.ScreenshotTaken" = None,
|
||||||
|
paid_message_price_changed: "types.PaidMessagePriceChanged" = None,
|
||||||
invoice: "types.Invoice" = None,
|
invoice: "types.Invoice" = None,
|
||||||
story: Union["types.MessageStory", "types.Story"] = None,
|
story: Union["types.MessageStory", "types.Story"] = None,
|
||||||
alternative_videos: List["types.AlternativeVideo"] = None,
|
alternative_videos: List["types.AlternativeVideo"] = None,
|
||||||
|
|
@ -596,6 +597,7 @@ class Message(Object, Update):
|
||||||
self.gift_code = gift_code
|
self.gift_code = gift_code
|
||||||
self.gift = gift
|
self.gift = gift
|
||||||
self.screenshot_taken = screenshot_taken
|
self.screenshot_taken = screenshot_taken
|
||||||
|
self.paid_message_price_changed = paid_message_price_changed
|
||||||
self.invoice = invoice
|
self.invoice = invoice
|
||||||
self.story = story
|
self.story = story
|
||||||
self.video = video
|
self.video = video
|
||||||
|
|
@ -760,6 +762,7 @@ class Message(Object, Update):
|
||||||
gift_code = None
|
gift_code = None
|
||||||
gift = None
|
gift = None
|
||||||
screenshot_taken = None
|
screenshot_taken = None
|
||||||
|
paid_message_price_changed = None
|
||||||
|
|
||||||
service_type = None
|
service_type = None
|
||||||
chat_join_type = None
|
chat_join_type = None
|
||||||
|
|
@ -881,6 +884,9 @@ class Message(Object, Update):
|
||||||
elif isinstance(action, raw.types.MessageActionScreenshotTaken):
|
elif isinstance(action, raw.types.MessageActionScreenshotTaken):
|
||||||
screenshot_taken = types.ScreenshotTaken()
|
screenshot_taken = types.ScreenshotTaken()
|
||||||
service_type = enums.MessageServiceType.SCREENSHOT_TAKEN
|
service_type = enums.MessageServiceType.SCREENSHOT_TAKEN
|
||||||
|
elif isinstance(action, raw.types.MessageActionPaidMessagesPrice):
|
||||||
|
paid_message_price_changed = types.PaidMessagePriceChanged._parse(action)
|
||||||
|
service_type = enums.MessageServiceType.PAID_MESSAGE_PRICE_CHANGED
|
||||||
|
|
||||||
parsed_message = Message(
|
parsed_message = Message(
|
||||||
id=message.id,
|
id=message.id,
|
||||||
|
|
@ -926,6 +932,7 @@ class Message(Object, Update):
|
||||||
contact_registered=contact_registered,
|
contact_registered=contact_registered,
|
||||||
gift_code=gift_code,
|
gift_code=gift_code,
|
||||||
screenshot_taken=screenshot_taken,
|
screenshot_taken=screenshot_taken,
|
||||||
|
paid_message_price_changed=paid_message_price_changed,
|
||||||
raw=message,
|
raw=message,
|
||||||
chat_join_type=chat_join_type,
|
chat_join_type=chat_join_type,
|
||||||
client=client
|
client=client
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ from .input_stars_transaction import InputStarsTransaction
|
||||||
from .invoice import Invoice
|
from .invoice import Invoice
|
||||||
from .labeled_price import LabeledPrice
|
from .labeled_price import LabeledPrice
|
||||||
from .paid_media import PaidMedia
|
from .paid_media import PaidMedia
|
||||||
|
from .paid_message_price_changed import PaidMessagePriceChanged
|
||||||
from .payment_form import PaymentForm
|
from .payment_form import PaymentForm
|
||||||
from .payment_info import PaymentInfo
|
from .payment_info import PaymentInfo
|
||||||
from .payment_refunded import PaymentRefunded
|
from .payment_refunded import PaymentRefunded
|
||||||
|
|
@ -46,6 +47,7 @@ __all__ = [
|
||||||
"Invoice",
|
"Invoice",
|
||||||
"LabeledPrice",
|
"LabeledPrice",
|
||||||
"PaidMedia",
|
"PaidMedia",
|
||||||
|
"PaidMessagePriceChanged",
|
||||||
"PaymentForm",
|
"PaymentForm",
|
||||||
"PaymentInfo",
|
"PaymentInfo",
|
||||||
"PaymentRefunded",
|
"PaymentRefunded",
|
||||||
|
|
|
||||||
49
pyrogram/types/payments/paid_message_price_changed.py
Normal file
49
pyrogram/types/payments/paid_message_price_changed.py
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
# Pyrofork - Telegram MTProto API Client Library for Python
|
||||||
|
# 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, Union
|
||||||
|
|
||||||
|
from pyrogram import raw
|
||||||
|
from pyrogram import types
|
||||||
|
from ..object import Object
|
||||||
|
|
||||||
|
|
||||||
|
class PaidMessagePriceChanged(Object):
|
||||||
|
"""A PaidMessagePriceChanged.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
stars_amount (``int``):
|
||||||
|
Amount of stars.
|
||||||
|
|
||||||
|
extended_media (List of :obj:`~pyrogram.types.Animation` | :obj:`~pyrogram.types.ExtendedMediaPreview` | :obj:`~pyrogram.types.Photo` | :obj:`~pyrogram.types.Video`, *optional*):
|
||||||
|
Extended media.
|
||||||
|
"""
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
*,
|
||||||
|
stars_amount: int,
|
||||||
|
):
|
||||||
|
super().__init__()
|
||||||
|
|
||||||
|
self.stars_amount = stars_amount
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _parse(action: "raw.types.MessageActionPaidMessagesPrice") -> "PaidMessagePriceChanged":
|
||||||
|
return PaidMessagePriceChanged(
|
||||||
|
stars_amount=action.stars
|
||||||
|
)
|
||||||
Loading…
Reference in a new issue