From 7015f8dedc1e350581d748765905efc16120dc64 Mon Sep 17 00:00:00 2001 From: Bibo-Joshi Date: Sun, 14 Mar 2021 16:42:03 +0100 Subject: [PATCH] Type Hinting Fixes (#2425) Co-authored-by: poolitzer <25934244+Poolitzer@users.noreply.github.com> --- 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 95a6080d0..cf1b16d3c 100644 --- a/telegram/bot.py +++ b/telegram/bot.py @@ -264,7 +264,7 @@ class Bot(TelegramObject): 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, @@ -419,7 +419,7 @@ class Bot(TelegramObject): 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, @@ -487,7 +487,7 @@ class Bot(TelegramObject): 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: @@ -533,7 +533,7 @@ class Bot(TelegramObject): 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, @@ -581,11 +581,11 @@ class Bot(TelegramObject): @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, @@ -678,7 +678,7 @@ class Bot(TelegramObject): 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 @@ class Bot(TelegramObject): 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, @@ -904,7 +904,7 @@ class Bot(TelegramObject): 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, @@ -970,7 +970,7 @@ class Bot(TelegramObject): 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, @@ -1096,7 +1096,7 @@ class Bot(TelegramObject): 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 +1199,7 @@ class Bot(TelegramObject): 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, @@ -1312,7 +1312,7 @@ class Bot(TelegramObject): 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, @@ -1410,7 +1410,7 @@ class Bot(TelegramObject): 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, @@ -1467,7 +1467,7 @@ class Bot(TelegramObject): 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, @@ -1560,8 +1560,8 @@ class Bot(TelegramObject): 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, @@ -1649,8 +1649,8 @@ class Bot(TelegramObject): 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, @@ -1705,7 +1705,7 @@ class Bot(TelegramObject): 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, @@ -1815,7 +1815,7 @@ class Bot(TelegramObject): 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, @@ -1899,7 +1899,7 @@ class Bot(TelegramObject): 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, @@ -2421,8 +2421,8 @@ class Bot(TelegramObject): 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, @@ -2492,8 +2492,8 @@ class Bot(TelegramObject): 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, @@ -2567,8 +2567,8 @@ class Bot(TelegramObject): 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, @@ -2634,8 +2634,8 @@ class Bot(TelegramObject): 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, @@ -3154,8 +3154,8 @@ class Bot(TelegramObject): 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, @@ -3217,8 +3217,8 @@ class Bot(TelegramObject): 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]: @@ -3281,7 +3281,7 @@ class Bot(TelegramObject): 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, @@ -4103,7 +4103,7 @@ class Bot(TelegramObject): 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, @@ -4150,7 +4150,7 @@ class Bot(TelegramObject): 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 @@ -4634,7 +4634,7 @@ class Bot(TelegramObject): 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, @@ -4747,7 +4747,7 @@ class Bot(TelegramObject): 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, @@ -4794,7 +4794,7 @@ class Bot(TelegramObject): 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, @@ -4970,12 +4970,12 @@ class Bot(TelegramObject): 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 00ba5cbf5..95d0de9d9 100644 --- a/telegram/callbackquery.py +++ b/telegram/callbackquery.py @@ -598,7 +598,7 @@ class CallbackQuery(TelegramObject): 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 93e26ba3b..39fd25794 100644 --- a/telegram/chat.py +++ b/telegram/chat.py @@ -516,7 +516,7 @@ class Chat(TelegramObject): 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, @@ -546,7 +546,7 @@ class Chat(TelegramObject): self, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - message_id: Union[str, int] = None, + message_id: int = None, ) -> bool: """Shortcut for:: @@ -598,7 +598,7 @@ class Chat(TelegramObject): 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, @@ -635,7 +635,7 @@ class Chat(TelegramObject): 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, @@ -691,7 +691,7 @@ class Chat(TelegramObject): 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, @@ -731,7 +731,7 @@ class Chat(TelegramObject): 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, @@ -772,7 +772,7 @@ class Chat(TelegramObject): 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, @@ -817,7 +817,7 @@ class Chat(TelegramObject): 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, @@ -857,7 +857,7 @@ class Chat(TelegramObject): 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, @@ -889,7 +889,7 @@ class Chat(TelegramObject): 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, @@ -935,7 +935,7 @@ class Chat(TelegramObject): 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, @@ -988,7 +988,7 @@ class Chat(TelegramObject): 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, @@ -1036,7 +1036,7 @@ class Chat(TelegramObject): 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, @@ -1077,7 +1077,7 @@ class Chat(TelegramObject): 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, @@ -1112,7 +1112,7 @@ class Chat(TelegramObject): 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, @@ -1157,7 +1157,7 @@ class Chat(TelegramObject): 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, @@ -1206,7 +1206,7 @@ class Chat(TelegramObject): 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, @@ -1245,7 +1245,7 @@ class Chat(TelegramObject): 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, @@ -1291,7 +1291,7 @@ class Chat(TelegramObject): 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, @@ -1337,12 +1337,12 @@ class Chat(TelegramObject): 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, @@ -1376,12 +1376,12 @@ class Chat(TelegramObject): 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 e942db659..3ec746af5 100644 --- a/telegram/message.py +++ b/telegram/message.py @@ -636,9 +636,7 @@ class Message(TelegramObject): 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 @@ -663,7 +661,7 @@ class Message(TelegramObject): 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, @@ -707,7 +705,7 @@ class Message(TelegramObject): 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, @@ -761,7 +759,7 @@ class Message(TelegramObject): 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, @@ -811,7 +809,7 @@ class Message(TelegramObject): 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, @@ -862,7 +860,7 @@ class Message(TelegramObject): 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, @@ -902,7 +900,7 @@ class Message(TelegramObject): 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, @@ -952,7 +950,7 @@ class Message(TelegramObject): 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, @@ -1005,7 +1003,7 @@ class Message(TelegramObject): 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, @@ -1060,7 +1058,7 @@ class Message(TelegramObject): 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, @@ -1109,7 +1107,7 @@ class Message(TelegramObject): 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, @@ -1150,7 +1148,7 @@ class Message(TelegramObject): 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, @@ -1207,7 +1205,7 @@ class Message(TelegramObject): 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, @@ -1254,7 +1252,7 @@ class Message(TelegramObject): 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, @@ -1302,7 +1300,7 @@ class Message(TelegramObject): 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, @@ -1356,7 +1354,7 @@ class Message(TelegramObject): 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, @@ -1409,7 +1407,7 @@ class Message(TelegramObject): 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, @@ -1460,7 +1458,7 @@ class Message(TelegramObject): 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, @@ -1514,7 +1512,7 @@ class Message(TelegramObject): 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, @@ -1579,7 +1577,7 @@ class Message(TelegramObject): 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, @@ -1635,7 +1633,7 @@ class Message(TelegramObject): 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, @@ -1730,7 +1728,7 @@ class Message(TelegramObject): 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, @@ -1768,12 +1766,12 @@ class Message(TelegramObject): 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 6faef9dce..fee2a3135 100644 --- a/telegram/user.py +++ b/telegram/user.py @@ -221,7 +221,7 @@ class User(TelegramObject): 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 @@ class User(TelegramObject): 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 @@ class User(TelegramObject): 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 @@ class User(TelegramObject): 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 @@ class User(TelegramObject): 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 @@ class User(TelegramObject): 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 @@ class User(TelegramObject): 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 @@ class User(TelegramObject): 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 @@ class User(TelegramObject): 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 @@ class User(TelegramObject): 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 @@ class User(TelegramObject): 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 @@ class User(TelegramObject): 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 @@ class User(TelegramObject): 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 @@ class User(TelegramObject): 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 @@ class User(TelegramObject): 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 @@ class User(TelegramObject): 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 @@ class User(TelegramObject): 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 @@ class User(TelegramObject): 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 @@ class User(TelegramObject): 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 @@ class User(TelegramObject): 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 @@ class User(TelegramObject): 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,