From 667c98555645de86b4ec271137aa037e86a466a4 Mon Sep 17 00:00:00 2001 From: Hinrich Mahler <22366557+Bibo-Joshi@users.noreply.github.com> Date: Mon, 17 Jun 2024 19:30:57 +0200 Subject: [PATCH 01/14] Close #4301 --- telegram/_inline/inlinekeyboardbutton.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/telegram/_inline/inlinekeyboardbutton.py b/telegram/_inline/inlinekeyboardbutton.py index d88f222cad7..234b4c28986 100644 --- a/telegram/_inline/inlinekeyboardbutton.py +++ b/telegram/_inline/inlinekeyboardbutton.py @@ -120,9 +120,12 @@ class InlineKeyboardButton(TelegramObject): This is similar to the new parameter :paramref:`switch_inline_query_chosen_chat`, but gives no control over which chats can be selected. switch_inline_query_current_chat (:obj:`str`, optional): If set, pressing the button will - prompt the user to select one of their chats of the specified type, open that chat and - insert the bot's username and the specified inline query in the input field. Not - supported for messages sent on behalf of a Telegram Business account. + insert the bot's username and the specified inline query in the current chat's input + field. May be empty, in which case only the bot's username will be inserted. + + This offers a quick way for the user to open your bot in inline mode in the same chat + - good for selecting something from multiple options. Not supported in channels and for + messages sent on behalf of a Telegram Business account. callback_game (:class:`telegram.CallbackGame`, optional): Description of the game that will be launched when the user presses the button @@ -189,9 +192,12 @@ class InlineKeyboardButton(TelegramObject): This is similar to the new parameter :paramref:`switch_inline_query_chosen_chat`, but gives no control over which chats can be selected. switch_inline_query_current_chat (:obj:`str`): Optional. If set, pressing the button will - prompt the user to select one of their chats of the specified type, open that chat and - insert the bot's username and the specified inline query in the input field. Not - supported for messages sent on behalf of a Telegram Business account. + insert the bot's username and the specified inline query in the current chat's input + field. May be empty, in which case only the bot's username will be inserted. + + This offers a quick way for the user to open your bot in inline mode in the same chat + - good for selecting something from multiple options. Not supported in channels and for + messages sent on behalf of a Telegram Business account. callback_game (:class:`telegram.CallbackGame`): Optional. Description of the game that will be launched when the user presses the button. From ba2efdcc392820b892ef2e1679af77c2ee7675db Mon Sep 17 00:00:00 2001 From: Hinrich Mahler <22366557+Bibo-Joshi@users.noreply.github.com> Date: Sat, 22 Jun 2024 22:39:20 +0200 Subject: [PATCH 02/14] Rendering fix --- telegram/ext/_application.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/telegram/ext/_application.py b/telegram/ext/_application.py index f5a9d6df49a..5a38fdfccc1 100644 --- a/telegram/ext/_application.py +++ b/telegram/ext/_application.py @@ -1357,11 +1357,11 @@ def add_handler(self, handler: BaseHandler[Any, CCT], group: int = DEFAULT_GROUP The priority/order of handlers is determined as follows: - * Priority of the group (lower group number == higher priority) - * The first handler in a group which can handle an update (see - :attr:`telegram.ext.BaseHandler.check_update`) will be used. Other handlers from the - group will not be used. The order in which handlers were added to the group defines the - priority. + * Priority of the group (lower group number == higher priority) + * The first handler in a group which can handle an update (see + :attr:`telegram.ext.BaseHandler.check_update`) will be used. Other handlers from the + group will not be used. The order in which handlers were added to the group defines the + priority. Warning: Adding persistent :class:`telegram.ext.ConversationHandler` after the application has From 4aa404afff3f8ed195797513d9221ea60a37d10e Mon Sep 17 00:00:00 2001 From: Hinrich Mahler <22366557+Bibo-Joshi@users.noreply.github.com> Date: Thu, 27 Jun 2024 20:25:52 +0200 Subject: [PATCH 03/14] Elaborate docs of refresh_*_data --- telegram/ext/_basepersistence.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/telegram/ext/_basepersistence.py b/telegram/ext/_basepersistence.py index 5199a165bb6..126437a0a48 100644 --- a/telegram/ext/_basepersistence.py +++ b/telegram/ext/_basepersistence.py @@ -357,6 +357,10 @@ async def refresh_user_data(self, user_id: int, user_data: UD) -> None: :attr:`~telegram.ext.Application.user_data` to a callback. Can be used to update data stored in :attr:`~telegram.ext.Application.user_data` from an external source. + Tip: + This method is expected to edit the object :paramref:`user_data` in-place instead of + returning a new object. + Warning: When using :meth:`~telegram.ext.ApplicationBuilder.concurrent_updates`, this method may be called while a handler callback is still running. This might lead to race @@ -380,6 +384,10 @@ async def refresh_chat_data(self, chat_id: int, chat_data: CD) -> None: :attr:`~telegram.ext.Application.chat_data` to a callback. Can be used to update data stored in :attr:`~telegram.ext.Application.chat_data` from an external source. + Tip: + This method is expected to edit the object :paramref:`chat_data` in-place instead of + returning a new object. + Warning: When using :meth:`~telegram.ext.ApplicationBuilder.concurrent_updates`, this method may be called while a handler callback is still running. This might lead to race @@ -403,6 +411,10 @@ async def refresh_bot_data(self, bot_data: BD) -> None: :attr:`~telegram.ext.Application.bot_data` to a callback. Can be used to update data stored in :attr:`~telegram.ext.Application.bot_data` from an external source. + Tip: + This method is expected to edit the object :paramref:`bot_data` in-place instead of + returning a new object. + Warning: When using :meth:`~telegram.ext.ApplicationBuilder.concurrent_updates`, this method may be called while a handler callback is still running. This might lead to race From bb73ecfe463a6895472ec6502b4561ddd23ffd71 Mon Sep 17 00:00:00 2001 From: Hinrich Mahler <22366557+Bibo-Joshi@users.noreply.github.com> Date: Mon, 1 Jul 2024 19:51:06 +0200 Subject: [PATCH 04/14] Maybe baby --- telegram/_callbackquery.py | 2 +- telegram/_inline/inlinekeyboardbutton.py | 2 +- telegram/request/_requestparameter.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/telegram/_callbackquery.py b/telegram/_callbackquery.py index af89c784b10..5a4c1e6bd9d 100644 --- a/telegram/_callbackquery.py +++ b/telegram/_callbackquery.py @@ -93,7 +93,7 @@ class CallbackQuery(TelegramObject): with the callback button that originated the query. .. versionchanged:: 20.8 - Objects maybe be of type :class:`telegram.MaybeInaccessibleMessage` since Bot API + Objects may be of type :class:`telegram.MaybeInaccessibleMessage` since Bot API 7.0. data (:obj:`str` | :obj:`object`): Optional. Data associated with the callback button. Be aware that the message, which originated the query, can contain no callback buttons diff --git a/telegram/_inline/inlinekeyboardbutton.py b/telegram/_inline/inlinekeyboardbutton.py index 234b4c28986..69279c1078e 100644 --- a/telegram/_inline/inlinekeyboardbutton.py +++ b/telegram/_inline/inlinekeyboardbutton.py @@ -46,7 +46,7 @@ class InlineKeyboardButton(TelegramObject): working as expected. Putting a game short name in it might, but is not guaranteed to work. * If your bot allows for arbitrary callback data, in keyboards returned in a response - from telegram, :attr:`callback_data` maybe be an instance of + from telegram, :attr:`callback_data` may be an instance of :class:`telegram.ext.InvalidCallbackData`. This will be the case, if the data associated with the button was already deleted. diff --git a/telegram/request/_requestparameter.py b/telegram/request/_requestparameter.py index 6b16a5cae66..a1eae03ffd7 100644 --- a/telegram/request/_requestparameter.py +++ b/telegram/request/_requestparameter.py @@ -90,7 +90,7 @@ def _value_and_input_files_from_input( # pylint: disable=too-many-return-statem value: object, ) -> Tuple[object, List[InputFile]]: """Converts `value` into something that we can json-dump. Returns two values: - 1. the JSON-dumpable value. Maybe be `None` in case the value is an InputFile which must + 1. the JSON-dumpable value. May be `None` in case the value is an InputFile which must not be uploaded via an attach:// URI 2. A list of InputFiles that should be uploaded for this value From bf24773b0c8044c0b96e5d0a6c313eb345a0a113 Mon Sep 17 00:00:00 2001 From: poolitzer Date: Fri, 5 Jul 2024 19:27:53 +0200 Subject: [PATCH 05/14] Fix: Expand documenting about run_polling --- telegram/ext/_application.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/telegram/ext/_application.py b/telegram/ext/_application.py index 5a38fdfccc1..4328024b3c3 100644 --- a/telegram/ext/_application.py +++ b/telegram/ext/_application.py @@ -781,6 +781,11 @@ def run_polling( - :meth:`shutdown` - :meth:`post_shutdown` + A small wrapper is passed to :paramref:`telegram.ext.Updater.start_polling.error_callback` + which forwards errors occurring during polling to + :meth:`registered error handlers `. The update parameter of the callback + will be set to :obj:`None`. + .. include:: inclusions/application_run_tip.rst Args: From a62f8520bfe3d44dac2544458bd2f466a3d6291d Mon Sep 17 00:00:00 2001 From: poolitzer Date: Fri, 5 Jul 2024 22:20:12 +0200 Subject: [PATCH 06/14] Fix: equalize docs formatting --- telegram/_bot.py | 27 ++++++++++--------- .../_inline/inputinvoicemessagecontent.py | 15 +++++------ telegram/_payment/invoice.py | 12 ++++----- telegram/_payment/labeledprice.py | 4 +-- telegram/_payment/precheckoutquery.py | 8 +++--- telegram/_payment/successfulpayment.py | 8 +++--- 6 files changed, 37 insertions(+), 37 deletions(-) diff --git a/telegram/_bot.py b/telegram/_bot.py index ebc7817b9d2..e0213726e04 100644 --- a/telegram/_bot.py +++ b/telegram/_bot.py @@ -4990,15 +4990,16 @@ async def send_invoice( .. versionchanged:: 20.0 |sequenceargs| max_tip_amount (:obj:`int`, optional): The maximum accepted amount for tips in the - *smallest* units of the currency (integer, **not** float/double). For example, for - a maximum tip of US$ 1.45 pass ``max_tip_amount = 145``. See the exp parameter in - `currencies.json `_, it - shows the number of digits past the decimal point for each currency (2 for the - majority of currencies). Defaults to ``0``. Not supported for payment in |tg_stars| + *smallest units* of the currency (integer, **not** float/double). For example, for + a maximum tip of ``US$ 1.45`` pass ``max_tip_amount = 145``. See the ``exp`` + parameter in `currencies.json + `_, it shows the number of + digits past the decimal point for each currency (2 for the majority of currencies). + Defaults to ``0``. Not supported for payment in |tg_stars|. .. versionadded:: 13.5 suggested_tip_amounts (Sequence[:obj:`int`], optional): An array of - suggested amounts of tips in the *smallest* units of the currency (integer, **not** + suggested amounts of tips in the *smallest units* of the currency (integer, **not** 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`. @@ -7924,14 +7925,14 @@ async def create_invoice_link( .. versionchanged:: 20.0 |sequenceargs| max_tip_amount (:obj:`int`, optional): The maximum accepted amount for tips in the - *smallest* units of the currency (integer, **not** float/double). For example, for - a maximum tip of US$ 1.45 pass ``max_tip_amount = 145``. See the exp parameter in - `currencies.json `_, it - shows the number of digits past the decimal point for each currency (2 for the - majority of currencies). Defaults to ``0``. Not supported for payments in - |tg_stars|. + *smallest units* of the currency (integer, **not** float/double). For example, for + a maximum tip of ``US$ 1.45`` pass ``max_tip_amount = 145``. See the ``exp`` + parameter in `currencies.json + `_, it shows the number of + digits past the decimal point for each currency (2 for the majority of currencies). + Defaults to ``0``. Not supported for payments in |tg_stars|. suggested_tip_amounts (Sequence[:obj:`int`], optional): An array of - suggested amounts of tips in the *smallest* units of the currency (integer, **not** + suggested amounts of tips in the *smallest units* of the currency (integer, **not** 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`. diff --git a/telegram/_inline/inputinvoicemessagecontent.py b/telegram/_inline/inputinvoicemessagecontent.py index 74ea97de297..ecdcd490ce1 100644 --- a/telegram/_inline/inputinvoicemessagecontent.py +++ b/telegram/_inline/inputinvoicemessagecontent.py @@ -66,14 +66,13 @@ class InputInvoiceMessageContent(InputMessageContent): |sequenceclassargs| max_tip_amount (:obj:`int`, optional): The maximum accepted amount for tips in the - *smallest* units of the currency (integer, **not** float/double). For example, for a - maximum tip of US$ 1.45 pass ``max_tip_amount = 145``. See the ``exp`` parameter in + *smallest units* of the currency (integer, **not** float/double). For example, for a + maximum tip of ``US$ 1.45`` pass ``max_tip_amount = 145``. See the ``exp`` parameter in `currencies.json `_, it shows the number of digits past the decimal point for each currency (2 for the majority - of currencies). Defaults to ``0``. Defaults to ``0``. Not supported for payments in - |tg_stars|. + of currencies). Defaults to ``0``. Not supported for payments in |tg_stars|. suggested_tip_amounts (Sequence[:obj:`int`], optional): An array of suggested - amounts of tip in the *smallest* units of the currency (integer, **not** float/double). + amounts of tip 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 :attr:`max_tip_amount`. @@ -131,13 +130,13 @@ class InputInvoiceMessageContent(InputMessageContent): |tupleclassattrs| max_tip_amount (:obj:`int`): Optional. The maximum accepted amount for tips in the - *smallest* units of the currency (integer, **not** float/double). For example, for a - maximum tip of US$ 1.45 ``max_tip_amount`` is ``145``. See the ``exp`` parameter in + *smallest units* of the currency (integer, **not** float/double). For example, for a + maximum tip of ``US$ 1.45`` ``max_tip_amount`` is ``145``. See the ``exp`` parameter in `currencies.json `_, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to ``0``. Not supported for payments in |tg_stars|. suggested_tip_amounts (Tuple[:obj:`int`]): Optional. An array of suggested - amounts of tip in the *smallest* units of the currency (integer, **not** float/double). + amounts of tip 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 :attr:`max_tip_amount`. diff --git a/telegram/_payment/invoice.py b/telegram/_payment/invoice.py index 141f0c8fdd4..804ac040304 100644 --- a/telegram/_payment/invoice.py +++ b/telegram/_payment/invoice.py @@ -39,9 +39,9 @@ class Invoice(TelegramObject): generate this invoice. currency (:obj:`str`): Three-letter ISO 4217 currency code, or ``XTR`` for payments in |tg_stars|. - total_amount (:obj:`int`): Total price in the smallest units of the currency (integer, not - float/double). For example, for a price of US$ 1.45 pass ``amount = 145``. See the - ``exp`` parameter in + total_amount (:obj:`int`): Total price in the smallest units of the currency (integer, + **not** float/double). For example, for a price of ``US$ 1.45`` pass ``amount = 145``. + See the ``exp`` parameter in `currencies.json `_, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). @@ -53,9 +53,9 @@ class Invoice(TelegramObject): generate this invoice. currency (:obj:`str`): Three-letter ISO 4217 currency code, or ``XTR`` for payments in |tg_stars|. - total_amount (:obj:`int`): Total price in the smallest units of the currency (integer, not - float/double). For example, for a price of US$ 1.45 ``amount`` is ``145``. See the - ``exp`` parameter in + total_amount (:obj:`int`): Total price in the smallest units of the currency (integer, + **not** float/double). For example, for a price of ``US$ 1.45`` pass ``amount = 145``. + See the ``exp`` parameter in `currencies.json `_, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). diff --git a/telegram/_payment/labeledprice.py b/telegram/_payment/labeledprice.py index b668931b9d4..ec02f1f7029 100644 --- a/telegram/_payment/labeledprice.py +++ b/telegram/_payment/labeledprice.py @@ -36,7 +36,7 @@ class LabeledPrice(TelegramObject): Args: label (:obj:`str`): Portion label. amount (:obj:`int`): Price of the product in the smallest units of the currency (integer, - not float/double). For example, for a price of US$ 1.45 pass ``amount = 145``. + **not** float/double). For example, for a price of ``US$ 1.45`` pass ``amount = 145``. See the ``exp`` parameter in `currencies.json `_, it shows the number of digits past the decimal point for each currency @@ -45,7 +45,7 @@ class LabeledPrice(TelegramObject): Attributes: label (:obj:`str`): Portion label. amount (:obj:`int`): Price of the product in the smallest units of the currency (integer, - not float/double). For example, for a price of US$ 1.45 ``amount`` is ``145``. + **not** float/double). For example, for a price of ``US$ 1.45`` pass ``amount = 145``. See the ``exp`` parameter in `currencies.json `_, it shows the number of digits past the decimal point for each currency diff --git a/telegram/_payment/precheckoutquery.py b/telegram/_payment/precheckoutquery.py index fb57127fc11..d79df76b2c1 100644 --- a/telegram/_payment/precheckoutquery.py +++ b/telegram/_payment/precheckoutquery.py @@ -44,8 +44,8 @@ class PreCheckoutQuery(TelegramObject): from_user (:class:`telegram.User`): User who sent the query. currency (:obj:`str`): Three-letter ISO 4217 currency code, or ``XTR`` for payments in |tg_stars|. - total_amount (:obj:`int`): Total price in the smallest units of the currency (integer, not - float/double). For example, for a price of US$ 1.45 pass ``amount = 145``. + total_amount (:obj:`int`): Total price in the smallest units of the currency (integer, + **not** float/double). For example, for a price of ``US$ 1.45`` pass ``amount = 145``. See the ``exp`` parameter in `currencies.json `_, it shows the number of digits past the decimal point for each currency @@ -60,8 +60,8 @@ class PreCheckoutQuery(TelegramObject): from_user (:class:`telegram.User`): User who sent the query. currency (:obj:`str`): Three-letter ISO 4217 currency code, or ``XTR`` for payments in |tg_stars|. - total_amount (:obj:`int`): Total price in the smallest units of the currency (integer, not - float/double). For example, for a price of US$ 1.45 ``amount`` is ``145``. + total_amount (:obj:`int`): Total price in the smallest units of the currency (integer, + **not** float/double). For example, for a price of ``US$ 1.45`` pass ``amount = 145``. See the ``exp`` parameter in `currencies.json `_, it shows the number of digits past the decimal point for each currency diff --git a/telegram/_payment/successfulpayment.py b/telegram/_payment/successfulpayment.py index a7424feba22..2e1e41efc8b 100644 --- a/telegram/_payment/successfulpayment.py +++ b/telegram/_payment/successfulpayment.py @@ -38,8 +38,8 @@ class SuccessfulPayment(TelegramObject): Args: currency (:obj:`str`): Three-letter ISO 4217 currency code, or ``XTR`` for payments in |tg_stars|. - total_amount (:obj:`int`): Total price in the smallest units of the currency (integer, not - float/double). For example, for a price of US$ 1.45 pass ``amount = 145``. + total_amount (:obj:`int`): Total price in the smallest units of the currency (integer, + **not** float/double). For example, for a price of ``US$ 1.45`` pass ``amount = 145``. See the ``exp`` parameter in `currencies.json `_, it shows the number of digits past the decimal point for each currency @@ -54,8 +54,8 @@ class SuccessfulPayment(TelegramObject): Attributes: currency (:obj:`str`): Three-letter ISO 4217 currency code, or ``XTR`` for payments in |tg_stars|. - total_amount (:obj:`int`): Total price in the smallest units of the currency (integer, not - float/double). For example, for a price of US$ 1.45 ``amount`` is ``145``. + total_amount (:obj:`int`): Total price in the smallest units of the currency (integer, + **not** float/double). For example, for a price of ``US$ 1.45`` pass ``amount = 145``. See the ``exp`` parameter in `currencies.json `_, it shows the number of digits past the decimal point for each currency From f79c59ab549ea5e50bbf49aea70c854037723dd6 Mon Sep 17 00:00:00 2001 From: poolitzer Date: Fri, 5 Jul 2024 22:30:30 +0200 Subject: [PATCH 07/14] Fix: remove raw mention --- .github/CONTRIBUTING.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CONTRIBUTING.rst b/.github/CONTRIBUTING.rst index 635cdb23ebc..63906fabd6f 100644 --- a/.github/CONTRIBUTING.rst +++ b/.github/CONTRIBUTING.rst @@ -194,7 +194,7 @@ Feel free to copy (parts of) the checklist to the PR description to remind you o - Added or updated documentation for the changed class(es) and/or method(s) - Added the new method(s) to ``_extbot.py`` - Added or updated ``bot_methods.rst`` - - Updated the Bot API version number in all places: ``README.rst`` and ``README_RAW.rst`` (including the badge), as well as ``telegram.constants.BOT_API_VERSION_INFO`` + - Updated the Bot API version number in all places: ``README.rst`` (including the badge) and ``telegram.constants.BOT_API_VERSION_INFO`` - Added logic for arbitrary callback data in :class:`telegram.ext.ExtBot` for new methods that either accept a ``reply_markup`` in some form or have a return type that is/contains :class:`~telegram.Message` Documenting From 027263a223a13167d33d9f582a5c701ba860041b Mon Sep 17 00:00:00 2001 From: Hinrich Mahler <22366557+Bibo-Joshi@users.noreply.github.com> Date: Fri, 5 Jul 2024 22:46:54 +0200 Subject: [PATCH 08/14] Add missing "More about" links --- telegram/_message.py | 24 ++++++++++++++++++++++++ telegram/_reply.py | 12 ++++++++++++ 2 files changed, 36 insertions(+) diff --git a/telegram/_message.py b/telegram/_message.py index b0605cd094d..b3b38944d08 100644 --- a/telegram/_message.py +++ b/telegram/_message.py @@ -353,6 +353,9 @@ class Message(MaybeInaccessibleMessage): about the animation. For backward compatibility, when this field is set, the document field will also be set. game (:class:`telegram.Game`, optional): Message is a game, information about the game. + + .. seealso:: + `Telegram Docs on games `_ photo (Sequence[:class:`telegram.PhotoSize`], optional): Message is a photo, available sizes of the photo. This list is empty if the message does not contain a photo. @@ -423,10 +426,19 @@ class Message(MaybeInaccessibleMessage): :class:`telegram.InaccessibleMessage`. invoice (:class:`telegram.Invoice`, optional): Message is an invoice for a payment, information about the invoice. + + .. seealso:: + `Telegram Docs on payments `_ successful_payment (:class:`telegram.SuccessfulPayment`, optional): Message is a service message about a successful payment, information about the payment. + + .. seealso:: + `Telegram Docs on payments `_ connected_website (:obj:`str`, optional): The domain name of the website on which the user has logged in. + + .. seealso:: + `More about Telegram Login » `_ author_signature (:obj:`str`, optional): Signature of the post author for messages in channels, or the custom title of an anonymous group administrator. passport_data (:class:`telegram.PassportData`, optional): Telegram Passport data. @@ -656,6 +668,9 @@ class Message(MaybeInaccessibleMessage): .. seealso:: :wiki:`Working with Files and Media ` game (:class:`telegram.Game`): Optional. Message is a game, information about the game. + + .. seealso:: + `Telegram Docs on games `_ photo (Tuple[:class:`telegram.PhotoSize`]): Optional. Message is a photo, available sizes of the photo. This list is empty if the message does not contain a photo. @@ -735,10 +750,19 @@ class Message(MaybeInaccessibleMessage): :class:`telegram.InaccessibleMessage`. invoice (:class:`telegram.Invoice`): Optional. Message is an invoice for a payment, information about the invoice. + + .. seealso:: + `Telegram Docs on payments `_ successful_payment (:class:`telegram.SuccessfulPayment`): Optional. Message is a service message about a successful payment, information about the payment. + + .. seealso:: + `Telegram Docs on payments `_ connected_website (:obj:`str`): Optional. The domain name of the website on which the user has logged in. + + .. seealso:: + `More about Telegram Login » `_ author_signature (:obj:`str`): Optional. Signature of the post author for messages in channels, or the custom title of an anonymous group administrator. passport_data (:class:`telegram.PassportData`): Optional. Telegram Passport data. diff --git a/telegram/_reply.py b/telegram/_reply.py index 973cee5ddfe..3680b98b83b 100644 --- a/telegram/_reply.py +++ b/telegram/_reply.py @@ -90,12 +90,18 @@ class ExternalReplyInfo(TelegramObject): about the contact. dice (:class:`telegram.Dice`, optional): Message is a dice with random value. game (:Class:`telegram.Game`. optional): Message is a game, information about the game. + + .. seealso:: + `Telegram Docs on games `_ giveaway (:class:`telegram.Giveaway`, optional): Message is a scheduled giveaway, information about the giveaway. giveaway_winners (:class:`telegram.GiveawayWinners`, optional): A giveaway with public winners was completed. invoice (:class:`telegram.Invoice`, optional): Message is an invoice for a payment, information about the invoice. + + .. seealso:: + `Telegram Docs on payments `_ location (:class:`telegram.Location`, optional): Message is a shared location, information about the location. poll (:class:`telegram.Poll`, optional): Message is a native poll, information about the @@ -133,12 +139,18 @@ class ExternalReplyInfo(TelegramObject): about the contact. dice (:class:`telegram.Dice`): Optional. Message is a dice with random value. game (:Class:`telegram.Game`): Optional. Message is a game, information about the game. + + .. seealso:: + `Telegram Docs on games `_ giveaway (:class:`telegram.Giveaway`): Optional. Message is a scheduled giveaway, information about the giveaway. giveaway_winners (:class:`telegram.GiveawayWinners`): Optional. A giveaway with public winners was completed. invoice (:class:`telegram.Invoice`): Optional. Message is an invoice for a payment, information about the invoice. + + .. seealso:: + `Telegram Docs on payments `_ location (:class:`telegram.Location`): Optional. Message is a shared location, information about the location. poll (:class:`telegram.Poll`): Optional. Message is a native poll, information about the From bda5ef76eba5741d21da3fa5e8d25036c65ffe40 Mon Sep 17 00:00:00 2001 From: poolitzer Date: Sun, 7 Jul 2024 21:39:44 +0200 Subject: [PATCH 09/14] Fix: Whitespaces are important --- telegram/_message.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telegram/_message.py b/telegram/_message.py index b3b38944d08..9d86005d095 100644 --- a/telegram/_message.py +++ b/telegram/_message.py @@ -331,7 +331,7 @@ class Message(MaybeInaccessibleMessage): effect_id (:obj:`str`, optional): Unique identifier of the message effect added to the message. - ..versionadded:: 21.3 + .. versionadded:: 21.3 caption_entities (Sequence[:class:`telegram.MessageEntity`], optional): For messages with a Caption. Special entities like usernames, URLs, bot commands, etc. that appear in the From a469e196ff36f6c69689162fc9f12d3d9ef17024 Mon Sep 17 00:00:00 2001 From: poolitzer Date: Tue, 9 Jul 2024 16:37:26 +0200 Subject: [PATCH 10/14] Fix: Double dot --- telegram/_bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telegram/_bot.py b/telegram/_bot.py index a9f9c6ef935..ff1ccbb3766 100644 --- a/telegram/_bot.py +++ b/telegram/_bot.py @@ -3972,7 +3972,7 @@ async def edit_message_text( Use this method to edit text and game messages. Note: - * |editreplymarkup|. + * |editreplymarkup| * |bcid_edit_time| .. seealso:: :attr:`telegram.Game.text` From 941006a51afb9737364e6ae063541ec2494ac4c8 Mon Sep 17 00:00:00 2001 From: poolitzer Date: Tue, 9 Jul 2024 16:41:44 +0200 Subject: [PATCH 11/14] Fix: Another --- telegram/_inline/inlinekeyboardmarkup.py | 2 +- telegram/_replykeyboardmarkup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/telegram/_inline/inlinekeyboardmarkup.py b/telegram/_inline/inlinekeyboardmarkup.py index efb181e8aa5..6857e4d8e3a 100644 --- a/telegram/_inline/inlinekeyboardmarkup.py +++ b/telegram/_inline/inlinekeyboardmarkup.py @@ -42,7 +42,7 @@ class InlineKeyboardMarkup(TelegramObject): An inline keyboard on a message .. seealso:: - An another kind of keyboard would be the :class:`telegram.ReplyKeyboardMarkup`. + Another kind of keyboard would be the :class:`telegram.ReplyKeyboardMarkup`. Examples: * :any:`Inline Keyboard 1 ` diff --git a/telegram/_replykeyboardmarkup.py b/telegram/_replykeyboardmarkup.py index cfca12cc350..1b410ebc709 100644 --- a/telegram/_replykeyboardmarkup.py +++ b/telegram/_replykeyboardmarkup.py @@ -41,7 +41,7 @@ class ReplyKeyboardMarkup(TelegramObject): A reply keyboard with reply options. .. seealso:: - An another kind of keyboard would be the :class:`telegram.InlineKeyboardMarkup`. + Another kind of keyboard would be the :class:`telegram.InlineKeyboardMarkup`. Examples: * Example usage: A user requests to change the bot's language, bot replies to the request From eca733db0404ec8dbf4d543c79a809388366de23 Mon Sep 17 00:00:00 2001 From: poolitzer Date: Tue, 9 Jul 2024 16:48:55 +0200 Subject: [PATCH 12/14] Fix: move information link to inline --- telegram/_message.py | 34 ++++++++++------------------------ telegram/_reply.py | 22 ++++++---------------- 2 files changed, 16 insertions(+), 40 deletions(-) diff --git a/telegram/_message.py b/telegram/_message.py index 90eb2cce374..1d7c848b5a1 100644 --- a/telegram/_message.py +++ b/telegram/_message.py @@ -357,10 +357,8 @@ class Message(MaybeInaccessibleMessage): animation (:class:`telegram.Animation`, optional): Message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set. - game (:class:`telegram.Game`, optional): Message is a game, information about the game. - - .. seealso:: - `Telegram Docs on games `_ + game (:class:`telegram.Game`, optional): Message is a game, + `information about the game `_. photo (Sequence[:class:`telegram.PhotoSize`], optional): Message is a photo, available sizes of the photo. This list is empty if the message does not contain a photo. @@ -431,15 +429,10 @@ class Message(MaybeInaccessibleMessage): This attribute now is either :class:`telegram.Message` or :class:`telegram.InaccessibleMessage`. invoice (:class:`telegram.Invoice`, optional): Message is an invoice for a payment, - information about the invoice. - - .. seealso:: - `Telegram Docs on payments `_ + `information about the invoice `_. successful_payment (:class:`telegram.SuccessfulPayment`, optional): Message is a service - message about a successful payment, information about the payment. - - .. seealso:: - `Telegram Docs on payments `_ + message about a successful payment, + `information about the payment `_. connected_website (:obj:`str`, optional): The domain name of the website on which the user has logged in. @@ -681,10 +674,8 @@ class Message(MaybeInaccessibleMessage): field will also be set. .. seealso:: :wiki:`Working with Files and Media ` - game (:class:`telegram.Game`): Optional. Message is a game, information about the game. - - .. seealso:: - `Telegram Docs on games `_ + game (:class:`telegram.Game`): Optional. Message is a game, + `information about the game `_. photo (Tuple[:class:`telegram.PhotoSize`]): Optional. Message is a photo, available sizes of the photo. This list is empty if the message does not contain a photo. @@ -764,15 +755,10 @@ class Message(MaybeInaccessibleMessage): This attribute now is either :class:`telegram.Message` or :class:`telegram.InaccessibleMessage`. invoice (:class:`telegram.Invoice`): Optional. Message is an invoice for a payment, - information about the invoice. - - .. seealso:: - `Telegram Docs on payments `_ + `information about the invoice `_. successful_payment (:class:`telegram.SuccessfulPayment`): Optional. Message is a service - message about a successful payment, information about the payment. - - .. seealso:: - `Telegram Docs on payments `_ + message about a successful payment, + `information about the payment `_. connected_website (:obj:`str`): Optional. The domain name of the website on which the user has logged in. diff --git a/telegram/_reply.py b/telegram/_reply.py index 84576e8be5f..6572dae1e65 100644 --- a/telegram/_reply.py +++ b/telegram/_reply.py @@ -90,19 +90,14 @@ class ExternalReplyInfo(TelegramObject): contact (:class:`telegram.Contact`, optional): Message is a shared contact, information about the contact. dice (:class:`telegram.Dice`, optional): Message is a dice with random value. - game (:Class:`telegram.Game`. optional): Message is a game, information about the game. - - .. seealso:: - `Telegram Docs on games `_ + game (:Class:`telegram.Game`. optional): Message is a game, + `information about the game `_. giveaway (:class:`telegram.Giveaway`, optional): Message is a scheduled giveaway, information about the giveaway. giveaway_winners (:class:`telegram.GiveawayWinners`, optional): A giveaway with public winners was completed. invoice (:class:`telegram.Invoice`, optional): Message is an invoice for a payment, - information about the invoice. - - .. seealso:: - `Telegram Docs on payments `_ + `information about the invoice `_. location (:class:`telegram.Location`, optional): Message is a shared location, information about the location. poll (:class:`telegram.Poll`, optional): Message is a native poll, information about the @@ -143,19 +138,14 @@ class ExternalReplyInfo(TelegramObject): contact (:class:`telegram.Contact`): Optional. Message is a shared contact, information about the contact. dice (:class:`telegram.Dice`): Optional. Message is a dice with random value. - game (:Class:`telegram.Game`): Optional. Message is a game, information about the game. - - .. seealso:: - `Telegram Docs on games `_ + game (:Class:`telegram.Game`): Optional. Message is a game, + `information about the game `_. giveaway (:class:`telegram.Giveaway`): Optional. Message is a scheduled giveaway, information about the giveaway. giveaway_winners (:class:`telegram.GiveawayWinners`): Optional. A giveaway with public winners was completed. invoice (:class:`telegram.Invoice`): Optional. Message is an invoice for a payment, - information about the invoice. - - .. seealso:: - `Telegram Docs on payments `_ + `information about the invoice `_. location (:class:`telegram.Location`): Optional. Message is a shared location, information about the location. poll (:class:`telegram.Poll`): Optional. Message is a native poll, information about the From 0b764139817d2ec0a46443adc95eae12b44157e2 Mon Sep 17 00:00:00 2001 From: poolitzer Date: Tue, 9 Jul 2024 17:11:03 +0200 Subject: [PATCH 13/14] Fix: move information link to inline and also more aligning --- telegram/_message.py | 36 ++++++++++++++++++------------------ telegram/_reply.py | 24 ++++++++++++++---------- 2 files changed, 32 insertions(+), 28 deletions(-) diff --git a/telegram/_message.py b/telegram/_message.py index 1d7c848b5a1..6bcf154db1e 100644 --- a/telegram/_message.py +++ b/telegram/_message.py @@ -357,8 +357,8 @@ class Message(MaybeInaccessibleMessage): animation (:class:`telegram.Animation`, optional): Message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set. - game (:class:`telegram.Game`, optional): Message is a game, - `information about the game `_. + game (:class:`telegram.Game`, optional): Message is a game, information about the game. + `More about games >> `_. photo (Sequence[:class:`telegram.PhotoSize`], optional): Message is a photo, available sizes of the photo. This list is empty if the message does not contain a photo. @@ -374,7 +374,8 @@ class Message(MaybeInaccessibleMessage): video. voice (:class:`telegram.Voice`, optional): Message is a voice message, information about the file. - video_note (:class:`telegram.VideoNote`, optional): Message is a video note, information + video_note (:class:`telegram.VideoNote`, optional): Message is a + `video note `_, information about the video message. new_chat_members (Sequence[:class:`telegram.User`], optional): New members that were added to the group or supergroup and information about them (the bot itself may be one of @@ -429,15 +430,14 @@ class Message(MaybeInaccessibleMessage): This attribute now is either :class:`telegram.Message` or :class:`telegram.InaccessibleMessage`. invoice (:class:`telegram.Invoice`, optional): Message is an invoice for a payment, - `information about the invoice `_. + information about the invoice. + `More about payments >> `_. successful_payment (:class:`telegram.SuccessfulPayment`, optional): Message is a service - message about a successful payment, - `information about the payment `_. + message about a successful payment, information about the payment. + `More about payments >> `_. connected_website (:obj:`str`, optional): The domain name of the website on which the user has logged in. - - .. seealso:: - `More about Telegram Login » `_ + `More about Telegram Login >> `_. author_signature (:obj:`str`, optional): Signature of the post author for messages in channels, or the custom title of an anonymous group administrator. passport_data (:class:`telegram.PassportData`, optional): Telegram Passport data. @@ -674,8 +674,8 @@ class Message(MaybeInaccessibleMessage): field will also be set. .. seealso:: :wiki:`Working with Files and Media ` - game (:class:`telegram.Game`): Optional. Message is a game, - `information about the game `_. + game (:class:`telegram.Game`): Optional. Message is a game, information about the game. + `More about games >> `_. photo (Tuple[:class:`telegram.PhotoSize`]): Optional. Message is a photo, available sizes of the photo. This list is empty if the message does not contain a photo. @@ -699,7 +699,8 @@ class Message(MaybeInaccessibleMessage): the file. .. seealso:: :wiki:`Working with Files and Media ` - video_note (:class:`telegram.VideoNote`): Optional. Message is a video note, information + video_note (:class:`telegram.VideoNote`): Optional. Message is a + `video note `_, information about the video message. .. seealso:: :wiki:`Working with Files and Media ` @@ -755,15 +756,14 @@ class Message(MaybeInaccessibleMessage): This attribute now is either :class:`telegram.Message` or :class:`telegram.InaccessibleMessage`. invoice (:class:`telegram.Invoice`): Optional. Message is an invoice for a payment, - `information about the invoice `_. + information about the invoice. + `More about payments >> `_. successful_payment (:class:`telegram.SuccessfulPayment`): Optional. Message is a service - message about a successful payment, - `information about the payment `_. + message about a successful payment, information about the payment. + `More about payments >> `_. connected_website (:obj:`str`): Optional. The domain name of the website on which the user has logged in. - - .. seealso:: - `More about Telegram Login » `_ + `More about Telegram Login >> `_. author_signature (:obj:`str`): Optional. Signature of the post author for messages in channels, or the custom title of an anonymous group administrator. passport_data (:class:`telegram.PassportData`): Optional. Telegram Passport data. diff --git a/telegram/_reply.py b/telegram/_reply.py index 6572dae1e65..2aefa15085a 100644 --- a/telegram/_reply.py +++ b/telegram/_reply.py @@ -81,8 +81,9 @@ class ExternalReplyInfo(TelegramObject): sticker. story (:class:`telegram.Story`, optional): Message is a forwarded story. video (:class:`telegram.Video`, optional): Message is a video, information about the video. - video_note (:class:`telegram.VideoNote`, optional): Message is a video note, information - about the video message. + video_note (:class:`telegram.VideoNote`, optional): Message is a `video note + `_, information about the video + message. voice (:class:`telegram.Voice`, optional): Message is a voice message, information about the file. has_media_spoiler (:obj:`bool`, optional): :obj:`True`, if the message media is covered by @@ -90,14 +91,15 @@ class ExternalReplyInfo(TelegramObject): contact (:class:`telegram.Contact`, optional): Message is a shared contact, information about the contact. dice (:class:`telegram.Dice`, optional): Message is a dice with random value. - game (:Class:`telegram.Game`. optional): Message is a game, - `information about the game `_. + game (:Class:`telegram.Game`. optional): Message is a game, information about the game. + `More about games >> `_. giveaway (:class:`telegram.Giveaway`, optional): Message is a scheduled giveaway, information about the giveaway. giveaway_winners (:class:`telegram.GiveawayWinners`, optional): A giveaway with public winners was completed. invoice (:class:`telegram.Invoice`, optional): Message is an invoice for a payment, - `information about the invoice `_. + information about the invoice. `More about payments >> + `_. location (:class:`telegram.Location`, optional): Message is a shared location, information about the location. poll (:class:`telegram.Poll`, optional): Message is a native poll, information about the @@ -129,8 +131,9 @@ class ExternalReplyInfo(TelegramObject): sticker. story (:class:`telegram.Story`): Optional. Message is a forwarded story. video (:class:`telegram.Video`): Optional. Message is a video, information about the video. - video_note (:class:`telegram.VideoNote`): Optional. Message is a video note, information - about the video message. + video_note (:class:`telegram.VideoNote`): Optional. Message is a `video note + `_, information about the video + message. voice (:class:`telegram.Voice`): Optional. Message is a voice message, information about the file. has_media_spoiler (:obj:`bool`): Optional. :obj:`True`, if the message media is covered by @@ -138,14 +141,15 @@ class ExternalReplyInfo(TelegramObject): contact (:class:`telegram.Contact`): Optional. Message is a shared contact, information about the contact. dice (:class:`telegram.Dice`): Optional. Message is a dice with random value. - game (:Class:`telegram.Game`): Optional. Message is a game, - `information about the game `_. + game (:Class:`telegram.Game`): Optional. Message is a game, information about the game. + `More about games >> `_. giveaway (:class:`telegram.Giveaway`): Optional. Message is a scheduled giveaway, information about the giveaway. giveaway_winners (:class:`telegram.GiveawayWinners`): Optional. A giveaway with public winners was completed. invoice (:class:`telegram.Invoice`): Optional. Message is an invoice for a payment, - `information about the invoice `_. + information about the invoice. `More about payments >> + `_. location (:class:`telegram.Location`): Optional. Message is a shared location, information about the location. poll (:class:`telegram.Poll`): Optional. Message is a native poll, information about the From 73193cd7e1aa332d17f843a51463119687c6d0df Mon Sep 17 00:00:00 2001 From: poolitzer Date: Tue, 9 Jul 2024 17:13:17 +0200 Subject: [PATCH 14/14] Fix: move more information link to inline --- telegram/_keyboardbuttonrequest.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/telegram/_keyboardbuttonrequest.py b/telegram/_keyboardbuttonrequest.py index 07f2c3a99aa..4416952112e 100644 --- a/telegram/_keyboardbuttonrequest.py +++ b/telegram/_keyboardbuttonrequest.py @@ -30,15 +30,12 @@ class KeyboardButtonRequestUsers(TelegramObject): """This object defines the criteria used to request a suitable user. The identifier of the - selected user will be shared with the bot when the corresponding button is pressed. + selected user will be shared with the bot when the corresponding button is pressed. `More + about requesting users » `_. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`request_id` is equal. - .. seealso:: - `Telegram Docs on requesting users \ - `_ - .. versionadded:: 20.8 This class was previously named ``KeyboardButtonRequestUser``. @@ -136,15 +133,12 @@ def __init__( class KeyboardButtonRequestChat(TelegramObject): """This object defines the criteria used to request a suitable chat. The identifier of the - selected user will be shared with the bot when the corresponding button is pressed. + selected user will be shared with the bot when the corresponding button is pressed. `More + about requesting users » `_. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`request_id` is equal. - .. seealso:: - `Telegram Docs on requesting chats \ - `_ - .. versionadded:: 20.1 Args: