From 24e5217e32412b925680373792e4356dd2a599be Mon Sep 17 00:00:00 2001 From: Hinrich Mahler Date: Tue, 2 Feb 2021 21:15:58 +0100 Subject: [PATCH 01/19] Improve some badges for PTB-Raw --- README_RAW.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README_RAW.rst b/README_RAW.rst index 483c77ce7ad..52844d5b1aa 100644 --- a/README_RAW.rst +++ b/README_RAW.rst @@ -13,11 +13,11 @@ We have a vibrant community of developers helping each other in our `Telegram gr *Stay tuned for library updates and new releases on our* `Telegram Channel `_. .. image:: https://img.shields.io/pypi/v/python-telegram-bot-raw.svg - :target: https://pypi.org/project/python-telegram-bot/ + :target: https://pypi.org/project/python-telegram-bot-raw/ :alt: PyPi Package Version .. image:: https://img.shields.io/pypi/pyversions/python-telegram-bot-raw.svg - :target: https://pypi.org/project/python-telegram-bot/ + :target: https://pypi.org/project/python-telegram-bot-raw/ :alt: Supported Python versions .. image:: https://img.shields.io/badge/Bot%20API-5.0-blue?logo=telegram @@ -25,10 +25,10 @@ We have a vibrant community of developers helping each other in our `Telegram gr :alt: Supported Bot API versions .. image:: https://img.shields.io/pypi/dm/python-telegram-bot-raw - :target: https://pypistats.org/packages/python-telegram-bot + :target: https://pypistats.org/packages/python-telegram-bot-raw :alt: PyPi Package Monthly Download -.. image:: https://img.shields.io/badge/docs-latest-af1a97.svg +.. image:: https://readthedocs.org/projects/python-telegram-bot/badge/?version=stable :target: https://python-telegram-bot.readthedocs.io/ :alt: Documentation Status From 6359bd99c16bd5ef08cd53a1e2ab2a3318f23f5c Mon Sep 17 00:00:00 2001 From: Hinrich Mahler Date: Wed, 3 Feb 2021 08:29:25 +0100 Subject: [PATCH 02/19] doc fix for add_error_handler --- telegram/ext/dispatcher.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telegram/ext/dispatcher.py b/telegram/ext/dispatcher.py index ba52c53e7f6..7d427a8b74e 100644 --- a/telegram/ext/dispatcher.py +++ b/telegram/ext/dispatcher.py @@ -619,7 +619,7 @@ def add_error_handler( callback (:obj:`callable`): The callback function for this error handler. Will be called when an error is raised. Callback signature for context based API: - ``def callback(update: Update, context: CallbackContext)`` + ``def callback(update: object, context: CallbackContext)`` The error that happened will be present in context.error. run_async (:obj:`bool`, optional): Whether this handlers callback should be run From 56b5084c6d43f216c9f6d45da592806a4714e35c Mon Sep 17 00:00:00 2001 From: Hinrich Mahler Date: Mon, 8 Feb 2021 07:45:55 +0100 Subject: [PATCH 03/19] Some rendering --- telegram/ext/dispatcher.py | 2 +- telegram/inline/inlinequery.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/telegram/ext/dispatcher.py b/telegram/ext/dispatcher.py index 7d427a8b74e..ed20a6148bb 100644 --- a/telegram/ext/dispatcher.py +++ b/telegram/ext/dispatcher.py @@ -80,7 +80,7 @@ def async_func(*args: object, **kwargs: object) -> object: class DispatcherHandlerStop(Exception): """ - Raise this in handler to prevent execution any other handler (even in different group). + Raise this in handler to prevent execution of any other handler (even in different group). In order to use this exception in a :class:`telegram.ext.ConversationHandler`, pass the optional ``state`` parameter instead of returning the next state: diff --git a/telegram/inline/inlinequery.py b/telegram/inline/inlinequery.py index c25b4cfceff..e6fa6dc6b56 100644 --- a/telegram/inline/inlinequery.py +++ b/telegram/inline/inlinequery.py @@ -120,11 +120,11 @@ def answer( Args: auto_pagination (:obj:`bool`, optional): If set to :obj:`True`, :attr:`offset` will be - passed as :attr:`current_offset` to :meth:telegram.Bot.answer_inline_query`. + passed as :attr:`current_offset` to :meth:`telegram.Bot.answer_inline_query`. Defaults to :obj:`False`. Raises: - TypeError: If both :attr:`current_offset` and `auto_pagination` are supplied. + TypeError: If both :attr:`current_offset` and attr:`auto_pagination` are supplied. """ if current_offset and auto_pagination: # We raise TypeError instead of ValueError for backwards compatibility with versions From f9ee1263f21555732127b2d6aa2966ea9ebe1b26 Mon Sep 17 00:00:00 2001 From: Hinrich Mahler Date: Sun, 28 Feb 2021 23:39:57 +0100 Subject: [PATCH 04/19] Bump sphinx dependency --- docs/requirements-docs.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements-docs.txt b/docs/requirements-docs.txt index 14472252ae9..ddec259b3f5 100644 --- a/docs/requirements-docs.txt +++ b/docs/requirements-docs.txt @@ -1,3 +1,3 @@ -sphinx>=1.7.9 +sphinx==3.5.1 sphinx_rtd_theme sphinx-pypi-upload From 8433c7ff74e7d76997fce3d9244bbd100e284725 Mon Sep 17 00:00:00 2001 From: Hinrich Mahler Date: Mon, 1 Mar 2021 00:04:52 +0100 Subject: [PATCH 05/19] Change signature annotation setting --- docs/source/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index fd74c3a0291..4933b9ad6df 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -35,7 +35,7 @@ ] # Don't show type hints in the signature - that just makes it hardly readable # and we document the types anyway -autodoc_typehints = 'description' +autodoc_typehints = 'none' # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] From ba04e5aaf96cd4cb71235372e9dae974c8ceb5d0 Mon Sep 17 00:00:00 2001 From: poolitzer <25934244+Poolitzer@users.noreply.github.com> Date: Mon, 1 Mar 2021 20:52:16 +0100 Subject: [PATCH 06/19] fix: chat_id can be string, message_id only int --- telegram/bot.py | 84 +++++++++++++++++++-------------------- telegram/callbackquery.py | 2 +- telegram/chat.py | 46 ++++++++++----------- telegram/message.py | 50 +++++++++++------------ telegram/user.py | 46 ++++++++++----------- 5 files changed, 113 insertions(+), 115 deletions(-) diff --git a/telegram/bot.py b/telegram/bot.py index b76e1b1720a..5b67a1ddb45 100644 --- a/telegram/bot.py +++ b/telegram/bot.py @@ -263,7 +263,7 @@ def _message( self, endpoint: str, data: JSONDict, - reply_to_message_id: Union[str, int] = None, + reply_to_message_id: int = None, disable_notification: ODVInput[bool] = DEFAULT_NONE, reply_markup: ReplyMarkup = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, @@ -418,7 +418,7 @@ def send_message( parse_mode: ODVInput[str] = DEFAULT_NONE, disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, @@ -486,7 +486,7 @@ def send_message( def delete_message( self, chat_id: Union[str, int], - message_id: Union[str, int], + message_id: int, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, ) -> bool: @@ -532,7 +532,7 @@ def forward_message( self, chat_id: Union[int, str], from_chat_id: Union[str, int], - message_id: Union[str, int], + message_id: int, disable_notification: DVInput[bool] = DEFAULT_NONE, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, @@ -580,11 +580,11 @@ def forward_message( @log def send_photo( self, - chat_id: int, + chat_id: Union[int, str], photo: Union[FileInput, 'PhotoSize'], caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, timeout: DVInput[float] = DEFAULT_20, parse_mode: ODVInput[str] = DEFAULT_NONE, @@ -677,7 +677,7 @@ def send_audio( title: str = None, caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, timeout: DVInput[float] = DEFAULT_20, parse_mode: ODVInput[str] = DEFAULT_NONE, @@ -796,7 +796,7 @@ def send_document( filename: str = None, caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, timeout: DVInput[float] = DEFAULT_20, parse_mode: ODVInput[str] = DEFAULT_NONE, @@ -903,7 +903,7 @@ def send_sticker( chat_id: Union[int, str], sticker: Union[FileInput, 'Sticker'], disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, timeout: DVInput[float] = DEFAULT_20, api_kwargs: JSONDict = None, @@ -969,7 +969,7 @@ def send_video( duration: int = None, caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, timeout: DVInput[float] = DEFAULT_20, width: int = None, @@ -1095,7 +1095,7 @@ def send_video_note( duration: int = None, length: int = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, timeout: DVInput[float] = DEFAULT_20, thumb: FileInput = None, @@ -1198,7 +1198,7 @@ def send_animation( caption: str = None, parse_mode: ODVInput[str] = DEFAULT_NONE, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, timeout: DVInput[float] = DEFAULT_20, api_kwargs: JSONDict = None, @@ -1311,7 +1311,7 @@ def send_voice( duration: int = None, caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, timeout: DVInput[float] = DEFAULT_20, parse_mode: ODVInput[str] = DEFAULT_NONE, @@ -1409,7 +1409,7 @@ def send_media_group( Union['InputMediaAudio', 'InputMediaDocument', 'InputMediaPhoto', 'InputMediaVideo'] ], disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, timeout: DVInput[float] = DEFAULT_20, api_kwargs: JSONDict = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, @@ -1466,7 +1466,7 @@ def send_location( latitude: float = None, longitude: float = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, location: Location = None, @@ -1559,8 +1559,8 @@ def send_location( def edit_message_live_location( self, chat_id: Union[str, int] = None, - message_id: Union[str, int] = None, - inline_message_id: Union[str, int] = None, + message_id: int = None, + inline_message_id: int = None, latitude: float = None, longitude: float = None, location: Location = None, @@ -1648,8 +1648,8 @@ def edit_message_live_location( def stop_message_live_location( self, chat_id: Union[str, int] = None, - message_id: Union[str, int] = None, - inline_message_id: Union[str, int] = None, + message_id: int = None, + inline_message_id: int = None, reply_markup: InlineKeyboardMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, @@ -1704,7 +1704,7 @@ def send_venue( address: str = None, foursquare_id: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, venue: Venue = None, @@ -1814,7 +1814,7 @@ def send_contact( first_name: str = None, last_name: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, contact: Contact = None, @@ -1898,7 +1898,7 @@ def send_game( chat_id: Union[int, str], game_short_name: str, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: InlineKeyboardMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, @@ -2409,8 +2409,8 @@ def edit_message_text( self, text: str, chat_id: Union[str, int] = None, - message_id: Union[str, int] = None, - inline_message_id: Union[str, int] = None, + message_id: int = None, + inline_message_id: int = None, parse_mode: ODVInput[str] = DEFAULT_NONE, disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE, reply_markup: InlineKeyboardMarkup = None, @@ -2480,8 +2480,8 @@ def edit_message_text( def edit_message_caption( self, chat_id: Union[str, int] = None, - message_id: Union[str, int] = None, - inline_message_id: Union[str, int] = None, + message_id: int = None, + inline_message_id: int = None, caption: str = None, reply_markup: InlineKeyboardMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, @@ -2555,8 +2555,8 @@ def edit_message_caption( def edit_message_media( self, chat_id: Union[str, int] = None, - message_id: Union[str, int] = None, - inline_message_id: Union[str, int] = None, + message_id: int = None, + inline_message_id: int = None, media: 'InputMedia' = None, reply_markup: InlineKeyboardMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, @@ -2622,8 +2622,8 @@ def edit_message_media( def edit_message_reply_markup( self, chat_id: Union[str, int] = None, - message_id: Union[str, int] = None, - inline_message_id: Union[str, int] = None, + message_id: int = None, + inline_message_id: int = None, reply_markup: Optional['InlineKeyboardMarkup'] = None, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, @@ -3140,8 +3140,8 @@ def set_game_score( user_id: Union[int, str], score: int, chat_id: Union[str, int] = None, - message_id: Union[str, int] = None, - inline_message_id: Union[str, int] = None, + message_id: int = None, + inline_message_id: int = None, force: bool = None, disable_edit_message: bool = None, timeout: ODVInput[float] = DEFAULT_NONE, @@ -3203,8 +3203,8 @@ def get_game_high_scores( self, user_id: Union[int, str], chat_id: Union[str, int] = None, - message_id: Union[str, int] = None, - inline_message_id: Union[str, int] = None, + message_id: int = None, + inline_message_id: int = None, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, ) -> List[GameHighScore]: @@ -3267,7 +3267,7 @@ def send_invoice( need_shipping_address: bool = None, is_flexible: bool = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: InlineKeyboardMarkup = None, provider_data: Union[str, object] = None, send_phone_number_to_provider: bool = None, @@ -3915,7 +3915,7 @@ def set_chat_description( def pin_chat_message( self, chat_id: Union[str, int], - message_id: Union[str, int], + message_id: int, disable_notification: ODVInput[bool] = DEFAULT_NONE, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, @@ -3962,7 +3962,7 @@ def unpin_chat_message( chat_id: Union[str, int], timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - message_id: Union[str, int] = None, + message_id: int = None, ) -> bool: """ Use this method to remove a message from the list of pinned messages in a chat. If the @@ -4446,7 +4446,7 @@ def send_poll( correct_option_id: int = None, is_closed: bool = None, disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, explanation: str = None, @@ -4559,7 +4559,7 @@ def send_poll( def stop_poll( self, chat_id: Union[int, str], - message_id: Union[int, str], + message_id: int, reply_markup: InlineKeyboardMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, @@ -4606,7 +4606,7 @@ def send_dice( self, chat_id: Union[int, str], disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, emoji: str = None, @@ -4779,12 +4779,12 @@ def copy_message( self, chat_id: Union[int, str], from_chat_id: Union[str, int], - message_id: Union[str, int], + message_id: int, caption: str = None, parse_mode: ODVInput[str] = DEFAULT_NONE, caption_entities: Union[Tuple['MessageEntity', ...], List['MessageEntity']] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE, reply_markup: ReplyMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, diff --git a/telegram/callbackquery.py b/telegram/callbackquery.py index 3bafb8d31c9..261cf4e6a60 100644 --- a/telegram/callbackquery.py +++ b/telegram/callbackquery.py @@ -598,7 +598,7 @@ def copy_message( parse_mode: ODVInput[str] = DEFAULT_NONE, caption_entities: Union[Tuple['MessageEntity', ...], List['MessageEntity']] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE, reply_markup: ReplyMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, diff --git a/telegram/chat.py b/telegram/chat.py index aa9cbc31d3e..640aea1e9ed 100644 --- a/telegram/chat.py +++ b/telegram/chat.py @@ -496,7 +496,7 @@ def set_administrator_custom_title( def pin_message( self, - message_id: Union[str, int], + message_id: int, disable_notification: ODVInput[bool] = DEFAULT_NONE, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, @@ -526,7 +526,7 @@ def unpin_message( self, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - message_id: Union[str, int] = None, + message_id: int = None, ) -> bool: """Shortcut for:: @@ -578,7 +578,7 @@ def send_message( parse_mode: ODVInput[str] = DEFAULT_NONE, disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: 'ReplyMarkup' = None, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, @@ -615,7 +615,7 @@ def send_media_group( Union['InputMediaAudio', 'InputMediaDocument', 'InputMediaPhoto', 'InputMediaVideo'] ], disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, timeout: DVInput[float] = DEFAULT_20, api_kwargs: JSONDict = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, @@ -671,7 +671,7 @@ def send_photo( photo: Union[FileInput, 'PhotoSize'], caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: 'ReplyMarkup' = None, timeout: DVInput[float] = DEFAULT_20, parse_mode: ODVInput[str] = DEFAULT_NONE, @@ -711,7 +711,7 @@ def send_contact( first_name: str = None, last_name: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: 'ReplyMarkup' = None, timeout: ODVInput[float] = DEFAULT_NONE, contact: 'Contact' = None, @@ -752,7 +752,7 @@ def send_audio( title: str = None, caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: 'ReplyMarkup' = None, timeout: DVInput[float] = DEFAULT_20, parse_mode: ODVInput[str] = DEFAULT_NONE, @@ -797,7 +797,7 @@ def send_document( filename: str = None, caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: 'ReplyMarkup' = None, timeout: DVInput[float] = DEFAULT_20, parse_mode: ODVInput[str] = DEFAULT_NONE, @@ -837,7 +837,7 @@ def send_document( def send_dice( self, disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: 'ReplyMarkup' = None, timeout: ODVInput[float] = DEFAULT_NONE, emoji: str = None, @@ -869,7 +869,7 @@ def send_game( self, game_short_name: str, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: 'InlineKeyboardMarkup' = None, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, @@ -915,7 +915,7 @@ def send_invoice( need_shipping_address: bool = None, is_flexible: bool = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: 'InlineKeyboardMarkup' = None, provider_data: Union[str, object] = None, send_phone_number_to_provider: bool = None, @@ -968,7 +968,7 @@ def send_location( latitude: float = None, longitude: float = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: 'ReplyMarkup' = None, timeout: ODVInput[float] = DEFAULT_NONE, location: 'Location' = None, @@ -1016,7 +1016,7 @@ def send_animation( caption: str = None, parse_mode: ODVInput[str] = DEFAULT_NONE, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: 'ReplyMarkup' = None, timeout: DVInput[float] = DEFAULT_20, api_kwargs: JSONDict = None, @@ -1057,7 +1057,7 @@ def send_sticker( self, sticker: Union[FileInput, 'Sticker'], disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: 'ReplyMarkup' = None, timeout: DVInput[float] = DEFAULT_20, api_kwargs: JSONDict = None, @@ -1092,7 +1092,7 @@ def send_venue( address: str = None, foursquare_id: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: 'ReplyMarkup' = None, timeout: ODVInput[float] = DEFAULT_NONE, venue: 'Venue' = None, @@ -1137,7 +1137,7 @@ def send_video( duration: int = None, caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: 'ReplyMarkup' = None, timeout: DVInput[float] = DEFAULT_20, width: int = None, @@ -1186,7 +1186,7 @@ def send_video_note( duration: int = None, length: int = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: 'ReplyMarkup' = None, timeout: DVInput[float] = DEFAULT_20, thumb: FileInput = None, @@ -1225,7 +1225,7 @@ def send_voice( duration: int = None, caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: 'ReplyMarkup' = None, timeout: DVInput[float] = DEFAULT_20, parse_mode: ODVInput[str] = DEFAULT_NONE, @@ -1271,7 +1271,7 @@ def send_poll( correct_option_id: int = None, is_closed: bool = None, disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: 'ReplyMarkup' = None, timeout: ODVInput[float] = DEFAULT_NONE, explanation: str = None, @@ -1317,12 +1317,12 @@ def send_poll( def send_copy( self, from_chat_id: Union[str, int], - message_id: Union[str, int], + message_id: int, caption: str = None, parse_mode: ODVInput[str] = DEFAULT_NONE, caption_entities: Union[Tuple['MessageEntity', ...], List['MessageEntity']] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE, reply_markup: 'ReplyMarkup' = None, timeout: ODVInput[float] = DEFAULT_NONE, @@ -1356,12 +1356,12 @@ def send_copy( def copy_message( self, chat_id: Union[int, str], - message_id: Union[str, int], + message_id: int, caption: str = None, parse_mode: ODVInput[str] = DEFAULT_NONE, caption_entities: Union[Tuple['MessageEntity', ...], List['MessageEntity']] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE, reply_markup: 'ReplyMarkup' = None, timeout: ODVInput[float] = DEFAULT_NONE, diff --git a/telegram/message.py b/telegram/message.py index 92fc529a15a..7d93dc945da 100644 --- a/telegram/message.py +++ b/telegram/message.py @@ -581,9 +581,7 @@ def to_dict(self) -> JSONDict: return data - def _quote( - self, quote: Optional[bool], reply_to_message_id: Optional[Union[int, str]] - ) -> Optional[Union[int, str]]: + def _quote(self, quote: Optional[bool], reply_to_message_id: Optional[int]) -> Optional[int]: """Modify kwargs for replying with or without quoting.""" if reply_to_message_id is not None: return reply_to_message_id @@ -608,7 +606,7 @@ def reply_text( parse_mode: ODVInput[str] = DEFAULT_NONE, disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, @@ -652,7 +650,7 @@ def reply_markdown( text: str, disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, @@ -706,7 +704,7 @@ def reply_markdown_v2( text: str, disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, @@ -756,7 +754,7 @@ def reply_html( text: str, disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, @@ -807,7 +805,7 @@ def reply_media_group( Union['InputMediaAudio', 'InputMediaDocument', 'InputMediaPhoto', 'InputMediaVideo'] ], disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, timeout: DVInput[float] = DEFAULT_20, api_kwargs: JSONDict = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, @@ -847,7 +845,7 @@ def reply_photo( photo: Union[FileInput, 'PhotoSize'], caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, timeout: DVInput[float] = DEFAULT_20, parse_mode: ODVInput[str] = DEFAULT_NONE, @@ -897,7 +895,7 @@ def reply_audio( title: str = None, caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, timeout: DVInput[float] = DEFAULT_20, parse_mode: ODVInput[str] = DEFAULT_NONE, @@ -950,7 +948,7 @@ def reply_document( filename: str = None, caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, timeout: DVInput[float] = DEFAULT_20, parse_mode: ODVInput[str] = DEFAULT_NONE, @@ -1005,7 +1003,7 @@ def reply_animation( caption: str = None, parse_mode: ODVInput[str] = DEFAULT_NONE, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, timeout: DVInput[float] = DEFAULT_20, api_kwargs: JSONDict = None, @@ -1054,7 +1052,7 @@ def reply_sticker( self, sticker: Union[FileInput, 'Sticker'], disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, timeout: DVInput[float] = DEFAULT_20, api_kwargs: JSONDict = None, @@ -1095,7 +1093,7 @@ def reply_video( duration: int = None, caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, timeout: DVInput[float] = DEFAULT_20, width: int = None, @@ -1152,7 +1150,7 @@ def reply_video_note( duration: int = None, length: int = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, timeout: DVInput[float] = DEFAULT_20, thumb: FileInput = None, @@ -1199,7 +1197,7 @@ def reply_voice( duration: int = None, caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, timeout: DVInput[float] = DEFAULT_20, parse_mode: ODVInput[str] = DEFAULT_NONE, @@ -1247,7 +1245,7 @@ def reply_location( latitude: float = None, longitude: float = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, location: Location = None, @@ -1301,7 +1299,7 @@ def reply_venue( address: str = None, foursquare_id: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, venue: Venue = None, @@ -1354,7 +1352,7 @@ def reply_contact( first_name: str = None, last_name: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, contact: Contact = None, @@ -1405,7 +1403,7 @@ def reply_poll( correct_option_id: int = None, is_closed: bool = None, disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, explanation: str = None, @@ -1459,7 +1457,7 @@ def reply_poll( def reply_dice( self, disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, emoji: str = None, @@ -1524,7 +1522,7 @@ def reply_game( self, game_short_name: str, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: 'InlineKeyboardMarkup' = None, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, @@ -1580,7 +1578,7 @@ def reply_invoice( need_shipping_address: bool = None, is_flexible: bool = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: 'InlineKeyboardMarkup' = None, provider_data: Union[str, object] = None, send_phone_number_to_provider: bool = None, @@ -1675,7 +1673,7 @@ def copy( parse_mode: ODVInput[str] = DEFAULT_NONE, caption_entities: Union[Tuple['MessageEntity', ...], List['MessageEntity']] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE, reply_markup: ReplyMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, @@ -1713,12 +1711,12 @@ def copy( def reply_copy( self, from_chat_id: Union[str, int], - message_id: Union[str, int], + message_id: int, caption: str = None, parse_mode: ODVInput[str] = DEFAULT_NONE, caption_entities: Union[Tuple['MessageEntity', ...], List['MessageEntity']] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE, reply_markup: ReplyMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, diff --git a/telegram/user.py b/telegram/user.py index 1db9d7a0983..42bff807e15 100644 --- a/telegram/user.py +++ b/telegram/user.py @@ -221,7 +221,7 @@ def mention_html(self, name: str = None) -> str: def pin_message( self, - message_id: Union[str, int], + message_id: int, disable_notification: ODVInput[bool] = DEFAULT_NONE, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, @@ -250,7 +250,7 @@ def unpin_message( self, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - message_id: Union[str, int] = None, + message_id: int = None, ) -> bool: """Shortcut for:: @@ -301,7 +301,7 @@ def send_message( parse_mode: ODVInput[str] = DEFAULT_NONE, disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: 'ReplyMarkup' = None, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, @@ -337,7 +337,7 @@ def send_photo( photo: Union[FileInput, 'PhotoSize'], caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: 'ReplyMarkup' = None, timeout: DVInput[float] = DEFAULT_20, parse_mode: ODVInput[str] = DEFAULT_NONE, @@ -377,7 +377,7 @@ def send_media_group( Union['InputMediaAudio', 'InputMediaDocument', 'InputMediaPhoto', 'InputMediaVideo'] ], disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, timeout: DVInput[float] = DEFAULT_20, api_kwargs: JSONDict = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, @@ -410,7 +410,7 @@ def send_audio( title: str = None, caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: 'ReplyMarkup' = None, timeout: DVInput[float] = DEFAULT_20, parse_mode: ODVInput[str] = DEFAULT_NONE, @@ -481,7 +481,7 @@ def send_contact( first_name: str = None, last_name: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: 'ReplyMarkup' = None, timeout: ODVInput[float] = DEFAULT_NONE, contact: 'Contact' = None, @@ -517,7 +517,7 @@ def send_contact( def send_dice( self, disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: 'ReplyMarkup' = None, timeout: ODVInput[float] = DEFAULT_NONE, emoji: str = None, @@ -551,7 +551,7 @@ def send_document( filename: str = None, caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: 'ReplyMarkup' = None, timeout: DVInput[float] = DEFAULT_20, parse_mode: ODVInput[str] = DEFAULT_NONE, @@ -592,7 +592,7 @@ def send_game( self, game_short_name: str, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: 'InlineKeyboardMarkup' = None, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, @@ -638,7 +638,7 @@ def send_invoice( need_shipping_address: bool = None, is_flexible: bool = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: 'InlineKeyboardMarkup' = None, provider_data: Union[str, object] = None, send_phone_number_to_provider: bool = None, @@ -691,7 +691,7 @@ def send_location( latitude: float = None, longitude: float = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: 'ReplyMarkup' = None, timeout: ODVInput[float] = DEFAULT_NONE, location: 'Location' = None, @@ -739,7 +739,7 @@ def send_animation( caption: str = None, parse_mode: ODVInput[str] = DEFAULT_NONE, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: 'ReplyMarkup' = None, timeout: DVInput[float] = DEFAULT_20, api_kwargs: JSONDict = None, @@ -780,7 +780,7 @@ def send_sticker( self, sticker: Union[FileInput, 'Sticker'], disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: 'ReplyMarkup' = None, timeout: DVInput[float] = DEFAULT_20, api_kwargs: JSONDict = None, @@ -813,7 +813,7 @@ def send_video( duration: int = None, caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: 'ReplyMarkup' = None, timeout: DVInput[float] = DEFAULT_20, width: int = None, @@ -864,7 +864,7 @@ def send_venue( address: str = None, foursquare_id: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: 'ReplyMarkup' = None, timeout: ODVInput[float] = DEFAULT_NONE, venue: 'Venue' = None, @@ -909,7 +909,7 @@ def send_video_note( duration: int = None, length: int = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: 'ReplyMarkup' = None, timeout: DVInput[float] = DEFAULT_20, thumb: FileInput = None, @@ -948,7 +948,7 @@ def send_voice( duration: int = None, caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: 'ReplyMarkup' = None, timeout: DVInput[float] = DEFAULT_20, parse_mode: ODVInput[str] = DEFAULT_NONE, @@ -994,7 +994,7 @@ def send_poll( correct_option_id: int = None, is_closed: bool = None, disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, reply_markup: 'ReplyMarkup' = None, timeout: ODVInput[float] = DEFAULT_NONE, explanation: str = None, @@ -1040,12 +1040,12 @@ def send_poll( def send_copy( self, from_chat_id: Union[str, int], - message_id: Union[str, int], + message_id: int, caption: str = None, parse_mode: ODVInput[str] = DEFAULT_NONE, caption_entities: Union[Tuple['MessageEntity', ...], List['MessageEntity']] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE, reply_markup: 'ReplyMarkup' = None, timeout: ODVInput[float] = DEFAULT_NONE, @@ -1079,12 +1079,12 @@ def send_copy( def copy_message( self, chat_id: Union[int, str], - message_id: Union[str, int], + message_id: int, caption: str = None, parse_mode: ODVInput[str] = DEFAULT_NONE, caption_entities: Union[Tuple['MessageEntity', ...], List['MessageEntity']] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: Union[int, str] = None, + reply_to_message_id: int = None, allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE, reply_markup: 'ReplyMarkup' = None, timeout: ODVInput[float] = DEFAULT_NONE, From ff059d72fe27834f86061a9c7cb27efa983170e4 Mon Sep 17 00:00:00 2001 From: poolitzer <25934244+Poolitzer@users.noreply.github.com> Date: Tue, 2 Mar 2021 17:33:05 +0100 Subject: [PATCH 07/19] feat: add RTD link to documentation --- .github/CONTRIBUTING.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/CONTRIBUTING.rst b/.github/CONTRIBUTING.rst index a86878bec6c..7d4f4188063 100644 --- a/.github/CONTRIBUTING.rst +++ b/.github/CONTRIBUTING.rst @@ -50,6 +50,8 @@ Instructions for making a code change The central development branch is ``master``, which should be clean and ready for release at any time. In general, all changes should be done as feature branches based off of ``master``. +If you want to do solely documentation changes, base them and PR to the branch ``doc-fixes``. This branch also has its own `RTD build`_. + Here's how to make a one-off code change. 1. **Choose a descriptive branch name.** It should be lowercase, hyphen-separated, and a noun describing the change (so, ``fuzzy-rules``, but not ``implement-fuzzy-rules``). Also, it shouldn't start with ``hotfix`` or ``release``. @@ -256,3 +258,4 @@ break the API classes. For example: .. _`here`: https://mypy.readthedocs.io/en/stable/cheat_sheet_py3.html .. _`Black`: https://black.readthedocs.io/en/stable/index.html .. _`popular editors`: https://black.readthedocs.io/en/stable/editor_integration.html +.. _`RTD build`: https://python-telegram-bot.readthedocs.io/en/doc-fixes From e85332ab4998dca934f3d2b256abf6484b75bbe2 Mon Sep 17 00:00:00 2001 From: Poolitzer <25934244+Poolitzer@users.noreply.github.com> Date: Thu, 4 Mar 2021 08:08:47 +0100 Subject: [PATCH 08/19] improving sender chat docstring (#2412) * fix: improving sender chat docstring also adding a note to a weird edge case * fix: words being hard --- telegram/ext/filters.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/telegram/ext/filters.py b/telegram/ext/filters.py index eaf1f100e1a..f6e48bb5257 100644 --- a/telegram/ext/filters.py +++ b/telegram/ext/filters.py @@ -1681,16 +1681,22 @@ class sender_chat(_ChatUserBaseFilter): username. Examples: - * To filter for messages forwarded from a channel with ID ``-1234``, use - ``MessageHandler(Filters.sender_chat(-1234), callback_method)``. + * To filter for messages forwarded to a discussion group from a channel with ID + ``-1234``, use ``MessageHandler(Filters.sender_chat(-1234), callback_method)``. * To filter for messages of anonymous admins in a super group with username ``@anonymous``, use ``MessageHandler(Filters.sender_chat(username='anonymous'), callback_method)``. - * To filter for messages forwarded from *any* channel, use + * To filter for messages forwarded to a discussion group from *any* channel, use ``MessageHandler(Filters.sender_chat.channel, callback_method)``. * To filter for messages of anonymous admins in *any* super group, use ``MessageHandler(Filters.sender_chat.super_group, callback_method)``. + Note: + Remember, ``sender_chat`` is also set for messages in a channel as the channel itself, + so when your bot is an admin in a channel and the linked discussion group, you would + receive the message twice (once from inside the channel, once inside the discussion + group). + Warning: :attr:`chat_ids` will return a *copy* of the saved chat ids as :class:`frozenset`. This is to ensure thread safety. To add/remove a chat, you should use :meth:`add_usernames`, From 6cd365a9e197758f46ba3ec2e404e70063e9d5bf Mon Sep 17 00:00:00 2001 From: Hinrich Mahler Date: Thu, 4 Mar 2021 18:45:32 +0100 Subject: [PATCH 09/19] Add note on donations --- README.rst | 5 +++++ README_RAW.rst | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/README.rst b/README.rst index 54545e923a5..b59dea8f91d 100644 --- a/README.rst +++ b/README.rst @@ -230,6 +230,11 @@ Contributing Contributions of all sizes are welcome. Please review our `contribution guidelines `_ to get started. You can also help by `reporting bugs `_. +======== +Donating +======== +Occasionally we are asked if we accept donations to support the development. While we appreciate the thought, maintaining PTB is our hobby and we have almost no running costs for it. We therefore have nothing set up do accept donations. If you still want to donate, we kindly ask you to donate to another open source project/initiative of your choice instead. + ======= License ======= diff --git a/README_RAW.rst b/README_RAW.rst index 6c8b61111ca..b69cae9a471 100644 --- a/README_RAW.rst +++ b/README_RAW.rst @@ -212,6 +212,11 @@ Contributing Contributions of all sizes are welcome. Please review our `contribution guidelines `_ to get started. You can also help by `reporting bugs `_. +======== +Donating +======== +Occasionally we are asked if we accept donations to support the development. While we appreciate the thought, maintaining PTB is our hobby and we have almost no running costs for it. We therefore have nothing set up do accept donations. If you still want to donate, we kindly ask you to donate to another open source project/initiative of your choice instead. + ======= License ======= From 40c5c5ca5d7c09ac63444809039d260e658614b3 Mon Sep 17 00:00:00 2001 From: Hinrich Mahler Date: Thu, 4 Mar 2021 21:51:04 +0100 Subject: [PATCH 10/19] typo --- README.rst | 2 +- README_RAW.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index b59dea8f91d..97a6f95ead3 100644 --- a/README.rst +++ b/README.rst @@ -233,7 +233,7 @@ Contributions of all sizes are welcome. Please review our `contribution guidelin ======== Donating ======== -Occasionally we are asked if we accept donations to support the development. While we appreciate the thought, maintaining PTB is our hobby and we have almost no running costs for it. We therefore have nothing set up do accept donations. If you still want to donate, we kindly ask you to donate to another open source project/initiative of your choice instead. +Occasionally we are asked if we accept donations to support the development. While we appreciate the thought, maintaining PTB is our hobby and we have almost no running costs for it. We therefore have nothing set up to accept donations. If you still want to donate, we kindly ask you to donate to another open source project/initiative of your choice instead. ======= License diff --git a/README_RAW.rst b/README_RAW.rst index b69cae9a471..fb55ccb7578 100644 --- a/README_RAW.rst +++ b/README_RAW.rst @@ -215,7 +215,7 @@ Contributions of all sizes are welcome. Please review our `contribution guidelin ======== Donating ======== -Occasionally we are asked if we accept donations to support the development. While we appreciate the thought, maintaining PTB is our hobby and we have almost no running costs for it. We therefore have nothing set up do accept donations. If you still want to donate, we kindly ask you to donate to another open source project/initiative of your choice instead. +Occasionally we are asked if we accept donations to support the development. While we appreciate the thought, maintaining PTB is our hobby and we have almost no running costs for it. We therefore have nothing set up to accept donations. If you still want to donate, we kindly ask you to donate to another open source project/initiative of your choice instead. ======= License From 9d555828c3c9e4474dc29d44f1ebdfc69105e4e3 Mon Sep 17 00:00:00 2001 From: Hinrich Mahler Date: Fri, 5 Mar 2021 16:15:07 +0100 Subject: [PATCH 11/19] typo in User.get_profile_pictures docstrings --- telegram/user.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telegram/user.py b/telegram/user.py index 42bff807e15..ede6f0bacb5 100644 --- a/telegram/user.py +++ b/telegram/user.py @@ -161,7 +161,7 @@ def get_profile_photos( """ Shortcut for:: - bot.send_message(update.effective_user.id, *args, **kwargs) + bot.get_user_profile_photos(update.effective_user.id, *args, **kwargs) For the documentation of the arguments, please see :meth:`telegram.Bot.get_user_profile_photos`. From 7a3225aedf300ac92b884143c0b0d577ef48dc9b Mon Sep 17 00:00:00 2001 From: poolitzer <25934244+Poolitzer@users.noreply.github.com> Date: Tue, 9 Mar 2021 21:29:37 +0100 Subject: [PATCH 12/19] Fix: meth, not attr for meth, not attr --- telegram/bot.py | 158 ++++++++++++++++++++++++------------------------ 1 file changed, 79 insertions(+), 79 deletions(-) diff --git a/telegram/bot.py b/telegram/bot.py index 5b67a1ddb45..f91d4fa362f 100644 --- a/telegram/bot.py +++ b/telegram/bot.py @@ -1573,7 +1573,7 @@ def edit_message_live_location( ) -> Union[Message, bool]: """Use this method to edit live location messages sent by the bot or via the bot (for inline bots). A location can be edited until its :attr:`live_period` expires or - editing is explicitly disabled by a call to :attr:`stop_message_live_location`. + editing is explicitly disabled by a call to :meth:`stop_message_live_location`. Note: You can either supply a :obj:`latitude` and :obj:`longitude` or a :obj:`location`. @@ -2199,7 +2199,7 @@ def get_file( """ Use this method to get basic info about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. The file can then be downloaded - with :attr:`telegram.File.download`. It is guaranteed that the link will be + with :meth:`telegram.File.download`. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling get_file again. @@ -3060,7 +3060,7 @@ def set_chat_sticker_set( """Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Use the field :attr:`telegram.Chat.can_set_sticker_set` optionally returned - in :attr:`get_chat` requests to check if the bot can use this method. + in :meth:`get_chat` requests to check if the bot can use this method. Args: chat_id (:obj:`int` | :obj:`str`): Unique identifier for the target chat or username @@ -3092,7 +3092,7 @@ def delete_chat_sticker_set( """Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Use the field :attr:`telegram.Chat.can_set_sticker_set` optionally returned in - :attr:`get_chat` requests to check if the bot can use this method. + :meth:`get_chat` requests to check if the bot can use this method. Args: chat_id (:obj:`int` | :obj:`str`): Unique identifier for the target chat or username @@ -3527,7 +3527,7 @@ def restrict_chat_member( :obj:`True` for all boolean parameters to lift restrictions from a user. Note: - Since Bot API 4.4, :attr:`restrict_chat_member` takes the new user permissions in a + Since Bot API 4.4, :meth:`restrict_chat_member` takes the new user permissions in a single argument of type :class:`telegram.ChatPermissions`. The old way of passing parameters will not keep working forever. @@ -4073,7 +4073,7 @@ def upload_sticker_file( ) -> File: """ Use this method to upload a .png file with a sticker for later use in - :attr:`create_new_sticker_set` and :attr:`add_sticker_to_set` methods (can be used multiple + :meth:`create_new_sticker_set` and :meth:`add_sticker_to_set` methods (can be used multiple times). Note: @@ -4870,148 +4870,148 @@ def __hash__(self) -> int: # camelCase aliases getMe = get_me - """Alias for :attr:`get_me`""" + """Alias for :meth:`get_me`""" sendMessage = send_message - """Alias for :attr:`send_message`""" + """Alias for :meth:`send_message`""" deleteMessage = delete_message - """Alias for :attr:`delete_message`""" + """Alias for :meth:`delete_message`""" forwardMessage = forward_message - """Alias for :attr:`forward_message`""" + """Alias for :meth:`forward_message`""" sendPhoto = send_photo - """Alias for :attr:`send_photo`""" + """Alias for :meth:`send_photo`""" sendAudio = send_audio - """Alias for :attr:`send_audio`""" + """Alias for :meth:`send_audio`""" sendDocument = send_document - """Alias for :attr:`send_document`""" + """Alias for :meth:`send_document`""" sendSticker = send_sticker - """Alias for :attr:`send_sticker`""" + """Alias for :meth:`send_sticker`""" sendVideo = send_video - """Alias for :attr:`send_video`""" + """Alias for :meth:`send_video`""" sendAnimation = send_animation - """Alias for :attr:`send_animation`""" + """Alias for :meth:`send_animation`""" sendVoice = send_voice - """Alias for :attr:`send_voice`""" + """Alias for :meth:`send_voice`""" sendVideoNote = send_video_note - """Alias for :attr:`send_video_note`""" + """Alias for :meth:`send_video_note`""" sendMediaGroup = send_media_group - """Alias for :attr:`send_media_group`""" + """Alias for :meth:`send_media_group`""" sendLocation = send_location - """Alias for :attr:`send_location`""" + """Alias for :meth:`send_location`""" editMessageLiveLocation = edit_message_live_location - """Alias for :attr:`edit_message_live_location`""" + """Alias for :meth:`edit_message_live_location`""" stopMessageLiveLocation = stop_message_live_location - """Alias for :attr:`stop_message_live_location`""" + """Alias for :meth:`stop_message_live_location`""" sendVenue = send_venue - """Alias for :attr:`send_venue`""" + """Alias for :meth:`send_venue`""" sendContact = send_contact - """Alias for :attr:`send_contact`""" + """Alias for :meth:`send_contact`""" sendGame = send_game - """Alias for :attr:`send_game`""" + """Alias for :meth:`send_game`""" sendChatAction = send_chat_action - """Alias for :attr:`send_chat_action`""" + """Alias for :meth:`send_chat_action`""" answerInlineQuery = answer_inline_query - """Alias for :attr:`answer_inline_query`""" + """Alias for :meth:`answer_inline_query`""" getUserProfilePhotos = get_user_profile_photos - """Alias for :attr:`get_user_profile_photos`""" + """Alias for :meth:`get_user_profile_photos`""" getFile = get_file - """Alias for :attr:`get_file`""" + """Alias for :meth:`get_file`""" kickChatMember = kick_chat_member - """Alias for :attr:`kick_chat_member`""" + """Alias for :meth:`kick_chat_member`""" unbanChatMember = unban_chat_member - """Alias for :attr:`unban_chat_member`""" + """Alias for :meth:`unban_chat_member`""" answerCallbackQuery = answer_callback_query - """Alias for :attr:`answer_callback_query`""" + """Alias for :meth:`answer_callback_query`""" editMessageText = edit_message_text - """Alias for :attr:`edit_message_text`""" + """Alias for :meth:`edit_message_text`""" editMessageCaption = edit_message_caption - """Alias for :attr:`edit_message_caption`""" + """Alias for :meth:`edit_message_caption`""" editMessageMedia = edit_message_media - """Alias for :attr:`edit_message_media`""" + """Alias for :meth:`edit_message_media`""" editMessageReplyMarkup = edit_message_reply_markup - """Alias for :attr:`edit_message_reply_markup`""" + """Alias for :meth:`edit_message_reply_markup`""" getUpdates = get_updates - """Alias for :attr:`get_updates`""" + """Alias for :meth:`get_updates`""" setWebhook = set_webhook - """Alias for :attr:`set_webhook`""" + """Alias for :meth:`set_webhook`""" deleteWebhook = delete_webhook - """Alias for :attr:`delete_webhook`""" + """Alias for :meth:`delete_webhook`""" leaveChat = leave_chat - """Alias for :attr:`leave_chat`""" + """Alias for :meth:`leave_chat`""" getChat = get_chat - """Alias for :attr:`get_chat`""" + """Alias for :meth:`get_chat`""" getChatAdministrators = get_chat_administrators - """Alias for :attr:`get_chat_administrators`""" + """Alias for :meth:`get_chat_administrators`""" getChatMember = get_chat_member - """Alias for :attr:`get_chat_member`""" + """Alias for :meth:`get_chat_member`""" setChatStickerSet = set_chat_sticker_set - """Alias for :attr:`set_chat_sticker_set`""" + """Alias for :meth:`set_chat_sticker_set`""" deleteChatStickerSet = delete_chat_sticker_set - """Alias for :attr:`delete_chat_sticker_set`""" + """Alias for :meth:`delete_chat_sticker_set`""" getChatMembersCount = get_chat_members_count - """Alias for :attr:`get_chat_members_count`""" + """Alias for :meth:`get_chat_members_count`""" getWebhookInfo = get_webhook_info - """Alias for :attr:`get_webhook_info`""" + """Alias for :meth:`get_webhook_info`""" setGameScore = set_game_score - """Alias for :attr:`set_game_score`""" + """Alias for :meth:`set_game_score`""" getGameHighScores = get_game_high_scores - """Alias for :attr:`get_game_high_scores`""" + """Alias for :meth:`get_game_high_scores`""" sendInvoice = send_invoice - """Alias for :attr:`send_invoice`""" + """Alias for :meth:`send_invoice`""" answerShippingQuery = answer_shipping_query - """Alias for :attr:`answer_shipping_query`""" + """Alias for :meth:`answer_shipping_query`""" answerPreCheckoutQuery = answer_pre_checkout_query - """Alias for :attr:`answer_pre_checkout_query`""" + """Alias for :meth:`answer_pre_checkout_query`""" restrictChatMember = restrict_chat_member - """Alias for :attr:`restrict_chat_member`""" + """Alias for :meth:`restrict_chat_member`""" promoteChatMember = promote_chat_member - """Alias for :attr:`promote_chat_member`""" + """Alias for :meth:`promote_chat_member`""" setChatPermissions = set_chat_permissions - """Alias for :attr:`set_chat_permissions`""" + """Alias for :meth:`set_chat_permissions`""" setChatAdministratorCustomTitle = set_chat_administrator_custom_title - """Alias for :attr:`set_chat_administrator_custom_title`""" + """Alias for :meth:`set_chat_administrator_custom_title`""" exportChatInviteLink = export_chat_invite_link - """Alias for :attr:`export_chat_invite_link`""" + """Alias for :meth:`export_chat_invite_link`""" setChatPhoto = set_chat_photo - """Alias for :attr:`set_chat_photo`""" + """Alias for :meth:`set_chat_photo`""" deleteChatPhoto = delete_chat_photo - """Alias for :attr:`delete_chat_photo`""" + """Alias for :meth:`delete_chat_photo`""" setChatTitle = set_chat_title - """Alias for :attr:`set_chat_title`""" + """Alias for :meth:`set_chat_title`""" setChatDescription = set_chat_description - """Alias for :attr:`set_chat_description`""" + """Alias for :meth:`set_chat_description`""" pinChatMessage = pin_chat_message - """Alias for :attr:`pin_chat_message`""" + """Alias for :meth:`pin_chat_message`""" unpinChatMessage = unpin_chat_message - """Alias for :attr:`unpin_chat_message`""" + """Alias for :meth:`unpin_chat_message`""" unpinAllChatMessages = unpin_all_chat_messages - """Alias for :attr:`unpin_all_chat_messages`""" + """Alias for :meth:`unpin_all_chat_messages`""" getStickerSet = get_sticker_set - """Alias for :attr:`get_sticker_set`""" + """Alias for :meth:`get_sticker_set`""" uploadStickerFile = upload_sticker_file - """Alias for :attr:`upload_sticker_file`""" + """Alias for :meth:`upload_sticker_file`""" createNewStickerSet = create_new_sticker_set - """Alias for :attr:`create_new_sticker_set`""" + """Alias for :meth:`create_new_sticker_set`""" addStickerToSet = add_sticker_to_set - """Alias for :attr:`add_sticker_to_set`""" + """Alias for :meth:`add_sticker_to_set`""" setStickerPositionInSet = set_sticker_position_in_set - """Alias for :attr:`set_sticker_position_in_set`""" + """Alias for :meth:`set_sticker_position_in_set`""" deleteStickerFromSet = delete_sticker_from_set - """Alias for :attr:`delete_sticker_from_set`""" + """Alias for :meth:`delete_sticker_from_set`""" setStickerSetThumb = set_sticker_set_thumb - """Alias for :attr:`set_sticker_set_thumb`""" + """Alias for :meth:`set_sticker_set_thumb`""" setPassportDataErrors = set_passport_data_errors - """Alias for :attr:`set_passport_data_errors`""" + """Alias for :meth:`set_passport_data_errors`""" sendPoll = send_poll - """Alias for :attr:`send_poll`""" + """Alias for :meth:`send_poll`""" stopPoll = stop_poll - """Alias for :attr:`stop_poll`""" + """Alias for :meth:`stop_poll`""" sendDice = send_dice - """Alias for :attr:`send_dice`""" + """Alias for :meth:`send_dice`""" getMyCommands = get_my_commands - """Alias for :attr:`get_my_commands`""" + """Alias for :meth:`get_my_commands`""" setMyCommands = set_my_commands - """Alias for :attr:`set_my_commands`""" + """Alias for :meth:`set_my_commands`""" logOut = log_out - """Alias for :attr:`log_out`""" + """Alias for :meth:`log_out`""" copyMessage = copy_message - """Alias for :attr:`copy_message`""" + """Alias for :meth:`copy_message`""" From d3a6a6f97db32a47a0368bfee1704573d97315a8 Mon Sep 17 00:00:00 2001 From: Harshil Date: Wed, 10 Mar 2021 01:52:11 +0400 Subject: [PATCH 13/19] filters + inlinequery doc fix --- telegram/ext/filters.py | 4 ++-- telegram/inline/inlinequery.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/telegram/ext/filters.py b/telegram/ext/filters.py index f6e48bb5257..7f345f0c3d8 100644 --- a/telegram/ext/filters.py +++ b/telegram/ext/filters.py @@ -1077,8 +1077,8 @@ def filter(self, message: Update) -> bool: left_chat_member: Messages that contain :attr:`telegram.Message.left_chat_member`. migrate: Messages that contain - :attr:`telegram.Message.migrate_from_chat_id` or - :attr: `telegram.Message.migrate_from_chat_id`. + :attr:`telegram.Message.migrate_to_chat_id` or + :attr:`telegram.Message.migrate_from_chat_id`. new_chat_members: Messages that contain :attr:`telegram.Message.new_chat_members`. new_chat_photo: Messages that contain diff --git a/telegram/inline/inlinequery.py b/telegram/inline/inlinequery.py index 84129949f6e..8be81cfa49d 100644 --- a/telegram/inline/inlinequery.py +++ b/telegram/inline/inlinequery.py @@ -125,7 +125,7 @@ def answer( Defaults to :obj:`False`. Raises: - TypeError: If both :attr:`current_offset` and attr:`auto_pagination` are supplied. + TypeError: If both :attr:`current_offset` and :attr:`auto_pagination` are supplied. """ if current_offset and auto_pagination: # We raise TypeError instead of ValueError for backwards compatibility with versions From b4e390d6279ce82711f56b183bbc166314c25b5a Mon Sep 17 00:00:00 2001 From: Hinrich Mahler Date: Wed, 10 Mar 2021 09:49:37 +0100 Subject: [PATCH 14/19] Bump versions, update RTD config file --- .readthedocs.yml | 22 +++++++++++++++++----- docs/requirements-docs.txt | 4 ++-- docs/source/conf.py | 2 +- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index ca59163741a..9adff7bcf10 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -1,10 +1,22 @@ -# syntax: https://docs.readthedocs.io/en/latest/yaml-config.html +# .readthedocs.yaml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details +# Required +version: 2 + +# Build documentation in the docs/ directory with Sphinx +sphinx: + configuration: docs/conf.py + +# Optionally build your docs in additional formats such as PDF formats: - - pdf + - pdf +# Optionally set the version of Python and requirements required to build your docs python: - setup_py_install: true version: 3 - -requirements_file: docs/requirements-docs.txt + install: + - method: pip + path: . + - requirements: docs/requirements-docs.txt diff --git a/docs/requirements-docs.txt b/docs/requirements-docs.txt index ddec259b3f5..7347ad9b094 100644 --- a/docs/requirements-docs.txt +++ b/docs/requirements-docs.txt @@ -1,3 +1,3 @@ -sphinx==3.5.1 -sphinx_rtd_theme +sphinx==3.5.2 +sphinx_rtd_theme==0.5.1 sphinx-pypi-upload diff --git a/docs/source/conf.py b/docs/source/conf.py index 4933b9ad6df..5e70444a231 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -24,7 +24,7 @@ # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. -needs_sphinx = '1.7.9' +needs_sphinx = '3.5.2' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom From 1647dd15cbfe8ae31975da510119f8e676bf4206 Mon Sep 17 00:00:00 2001 From: Hinrich Mahler Date: Wed, 10 Mar 2021 10:38:59 +0100 Subject: [PATCH 15/19] Try fix build --- .readthedocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 9adff7bcf10..41af24d63bd 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -7,7 +7,7 @@ version: 2 # Build documentation in the docs/ directory with Sphinx sphinx: - configuration: docs/conf.py + configuration: docs/source/conf.py # Optionally build your docs in additional formats such as PDF formats: From e9b31246049ecf6000f48f243ebe2c58bdf2a65f Mon Sep 17 00:00:00 2001 From: Hinrich Mahler Date: Thu, 11 Mar 2021 19:33:21 +0100 Subject: [PATCH 16/19] Revert "fix: chat_id can be string, message_id only int" This reverts commit ba04e5aa --- telegram/bot.py | 84 +++++++++++++++++++-------------------- telegram/callbackquery.py | 2 +- telegram/chat.py | 46 ++++++++++----------- telegram/message.py | 50 ++++++++++++----------- telegram/user.py | 46 ++++++++++----------- 5 files changed, 115 insertions(+), 113 deletions(-) diff --git a/telegram/bot.py b/telegram/bot.py index f91d4fa362f..67492ee1774 100644 --- a/telegram/bot.py +++ b/telegram/bot.py @@ -263,7 +263,7 @@ def _message( self, endpoint: str, data: JSONDict, - reply_to_message_id: int = None, + reply_to_message_id: Union[str, int] = None, disable_notification: ODVInput[bool] = DEFAULT_NONE, reply_markup: ReplyMarkup = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, @@ -418,7 +418,7 @@ def send_message( parse_mode: ODVInput[str] = DEFAULT_NONE, disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: ReplyMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, @@ -486,7 +486,7 @@ def send_message( def delete_message( self, chat_id: Union[str, int], - message_id: int, + message_id: Union[str, int], timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, ) -> bool: @@ -532,7 +532,7 @@ def forward_message( self, chat_id: Union[int, str], from_chat_id: Union[str, int], - message_id: int, + message_id: Union[str, int], disable_notification: DVInput[bool] = DEFAULT_NONE, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, @@ -580,11 +580,11 @@ def forward_message( @log def send_photo( self, - chat_id: Union[int, str], + chat_id: int, photo: Union[FileInput, 'PhotoSize'], caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: ReplyMarkup = None, timeout: DVInput[float] = DEFAULT_20, parse_mode: ODVInput[str] = DEFAULT_NONE, @@ -677,7 +677,7 @@ def send_audio( title: str = None, caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: ReplyMarkup = None, timeout: DVInput[float] = DEFAULT_20, parse_mode: ODVInput[str] = DEFAULT_NONE, @@ -796,7 +796,7 @@ def send_document( filename: str = None, caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: ReplyMarkup = None, timeout: DVInput[float] = DEFAULT_20, parse_mode: ODVInput[str] = DEFAULT_NONE, @@ -903,7 +903,7 @@ def send_sticker( chat_id: Union[int, str], sticker: Union[FileInput, 'Sticker'], disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: ReplyMarkup = None, timeout: DVInput[float] = DEFAULT_20, api_kwargs: JSONDict = None, @@ -969,7 +969,7 @@ def send_video( duration: int = None, caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: ReplyMarkup = None, timeout: DVInput[float] = DEFAULT_20, width: int = None, @@ -1095,7 +1095,7 @@ def send_video_note( duration: int = None, length: int = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: ReplyMarkup = None, timeout: DVInput[float] = DEFAULT_20, thumb: FileInput = None, @@ -1198,7 +1198,7 @@ def send_animation( caption: str = None, parse_mode: ODVInput[str] = DEFAULT_NONE, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: ReplyMarkup = None, timeout: DVInput[float] = DEFAULT_20, api_kwargs: JSONDict = None, @@ -1311,7 +1311,7 @@ def send_voice( duration: int = None, caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: ReplyMarkup = None, timeout: DVInput[float] = DEFAULT_20, parse_mode: ODVInput[str] = DEFAULT_NONE, @@ -1409,7 +1409,7 @@ def send_media_group( Union['InputMediaAudio', 'InputMediaDocument', 'InputMediaPhoto', 'InputMediaVideo'] ], disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, timeout: DVInput[float] = DEFAULT_20, api_kwargs: JSONDict = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, @@ -1466,7 +1466,7 @@ def send_location( latitude: float = None, longitude: float = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: ReplyMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, location: Location = None, @@ -1559,8 +1559,8 @@ def send_location( def edit_message_live_location( self, chat_id: Union[str, int] = None, - message_id: int = None, - inline_message_id: int = None, + message_id: Union[str, int] = None, + inline_message_id: Union[str, int] = None, latitude: float = None, longitude: float = None, location: Location = None, @@ -1648,8 +1648,8 @@ def edit_message_live_location( def stop_message_live_location( self, chat_id: Union[str, int] = None, - message_id: int = None, - inline_message_id: int = None, + message_id: Union[str, int] = None, + inline_message_id: Union[str, int] = None, reply_markup: InlineKeyboardMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, @@ -1704,7 +1704,7 @@ def send_venue( address: str = None, foursquare_id: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: ReplyMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, venue: Venue = None, @@ -1814,7 +1814,7 @@ def send_contact( first_name: str = None, last_name: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: ReplyMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, contact: Contact = None, @@ -1898,7 +1898,7 @@ def send_game( chat_id: Union[int, str], game_short_name: str, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: InlineKeyboardMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, @@ -2409,8 +2409,8 @@ def edit_message_text( self, text: str, chat_id: Union[str, int] = None, - message_id: int = None, - inline_message_id: int = None, + message_id: Union[str, int] = None, + inline_message_id: Union[str, int] = None, parse_mode: ODVInput[str] = DEFAULT_NONE, disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE, reply_markup: InlineKeyboardMarkup = None, @@ -2480,8 +2480,8 @@ def edit_message_text( def edit_message_caption( self, chat_id: Union[str, int] = None, - message_id: int = None, - inline_message_id: int = None, + message_id: Union[str, int] = None, + inline_message_id: Union[str, int] = None, caption: str = None, reply_markup: InlineKeyboardMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, @@ -2555,8 +2555,8 @@ def edit_message_caption( def edit_message_media( self, chat_id: Union[str, int] = None, - message_id: int = None, - inline_message_id: int = None, + message_id: Union[str, int] = None, + inline_message_id: Union[str, int] = None, media: 'InputMedia' = None, reply_markup: InlineKeyboardMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, @@ -2622,8 +2622,8 @@ def edit_message_media( def edit_message_reply_markup( self, chat_id: Union[str, int] = None, - message_id: int = None, - inline_message_id: int = None, + message_id: Union[str, int] = None, + inline_message_id: Union[str, int] = None, reply_markup: Optional['InlineKeyboardMarkup'] = None, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, @@ -3140,8 +3140,8 @@ def set_game_score( user_id: Union[int, str], score: int, chat_id: Union[str, int] = None, - message_id: int = None, - inline_message_id: int = None, + message_id: Union[str, int] = None, + inline_message_id: Union[str, int] = None, force: bool = None, disable_edit_message: bool = None, timeout: ODVInput[float] = DEFAULT_NONE, @@ -3203,8 +3203,8 @@ def get_game_high_scores( self, user_id: Union[int, str], chat_id: Union[str, int] = None, - message_id: int = None, - inline_message_id: int = None, + message_id: Union[str, int] = None, + inline_message_id: Union[str, int] = None, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, ) -> List[GameHighScore]: @@ -3267,7 +3267,7 @@ def send_invoice( need_shipping_address: bool = None, is_flexible: bool = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: InlineKeyboardMarkup = None, provider_data: Union[str, object] = None, send_phone_number_to_provider: bool = None, @@ -3915,7 +3915,7 @@ def set_chat_description( def pin_chat_message( self, chat_id: Union[str, int], - message_id: int, + message_id: Union[str, int], disable_notification: ODVInput[bool] = DEFAULT_NONE, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, @@ -3962,7 +3962,7 @@ def unpin_chat_message( chat_id: Union[str, int], timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - message_id: int = None, + message_id: Union[str, int] = None, ) -> bool: """ Use this method to remove a message from the list of pinned messages in a chat. If the @@ -4446,7 +4446,7 @@ def send_poll( correct_option_id: int = None, is_closed: bool = None, disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: ReplyMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, explanation: str = None, @@ -4559,7 +4559,7 @@ def send_poll( def stop_poll( self, chat_id: Union[int, str], - message_id: int, + message_id: Union[int, str], reply_markup: InlineKeyboardMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, @@ -4606,7 +4606,7 @@ def send_dice( self, chat_id: Union[int, str], disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: ReplyMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, emoji: str = None, @@ -4779,12 +4779,12 @@ def copy_message( self, chat_id: Union[int, str], from_chat_id: Union[str, int], - message_id: int, + message_id: Union[str, int], caption: str = None, parse_mode: ODVInput[str] = DEFAULT_NONE, caption_entities: Union[Tuple['MessageEntity', ...], List['MessageEntity']] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE, reply_markup: ReplyMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, diff --git a/telegram/callbackquery.py b/telegram/callbackquery.py index 261cf4e6a60..3bafb8d31c9 100644 --- a/telegram/callbackquery.py +++ b/telegram/callbackquery.py @@ -598,7 +598,7 @@ def copy_message( parse_mode: ODVInput[str] = DEFAULT_NONE, caption_entities: Union[Tuple['MessageEntity', ...], List['MessageEntity']] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE, reply_markup: ReplyMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, diff --git a/telegram/chat.py b/telegram/chat.py index 640aea1e9ed..aa9cbc31d3e 100644 --- a/telegram/chat.py +++ b/telegram/chat.py @@ -496,7 +496,7 @@ def set_administrator_custom_title( def pin_message( self, - message_id: int, + message_id: Union[str, int], disable_notification: ODVInput[bool] = DEFAULT_NONE, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, @@ -526,7 +526,7 @@ def unpin_message( self, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - message_id: int = None, + message_id: Union[str, int] = None, ) -> bool: """Shortcut for:: @@ -578,7 +578,7 @@ def send_message( parse_mode: ODVInput[str] = DEFAULT_NONE, disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: 'ReplyMarkup' = None, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, @@ -615,7 +615,7 @@ def send_media_group( Union['InputMediaAudio', 'InputMediaDocument', 'InputMediaPhoto', 'InputMediaVideo'] ], disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, timeout: DVInput[float] = DEFAULT_20, api_kwargs: JSONDict = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, @@ -671,7 +671,7 @@ def send_photo( photo: Union[FileInput, 'PhotoSize'], caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: 'ReplyMarkup' = None, timeout: DVInput[float] = DEFAULT_20, parse_mode: ODVInput[str] = DEFAULT_NONE, @@ -711,7 +711,7 @@ def send_contact( first_name: str = None, last_name: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: 'ReplyMarkup' = None, timeout: ODVInput[float] = DEFAULT_NONE, contact: 'Contact' = None, @@ -752,7 +752,7 @@ def send_audio( title: str = None, caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: 'ReplyMarkup' = None, timeout: DVInput[float] = DEFAULT_20, parse_mode: ODVInput[str] = DEFAULT_NONE, @@ -797,7 +797,7 @@ def send_document( filename: str = None, caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: 'ReplyMarkup' = None, timeout: DVInput[float] = DEFAULT_20, parse_mode: ODVInput[str] = DEFAULT_NONE, @@ -837,7 +837,7 @@ def send_document( def send_dice( self, disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: 'ReplyMarkup' = None, timeout: ODVInput[float] = DEFAULT_NONE, emoji: str = None, @@ -869,7 +869,7 @@ def send_game( self, game_short_name: str, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: 'InlineKeyboardMarkup' = None, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, @@ -915,7 +915,7 @@ def send_invoice( need_shipping_address: bool = None, is_flexible: bool = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: 'InlineKeyboardMarkup' = None, provider_data: Union[str, object] = None, send_phone_number_to_provider: bool = None, @@ -968,7 +968,7 @@ def send_location( latitude: float = None, longitude: float = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: 'ReplyMarkup' = None, timeout: ODVInput[float] = DEFAULT_NONE, location: 'Location' = None, @@ -1016,7 +1016,7 @@ def send_animation( caption: str = None, parse_mode: ODVInput[str] = DEFAULT_NONE, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: 'ReplyMarkup' = None, timeout: DVInput[float] = DEFAULT_20, api_kwargs: JSONDict = None, @@ -1057,7 +1057,7 @@ def send_sticker( self, sticker: Union[FileInput, 'Sticker'], disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: 'ReplyMarkup' = None, timeout: DVInput[float] = DEFAULT_20, api_kwargs: JSONDict = None, @@ -1092,7 +1092,7 @@ def send_venue( address: str = None, foursquare_id: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: 'ReplyMarkup' = None, timeout: ODVInput[float] = DEFAULT_NONE, venue: 'Venue' = None, @@ -1137,7 +1137,7 @@ def send_video( duration: int = None, caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: 'ReplyMarkup' = None, timeout: DVInput[float] = DEFAULT_20, width: int = None, @@ -1186,7 +1186,7 @@ def send_video_note( duration: int = None, length: int = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: 'ReplyMarkup' = None, timeout: DVInput[float] = DEFAULT_20, thumb: FileInput = None, @@ -1225,7 +1225,7 @@ def send_voice( duration: int = None, caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: 'ReplyMarkup' = None, timeout: DVInput[float] = DEFAULT_20, parse_mode: ODVInput[str] = DEFAULT_NONE, @@ -1271,7 +1271,7 @@ def send_poll( correct_option_id: int = None, is_closed: bool = None, disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: 'ReplyMarkup' = None, timeout: ODVInput[float] = DEFAULT_NONE, explanation: str = None, @@ -1317,12 +1317,12 @@ def send_poll( def send_copy( self, from_chat_id: Union[str, int], - message_id: int, + message_id: Union[str, int], caption: str = None, parse_mode: ODVInput[str] = DEFAULT_NONE, caption_entities: Union[Tuple['MessageEntity', ...], List['MessageEntity']] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE, reply_markup: 'ReplyMarkup' = None, timeout: ODVInput[float] = DEFAULT_NONE, @@ -1356,12 +1356,12 @@ def send_copy( def copy_message( self, chat_id: Union[int, str], - message_id: int, + message_id: Union[str, int], caption: str = None, parse_mode: ODVInput[str] = DEFAULT_NONE, caption_entities: Union[Tuple['MessageEntity', ...], List['MessageEntity']] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE, reply_markup: 'ReplyMarkup' = None, timeout: ODVInput[float] = DEFAULT_NONE, diff --git a/telegram/message.py b/telegram/message.py index 7d93dc945da..92fc529a15a 100644 --- a/telegram/message.py +++ b/telegram/message.py @@ -581,7 +581,9 @@ def to_dict(self) -> JSONDict: return data - def _quote(self, quote: Optional[bool], reply_to_message_id: Optional[int]) -> Optional[int]: + def _quote( + self, quote: Optional[bool], reply_to_message_id: Optional[Union[int, str]] + ) -> Optional[Union[int, str]]: """Modify kwargs for replying with or without quoting.""" if reply_to_message_id is not None: return reply_to_message_id @@ -606,7 +608,7 @@ def reply_text( parse_mode: ODVInput[str] = DEFAULT_NONE, disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: ReplyMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, @@ -650,7 +652,7 @@ def reply_markdown( text: str, disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: ReplyMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, @@ -704,7 +706,7 @@ def reply_markdown_v2( text: str, disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: ReplyMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, @@ -754,7 +756,7 @@ def reply_html( text: str, disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: ReplyMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, @@ -805,7 +807,7 @@ def reply_media_group( Union['InputMediaAudio', 'InputMediaDocument', 'InputMediaPhoto', 'InputMediaVideo'] ], disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, timeout: DVInput[float] = DEFAULT_20, api_kwargs: JSONDict = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, @@ -845,7 +847,7 @@ def reply_photo( photo: Union[FileInput, 'PhotoSize'], caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: ReplyMarkup = None, timeout: DVInput[float] = DEFAULT_20, parse_mode: ODVInput[str] = DEFAULT_NONE, @@ -895,7 +897,7 @@ def reply_audio( title: str = None, caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: ReplyMarkup = None, timeout: DVInput[float] = DEFAULT_20, parse_mode: ODVInput[str] = DEFAULT_NONE, @@ -948,7 +950,7 @@ def reply_document( filename: str = None, caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: ReplyMarkup = None, timeout: DVInput[float] = DEFAULT_20, parse_mode: ODVInput[str] = DEFAULT_NONE, @@ -1003,7 +1005,7 @@ def reply_animation( caption: str = None, parse_mode: ODVInput[str] = DEFAULT_NONE, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: ReplyMarkup = None, timeout: DVInput[float] = DEFAULT_20, api_kwargs: JSONDict = None, @@ -1052,7 +1054,7 @@ def reply_sticker( self, sticker: Union[FileInput, 'Sticker'], disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: ReplyMarkup = None, timeout: DVInput[float] = DEFAULT_20, api_kwargs: JSONDict = None, @@ -1093,7 +1095,7 @@ def reply_video( duration: int = None, caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: ReplyMarkup = None, timeout: DVInput[float] = DEFAULT_20, width: int = None, @@ -1150,7 +1152,7 @@ def reply_video_note( duration: int = None, length: int = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: ReplyMarkup = None, timeout: DVInput[float] = DEFAULT_20, thumb: FileInput = None, @@ -1197,7 +1199,7 @@ def reply_voice( duration: int = None, caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: ReplyMarkup = None, timeout: DVInput[float] = DEFAULT_20, parse_mode: ODVInput[str] = DEFAULT_NONE, @@ -1245,7 +1247,7 @@ def reply_location( latitude: float = None, longitude: float = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: ReplyMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, location: Location = None, @@ -1299,7 +1301,7 @@ def reply_venue( address: str = None, foursquare_id: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: ReplyMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, venue: Venue = None, @@ -1352,7 +1354,7 @@ def reply_contact( first_name: str = None, last_name: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: ReplyMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, contact: Contact = None, @@ -1403,7 +1405,7 @@ def reply_poll( correct_option_id: int = None, is_closed: bool = None, disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: ReplyMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, explanation: str = None, @@ -1457,7 +1459,7 @@ def reply_poll( def reply_dice( self, disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: ReplyMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, emoji: str = None, @@ -1522,7 +1524,7 @@ def reply_game( self, game_short_name: str, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: 'InlineKeyboardMarkup' = None, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, @@ -1578,7 +1580,7 @@ def reply_invoice( need_shipping_address: bool = None, is_flexible: bool = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: 'InlineKeyboardMarkup' = None, provider_data: Union[str, object] = None, send_phone_number_to_provider: bool = None, @@ -1673,7 +1675,7 @@ def copy( parse_mode: ODVInput[str] = DEFAULT_NONE, caption_entities: Union[Tuple['MessageEntity', ...], List['MessageEntity']] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE, reply_markup: ReplyMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, @@ -1711,12 +1713,12 @@ def copy( def reply_copy( self, from_chat_id: Union[str, int], - message_id: int, + message_id: Union[str, int], caption: str = None, parse_mode: ODVInput[str] = DEFAULT_NONE, caption_entities: Union[Tuple['MessageEntity', ...], List['MessageEntity']] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE, reply_markup: ReplyMarkup = None, timeout: ODVInput[float] = DEFAULT_NONE, diff --git a/telegram/user.py b/telegram/user.py index ede6f0bacb5..d28eb8494eb 100644 --- a/telegram/user.py +++ b/telegram/user.py @@ -221,7 +221,7 @@ def mention_html(self, name: str = None) -> str: def pin_message( self, - message_id: int, + message_id: Union[str, int], disable_notification: ODVInput[bool] = DEFAULT_NONE, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, @@ -250,7 +250,7 @@ def unpin_message( self, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - message_id: int = None, + message_id: Union[str, int] = None, ) -> bool: """Shortcut for:: @@ -301,7 +301,7 @@ def send_message( parse_mode: ODVInput[str] = DEFAULT_NONE, disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: 'ReplyMarkup' = None, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, @@ -337,7 +337,7 @@ def send_photo( photo: Union[FileInput, 'PhotoSize'], caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: 'ReplyMarkup' = None, timeout: DVInput[float] = DEFAULT_20, parse_mode: ODVInput[str] = DEFAULT_NONE, @@ -377,7 +377,7 @@ def send_media_group( Union['InputMediaAudio', 'InputMediaDocument', 'InputMediaPhoto', 'InputMediaVideo'] ], disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, timeout: DVInput[float] = DEFAULT_20, api_kwargs: JSONDict = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, @@ -410,7 +410,7 @@ def send_audio( title: str = None, caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: 'ReplyMarkup' = None, timeout: DVInput[float] = DEFAULT_20, parse_mode: ODVInput[str] = DEFAULT_NONE, @@ -481,7 +481,7 @@ def send_contact( first_name: str = None, last_name: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: 'ReplyMarkup' = None, timeout: ODVInput[float] = DEFAULT_NONE, contact: 'Contact' = None, @@ -517,7 +517,7 @@ def send_contact( def send_dice( self, disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: 'ReplyMarkup' = None, timeout: ODVInput[float] = DEFAULT_NONE, emoji: str = None, @@ -551,7 +551,7 @@ def send_document( filename: str = None, caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: 'ReplyMarkup' = None, timeout: DVInput[float] = DEFAULT_20, parse_mode: ODVInput[str] = DEFAULT_NONE, @@ -592,7 +592,7 @@ def send_game( self, game_short_name: str, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: 'InlineKeyboardMarkup' = None, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, @@ -638,7 +638,7 @@ def send_invoice( need_shipping_address: bool = None, is_flexible: bool = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: 'InlineKeyboardMarkup' = None, provider_data: Union[str, object] = None, send_phone_number_to_provider: bool = None, @@ -691,7 +691,7 @@ def send_location( latitude: float = None, longitude: float = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: 'ReplyMarkup' = None, timeout: ODVInput[float] = DEFAULT_NONE, location: 'Location' = None, @@ -739,7 +739,7 @@ def send_animation( caption: str = None, parse_mode: ODVInput[str] = DEFAULT_NONE, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: 'ReplyMarkup' = None, timeout: DVInput[float] = DEFAULT_20, api_kwargs: JSONDict = None, @@ -780,7 +780,7 @@ def send_sticker( self, sticker: Union[FileInput, 'Sticker'], disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: 'ReplyMarkup' = None, timeout: DVInput[float] = DEFAULT_20, api_kwargs: JSONDict = None, @@ -813,7 +813,7 @@ def send_video( duration: int = None, caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: 'ReplyMarkup' = None, timeout: DVInput[float] = DEFAULT_20, width: int = None, @@ -864,7 +864,7 @@ def send_venue( address: str = None, foursquare_id: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: 'ReplyMarkup' = None, timeout: ODVInput[float] = DEFAULT_NONE, venue: 'Venue' = None, @@ -909,7 +909,7 @@ def send_video_note( duration: int = None, length: int = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: 'ReplyMarkup' = None, timeout: DVInput[float] = DEFAULT_20, thumb: FileInput = None, @@ -948,7 +948,7 @@ def send_voice( duration: int = None, caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: 'ReplyMarkup' = None, timeout: DVInput[float] = DEFAULT_20, parse_mode: ODVInput[str] = DEFAULT_NONE, @@ -994,7 +994,7 @@ def send_poll( correct_option_id: int = None, is_closed: bool = None, disable_notification: ODVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, reply_markup: 'ReplyMarkup' = None, timeout: ODVInput[float] = DEFAULT_NONE, explanation: str = None, @@ -1040,12 +1040,12 @@ def send_poll( def send_copy( self, from_chat_id: Union[str, int], - message_id: int, + message_id: Union[str, int], caption: str = None, parse_mode: ODVInput[str] = DEFAULT_NONE, caption_entities: Union[Tuple['MessageEntity', ...], List['MessageEntity']] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE, reply_markup: 'ReplyMarkup' = None, timeout: ODVInput[float] = DEFAULT_NONE, @@ -1079,12 +1079,12 @@ def send_copy( def copy_message( self, chat_id: Union[int, str], - message_id: int, + message_id: Union[str, int], caption: str = None, parse_mode: ODVInput[str] = DEFAULT_NONE, caption_entities: Union[Tuple['MessageEntity', ...], List['MessageEntity']] = None, disable_notification: DVInput[bool] = DEFAULT_NONE, - reply_to_message_id: int = None, + reply_to_message_id: Union[int, str] = None, allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE, reply_markup: 'ReplyMarkup' = None, timeout: ODVInput[float] = DEFAULT_NONE, From 313d071d9fc759967bb689699c7c52cb7b9ab851 Mon Sep 17 00:00:00 2001 From: Hinrich Mahler Date: Sun, 14 Mar 2021 16:44:20 +0100 Subject: [PATCH 17/19] Add Starry & Harshil to credits --- AUTHORS.rst | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/AUTHORS.rst b/AUTHORS.rst index 4a584a310d6..80ef7b6d9fa 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -2,12 +2,20 @@ Credits ======= ``python-telegram-bot`` was originally created by -`Leandro Toledo `_ and is now maintained by `Hinrich Mahler `_. +`Leandro Toledo `_. +The current development team includes + +- `Hinrich Mahler `_ (maintainer) +- `Poolitzer `_ (community liaison) +- `Shivam `_ +- `Harshil `_ + Emeritus maintainers include `Jannes Höke `_ (`@jh0ker `_ on Telegram), `Noam Meltzer `_, `Pieter Schutz `_ and `Jasmin Bom `_. -The maintainers are actively supported by `Poolitzer `_ in terms of development and community liaison. +Vendored packages +----------------- We're vendoring urllib3 as part of ``python-telegram-bot`` which is distributed under the MIT license. For more info, full credits & license terms, the sources can be found here: From 5e6a294fceb7aba3036efe96e71402b05e4001f2 Mon Sep 17 00:00:00 2001 From: Hinrich Mahler Date: Sun, 14 Mar 2021 17:17:44 +0100 Subject: [PATCH 18/19] Try fixing docs --- .readthedocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 41af24d63bd..577b07920f3 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -17,6 +17,6 @@ formats: python: version: 3 install: - - method: pip + - method: setuptools path: . - requirements: docs/requirements-docs.txt From b5ed20d78c032789de90177e84751fbfe8d5b15e Mon Sep 17 00:00:00 2001 From: Hinrich Mahler Date: Sun, 14 Mar 2021 17:39:32 +0100 Subject: [PATCH 19/19] Alternate fix --- setup.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 762288fd06f..d847fff8aad 100644 --- a/setup.py +++ b/setup.py @@ -53,8 +53,9 @@ def get_setup_kwargs(raw=False): fn = os.path.join('telegram', 'version.py') with open(fn) as fh: - code = compile(fh.read(), fn, 'exec') - exec(code) + for line in fh.readlines(): + if line.startswith('__version__'): + exec(line) with open(readme, 'r', encoding='utf-8') as fd: pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy