diff --git a/telegram/_bot.py b/telegram/_bot.py index 5721a391ef3..41fd7d8cd3f 100644 --- a/telegram/_bot.py +++ b/telegram/_bot.py @@ -4168,9 +4168,9 @@ async def send_invoice( .. versionadded:: 13.5 suggested_tip_amounts (List[:obj:`int`], optional): An array of suggested amounts of tips in the *smallest* units of the currency (integer, **not** - float/double). At most 4 suggested tip amounts can be specified. The suggested tip - amounts must be positive, passed in a strictly increased order and must not exceed - :paramref:`max_tip_amount`. + float/double). At most :tg-const:`telegram.Invoice.MAX_TIP_AMOUNTS` suggested tip + amounts can be specified. The suggested tip amounts must be positive, passed in a + strictly increased order and must not exceed :paramref:`max_tip_amount`. .. versionadded:: 13.5 start_parameter (:obj:`str`, optional): Unique deep-linking parameter. If left empty, @@ -6693,9 +6693,12 @@ async def create_invoice_link( majority of currencies). Defaults to ``0``. suggested_tip_amounts (List[:obj:`int`], optional): An array of suggested amounts of tips in the *smallest* units of the currency (integer, **not** - float/double). At most 4 suggested tip amounts can be specified. The suggested tip - amounts must be positive, passed in a strictly increased order and must not exceed - :paramref:`max_tip_amount`. + float/double). At most :tg-const:`telegram.Invoice.MAX_TIP_AMOUNTS` suggested tip + amounts can be specified. The suggested tip amounts must be positive, passed in a + strictly increased order and must not exceed :paramref:`max_tip_amount`. + + .. versionchanged:: 20.0 + Accept :obj:`Sequence` instead of :obj:`List`. provider_data (:obj:`str` | :obj:`object`, optional): Data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider. When an object is diff --git a/telegram/_payment/invoice.py b/telegram/_payment/invoice.py index 22bc17e7abe..2c33e1fdc68 100644 --- a/telegram/_payment/invoice.py +++ b/telegram/_payment/invoice.py @@ -119,3 +119,8 @@ def __init__( .. versionadded:: 20.0 """ + MAX_TIP_AMOUNTS: ClassVar[int] = constants.InvoiceLimit.MAX_TIP_AMOUNTS + """:const:`telegram.constants.InvoiceLimit.MAX_TIP_AMOUNTS` + + .. versionadded:: 20.0 + """ diff --git a/telegram/constants.py b/telegram/constants.py index 417975b673e..40c54aeb8f1 100644 --- a/telegram/constants.py +++ b/telegram/constants.py @@ -1425,8 +1425,9 @@ class UpdateType(StringEnum): class InvoiceLimit(IntEnum): - """This enum contains limitations for :meth:`telegram.Bot.create_invoice_link`. The enum - members of this enumeration are instances of :class:`int` and can be treated as such. + """This enum contains limitations for :class:`telegram.InputInvoiceMessageContent`, + :meth:`telegram.Bot.send_invoice`, and :meth:`telegram.Bot.create_invoice_link`. + The enum members of this enumeration are instances of :class:`int` and can be treated as such. .. versionadded:: 20.0 """ @@ -1493,6 +1494,14 @@ class InvoiceLimit(IntEnum): * :paramref:`~telegram.Bot.create_invoice_link.payload` parameter of :meth:`telegram.Bot.create_invoice_link`. """ + MAX_TIP_AMOUNTS = 4 + """:obj:`int`: Maximum length of a :obj:`Sequence` passed as: + + * :paramref:`~telegram.Bot.send_invoice.suggested_tip_amounts` parameter of + :meth:`telegram.Bot.send_invoice`. + * :paramref:`~telegram.Bot.create_invoice_link.suggested_tip_amounts` parameter of + :meth:`telegram.Bot.create_invoice_link`. + """ class UserProfilePhotosLimit(IntEnum):