mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Added full support of Bot API 7.7 (#1536)
* Added full support of Bot API 7.7 * Added changes description
This commit is contained in:
parent
2ac2650165
commit
4ddc320e21
11 changed files with 219 additions and 3 deletions
|
|
@ -39,6 +39,7 @@ class ContentType(str, Enum):
|
|||
PINNED_MESSAGE = "pinned_message"
|
||||
INVOICE = "invoice"
|
||||
SUCCESSFUL_PAYMENT = "successful_payment"
|
||||
REFUNDED_PAYMENT = "refunded_payment"
|
||||
USERS_SHARED = "users_shared"
|
||||
CHAT_SHARED = "chat_shared"
|
||||
CONNECTED_WEBSITE = "connected_website"
|
||||
|
|
|
|||
|
|
@ -187,6 +187,7 @@ from .reaction_count import ReactionCount
|
|||
from .reaction_type import ReactionType
|
||||
from .reaction_type_custom_emoji import ReactionTypeCustomEmoji
|
||||
from .reaction_type_emoji import ReactionTypeEmoji
|
||||
from .refunded_payment import RefundedPayment
|
||||
from .reply_keyboard_markup import ReplyKeyboardMarkup
|
||||
from .reply_keyboard_remove import ReplyKeyboardRemove
|
||||
from .reply_parameters import ReplyParameters
|
||||
|
|
@ -418,6 +419,7 @@ __all__ = (
|
|||
"ReactionType",
|
||||
"ReactionTypeCustomEmoji",
|
||||
"ReactionTypeEmoji",
|
||||
"RefundedPayment",
|
||||
"ReplyKeyboardMarkup",
|
||||
"ReplyKeyboardRemove",
|
||||
"ReplyParameters",
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ from aiogram.utils.text_decorations import (
|
|||
|
||||
from ..client.default import Default
|
||||
from ..enums import ContentType
|
||||
from . import InputPaidMediaPhoto, InputPaidMediaVideo
|
||||
from .custom import DateTime
|
||||
from .maybe_inaccessible_message import MaybeInaccessibleMessage
|
||||
|
||||
|
|
@ -80,6 +79,8 @@ if TYPE_CHECKING:
|
|||
from .input_media_document import InputMediaDocument
|
||||
from .input_media_photo import InputMediaPhoto
|
||||
from .input_media_video import InputMediaVideo
|
||||
from .input_paid_media_photo import InputPaidMediaPhoto
|
||||
from .input_paid_media_video import InputPaidMediaVideo
|
||||
from .input_poll_option import InputPollOption
|
||||
from .invoice import Invoice
|
||||
from .labeled_price import LabeledPrice
|
||||
|
|
@ -98,6 +99,7 @@ if TYPE_CHECKING:
|
|||
from .proximity_alert_triggered import ProximityAlertTriggered
|
||||
from .reaction_type_custom_emoji import ReactionTypeCustomEmoji
|
||||
from .reaction_type_emoji import ReactionTypeEmoji
|
||||
from .refunded_payment import RefundedPayment
|
||||
from .reply_keyboard_markup import ReplyKeyboardMarkup
|
||||
from .reply_keyboard_remove import ReplyKeyboardRemove
|
||||
from .reply_parameters import ReplyParameters
|
||||
|
|
@ -249,6 +251,8 @@ class Message(MaybeInaccessibleMessage):
|
|||
"""*Optional*. Message is an invoice for a `payment <https://core.telegram.org/bots/api#payments>`_, information about the invoice. `More about payments » <https://core.telegram.org/bots/api#payments>`_"""
|
||||
successful_payment: Optional[SuccessfulPayment] = None
|
||||
"""*Optional*. Message is a service message about a successful payment, information about the payment. `More about payments » <https://core.telegram.org/bots/api#payments>`_"""
|
||||
refunded_payment: Optional[RefundedPayment] = None
|
||||
"""*Optional*. Message is a service message about a refunded payment, information about the payment. `More about payments » <https://core.telegram.org/bots/api#payments>`_"""
|
||||
users_shared: Optional[UsersShared] = None
|
||||
"""*Optional*. Service message: users were shared with the bot"""
|
||||
chat_shared: Optional[ChatShared] = None
|
||||
|
|
@ -407,6 +411,7 @@ class Message(MaybeInaccessibleMessage):
|
|||
pinned_message: Optional[Union[Message, InaccessibleMessage]] = None,
|
||||
invoice: Optional[Invoice] = None,
|
||||
successful_payment: Optional[SuccessfulPayment] = None,
|
||||
refunded_payment: Optional[RefundedPayment] = None,
|
||||
users_shared: Optional[UsersShared] = None,
|
||||
chat_shared: Optional[ChatShared] = None,
|
||||
connected_website: Optional[str] = None,
|
||||
|
|
@ -505,6 +510,7 @@ class Message(MaybeInaccessibleMessage):
|
|||
pinned_message=pinned_message,
|
||||
invoice=invoice,
|
||||
successful_payment=successful_payment,
|
||||
refunded_payment=refunded_payment,
|
||||
users_shared=users_shared,
|
||||
chat_shared=chat_shared,
|
||||
connected_website=connected_website,
|
||||
|
|
@ -651,6 +657,8 @@ class Message(MaybeInaccessibleMessage):
|
|||
return ContentType.CHAT_BACKGROUND_SET
|
||||
if self.boost_added:
|
||||
return ContentType.BOOST_ADDED
|
||||
if self.refunded_payment:
|
||||
return ContentType.REFUNDED_PAYMENT
|
||||
|
||||
return ContentType.UNKNOWN
|
||||
|
||||
|
|
|
|||
49
aiogram/types/refunded_payment.py
Normal file
49
aiogram/types/refunded_payment.py
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
from typing import TYPE_CHECKING, Any, Literal, Optional
|
||||
|
||||
from .base import TelegramObject
|
||||
|
||||
|
||||
class RefundedPayment(TelegramObject):
|
||||
"""
|
||||
This object contains basic information about a refunded payment.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#refundedpayment
|
||||
"""
|
||||
|
||||
currency: Literal["XTR"] = "XTR"
|
||||
"""Three-letter ISO 4217 `currency <https://core.telegram.org/bots/payments#supported-currencies>`_ code, or 'XTR' for payments in `Telegram Stars <https://t.me/BotNews/90>`_. Currently, always 'XTR'"""
|
||||
total_amount: int
|
||||
"""Total refunded price in the *smallest units* of the currency (integer, **not** float/double). For example, for a price of :code:`US$ 1.45`, :code:`total_amount = 145`. See the *exp* parameter in `currencies.json <https://core.telegram.org/bots/payments/currencies.json>`_, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies)."""
|
||||
invoice_payload: str
|
||||
"""Bot-specified invoice payload"""
|
||||
telegram_payment_charge_id: str
|
||||
"""Telegram payment identifier"""
|
||||
provider_payment_charge_id: Optional[str] = None
|
||||
"""*Optional*. Provider payment identifier"""
|
||||
|
||||
if TYPE_CHECKING:
|
||||
# DO NOT EDIT MANUALLY!!!
|
||||
# This section was auto-generated via `butcher`
|
||||
|
||||
def __init__(
|
||||
__pydantic__self__,
|
||||
*,
|
||||
currency: Literal["XTR"] = "XTR",
|
||||
total_amount: int,
|
||||
invoice_payload: str,
|
||||
telegram_payment_charge_id: str,
|
||||
provider_payment_charge_id: Optional[str] = None,
|
||||
**__pydantic_kwargs: Any,
|
||||
) -> None:
|
||||
# DO NOT EDIT MANUALLY!!!
|
||||
# This method was auto-generated via `butcher`
|
||||
# Is needed only for type checking and IDE support without any additional plugins
|
||||
|
||||
super().__init__(
|
||||
currency=currency,
|
||||
total_amount=total_amount,
|
||||
invoice_payload=invoice_payload,
|
||||
telegram_payment_charge_id=telegram_payment_charge_id,
|
||||
provider_payment_charge_id=provider_payment_charge_id,
|
||||
**__pydantic_kwargs,
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue