diff --git a/telegram/_bot.py b/telegram/_bot.py index 41d7ff888..03d2125aa 100644 --- a/telegram/_bot.py +++ b/telegram/_bot.py @@ -157,6 +157,10 @@ class Bot(TelegramObject, AbstractAsyncContextManager): :class:`telegram.ext.Defaults`, please use the subclass :class:`telegram.ext.ExtBot` instead. * Attempting to pickle a bot instance will now raise :exc:`pickle.PicklingError`. + * The following are now keyword-only arguments in Bot methods: + ``location``, ``filename``, ``venue``, ``contact``, + ``{read, write, connect, pool}_timeout``, ``api_kwargs``. Use a named argument for those, + and notice that some positional arguments changed position as a result. Args: token (:obj:`str`): Bot's unique authentication token. @@ -276,6 +280,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): self, endpoint: str, data: JSONDict = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -323,12 +328,13 @@ class Bot(TelegramObject, AbstractAsyncContextManager): disable_notification: ODVInput[bool] = DEFAULT_NONE, reply_markup: ReplyMarkup = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> Union[bool, Message]: if reply_to_message_id is not None: data["reply_to_message_id"] = reply_to_message_id @@ -509,6 +515,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): @_log async def get_me( self, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -517,7 +524,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): ) -> User: """A simple method for testing your bot's auth token. Requires no parameters. - Args: + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -558,18 +565,19 @@ class Bot(TelegramObject, AbstractAsyncContextManager): chat_id: Union[int, str], text: str, parse_mode: ODVInput[str] = DEFAULT_NONE, + entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE, disable_notification: DVInput[bool] = DEFAULT_NONE, + protect_content: ODVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, reply_markup: ReplyMarkup = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> Message: """Use this method to send text messages. @@ -601,6 +609,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): :class:`ReplyKeyboardRemove` | :class:`ForceReply`, optional): Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -640,12 +650,12 @@ class Bot(TelegramObject, AbstractAsyncContextManager): disable_notification=disable_notification, reply_markup=reply_markup, allow_sending_without_reply=allow_sending_without_reply, + protect_content=protect_content, read_timeout=read_timeout, write_timeout=write_timeout, connect_timeout=connect_timeout, pool_timeout=pool_timeout, api_kwargs=api_kwargs, - protect_content=protect_content, ) @_log @@ -653,6 +663,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): self, chat_id: Union[str, int], message_id: int, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -678,6 +689,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): chat_id (:obj:`int` | :obj:`str`): Unique identifier for the target chat or username of the target channel (in the format ``@channelusername``). message_id (:obj:`int`): Identifier of the message to delete. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -719,14 +732,16 @@ class Bot(TelegramObject, AbstractAsyncContextManager): from_chat_id: Union[str, int], message_id: int, disable_notification: DVInput[bool] = DEFAULT_NONE, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> Message: - """Use this method to forward messages of any kind. Service messages can't be forwarded. + """ + Use this method to forward messages of any kind. Service messages can't be forwarded. Note: Since the release of Bot API 5.5 it can be impossible to forward messages from @@ -749,6 +764,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): .. versionadded:: 13.10 + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -769,7 +785,6 @@ class Bot(TelegramObject, AbstractAsyncContextManager): Raises: :class:`telegram.error.TelegramError` - """ data: JSONDict = {} @@ -783,12 +798,12 @@ class Bot(TelegramObject, AbstractAsyncContextManager): "forwardMessage", data, disable_notification=disable_notification, + protect_content=protect_content, read_timeout=read_timeout, write_timeout=write_timeout, connect_timeout=connect_timeout, pool_timeout=pool_timeout, api_kwargs=api_kwargs, - protect_content=protect_content, ) @_log @@ -800,16 +815,17 @@ class Bot(TelegramObject, AbstractAsyncContextManager): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, + parse_mode: ODVInput[str] = DEFAULT_NONE, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + filename: str = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - parse_mode: ODVInput[str] = DEFAULT_NONE, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, - filename: str = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> Message: """Use this method to send photos. @@ -829,11 +845,6 @@ class Bot(TelegramObject, AbstractAsyncContextManager): .. versionchanged:: 13.2 Accept :obj:`bytes` as input. - filename (:obj:`str`, optional): Custom file name for the photo, when uploading a - new file. Convenience parameter, useful e.g. when sending files generated by the - :obj:`tempfile` module. - - .. versionadded:: 13.1 caption (:obj:`str`, optional): Photo caption (may also be used when resending photos by file_id), 0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters after entities parsing. @@ -858,6 +869,13 @@ class Bot(TelegramObject, AbstractAsyncContextManager): :class:`ReplyKeyboardRemove` | :class:`ForceReply`, optional): Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. + + Keyword Args: + filename (:obj:`str`, optional): Custom file name for the photo, when uploading a + new file. Convenience parameter, useful e.g. when sending files generated by the + :obj:`tempfile` module. + + .. versionadded:: 13.1 read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -898,12 +916,12 @@ class Bot(TelegramObject, AbstractAsyncContextManager): disable_notification=disable_notification, reply_markup=reply_markup, allow_sending_without_reply=allow_sending_without_reply, + protect_content=protect_content, read_timeout=read_timeout, write_timeout=write_timeout, connect_timeout=connect_timeout, pool_timeout=pool_timeout, api_kwargs=api_kwargs, - protect_content=protect_content, ) @_log @@ -918,17 +936,18 @@ class Bot(TelegramObject, AbstractAsyncContextManager): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, + parse_mode: ODVInput[str] = DEFAULT_NONE, + thumb: FileInput = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + filename: str = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - parse_mode: ODVInput[str] = DEFAULT_NONE, - thumb: FileInput = None, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, - filename: str = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> Message: """ Use this method to send audio files, if you want Telegram clients to display them in the @@ -956,11 +975,6 @@ class Bot(TelegramObject, AbstractAsyncContextManager): .. versionchanged:: 13.2 Accept :obj:`bytes` as input. - filename (:obj:`str`, optional): Custom file name for the audio, when uploading a - new file. Convenience parameter, useful e.g. when sending files generated by the - :obj:`tempfile` module. - - .. versionadded:: 13.1 caption (:obj:`str`, optional): Audio caption, 0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters after entities parsing. @@ -997,6 +1011,13 @@ class Bot(TelegramObject, AbstractAsyncContextManager): .. versionchanged:: 13.2 Accept :obj:`bytes` as input. + + Keyword Args: + filename (:obj:`str`, optional): Custom file name for the audio, when uploading a + new file. Convenience parameter, useful e.g. when sending files generated by the + :obj:`tempfile` module. + + .. versionadded:: 13.1 read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -1045,12 +1066,12 @@ class Bot(TelegramObject, AbstractAsyncContextManager): disable_notification=disable_notification, reply_markup=reply_markup, allow_sending_without_reply=allow_sending_without_reply, + protect_content=protect_content, read_timeout=read_timeout, write_timeout=write_timeout, connect_timeout=connect_timeout, pool_timeout=pool_timeout, api_kwargs=api_kwargs, - protect_content=protect_content, ) @_log @@ -1058,22 +1079,23 @@ class Bot(TelegramObject, AbstractAsyncContextManager): self, chat_id: Union[int, str], document: Union[FileInput, "Document"], - filename: str = None, caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, - read_timeout: ODVInput[float] = DEFAULT_NONE, - write_timeout: ODVInput[float] = 20, - connect_timeout: ODVInput[float] = DEFAULT_NONE, - pool_timeout: ODVInput[float] = DEFAULT_NONE, parse_mode: ODVInput[str] = DEFAULT_NONE, thumb: FileInput = None, - api_kwargs: JSONDict = None, disable_content_type_detection: bool = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + filename: str = None, + read_timeout: ODVInput[float] = DEFAULT_NONE, + write_timeout: ODVInput[float] = 20, + connect_timeout: ODVInput[float] = DEFAULT_NONE, + pool_timeout: ODVInput[float] = DEFAULT_NONE, + api_kwargs: JSONDict = None, ) -> Message: """ Use this method to send general files. @@ -1100,9 +1122,6 @@ class Bot(TelegramObject, AbstractAsyncContextManager): .. versionchanged:: 13.2 Accept :obj:`bytes` as input. - filename (:obj:`str`, optional): Custom file name for the document, when uploading a - new file. Convenience parameter, useful e.g. when sending files generated by the - :obj:`tempfile` module. caption (:obj:`str`, optional): Document caption (may also be used when resending documents by file_id), 0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters after entities parsing. @@ -1138,6 +1157,11 @@ class Bot(TelegramObject, AbstractAsyncContextManager): .. versionchanged:: 13.2 Accept :obj:`bytes` as input. + + Keyword Args: + filename (:obj:`str`, optional): Custom file name for the document, when uploading a + new file. Convenience parameter, useful e.g. when sending files generated by the + :obj:`tempfile` module. read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -1182,12 +1206,12 @@ class Bot(TelegramObject, AbstractAsyncContextManager): disable_notification=disable_notification, reply_markup=reply_markup, allow_sending_without_reply=allow_sending_without_reply, + protect_content=protect_content, read_timeout=read_timeout, write_timeout=write_timeout, connect_timeout=connect_timeout, pool_timeout=pool_timeout, api_kwargs=api_kwargs, - protect_content=protect_content, ) @_log @@ -1198,13 +1222,14 @@ class Bot(TelegramObject, AbstractAsyncContextManager): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> Message: """ Use this method to send static ``.WEBP``, animated ``.TGS``, or video ``.WEBM`` stickers. @@ -1240,6 +1265,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): :class:`ReplyKeyboardRemove` | :class:`ForceReply`, optional): Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -1269,12 +1296,12 @@ class Bot(TelegramObject, AbstractAsyncContextManager): disable_notification=disable_notification, reply_markup=reply_markup, allow_sending_without_reply=allow_sending_without_reply, + protect_content=protect_content, read_timeout=read_timeout, write_timeout=write_timeout, connect_timeout=connect_timeout, pool_timeout=pool_timeout, api_kwargs=api_kwargs, - protect_content=protect_content, ) @_log @@ -1287,20 +1314,21 @@ class Bot(TelegramObject, AbstractAsyncContextManager): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, - read_timeout: ODVInput[float] = DEFAULT_NONE, - write_timeout: ODVInput[float] = 20, - connect_timeout: ODVInput[float] = DEFAULT_NONE, - pool_timeout: ODVInput[float] = DEFAULT_NONE, width: int = None, height: int = None, parse_mode: ODVInput[str] = DEFAULT_NONE, supports_streaming: bool = None, thumb: FileInput = None, - api_kwargs: JSONDict = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, - filename: str = None, protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + filename: str = None, + read_timeout: ODVInput[float] = DEFAULT_NONE, + write_timeout: ODVInput[float] = 20, + connect_timeout: ODVInput[float] = DEFAULT_NONE, + pool_timeout: ODVInput[float] = DEFAULT_NONE, + api_kwargs: JSONDict = None, ) -> Message: """ Use this method to send video files, Telegram clients support mp4 videos @@ -1329,11 +1357,6 @@ class Bot(TelegramObject, AbstractAsyncContextManager): .. versionchanged:: 13.2 Accept :obj:`bytes` as input. - filename (:obj:`str`, optional): Custom file name for the video, when uploading a - new file. Convenience parameter, useful e.g. when sending files generated by the - :obj:`tempfile` module. - - .. versionadded:: 13.1 duration (:obj:`int`, optional): Duration of sent video in seconds. width (:obj:`int`, optional): Video width. height (:obj:`int`, optional): Video height. @@ -1372,6 +1395,13 @@ class Bot(TelegramObject, AbstractAsyncContextManager): .. versionchanged:: 13.2 Accept :obj:`bytes` as input. + + Keyword Args: + filename (:obj:`str`, optional): Custom file name for the video, when uploading a + new file. Convenience parameter, useful e.g. when sending files generated by the + :obj:`tempfile` module. + + .. versionadded:: 13.1 read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -1421,12 +1451,12 @@ class Bot(TelegramObject, AbstractAsyncContextManager): disable_notification=disable_notification, reply_markup=reply_markup, allow_sending_without_reply=allow_sending_without_reply, + protect_content=protect_content, read_timeout=read_timeout, write_timeout=write_timeout, connect_timeout=connect_timeout, pool_timeout=pool_timeout, api_kwargs=api_kwargs, - protect_content=protect_content, ) @_log @@ -1439,15 +1469,16 @@ class Bot(TelegramObject, AbstractAsyncContextManager): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, + thumb: FileInput = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + filename: str = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - thumb: FileInput = None, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - filename: str = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> Message: """ As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long. @@ -1472,11 +1503,6 @@ class Bot(TelegramObject, AbstractAsyncContextManager): .. versionchanged:: 13.2 Accept :obj:`bytes` as input. - filename (:obj:`str`, optional): Custom file name for the video note, when uploading a - new file. Convenience parameter, useful e.g. when sending files generated by the - :obj:`tempfile` module. - - .. versionadded:: 13.1 duration (:obj:`int`, optional): Duration of sent video in seconds. length (:obj:`int`, optional): Video width and height, i.e. diameter of the video message. @@ -1504,6 +1530,13 @@ class Bot(TelegramObject, AbstractAsyncContextManager): .. versionchanged:: 13.2 Accept :obj:`bytes` as input. + + Keyword Args: + filename (:obj:`str`, optional): Custom file name for the video note, when uploading a + new file. Convenience parameter, useful e.g. when sending files generated by the + :obj:`tempfile` module. + + .. versionadded:: 13.1 read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -1544,12 +1577,12 @@ class Bot(TelegramObject, AbstractAsyncContextManager): disable_notification=disable_notification, reply_markup=reply_markup, allow_sending_without_reply=allow_sending_without_reply, + protect_content=protect_content, read_timeout=read_timeout, write_timeout=write_timeout, connect_timeout=connect_timeout, pool_timeout=pool_timeout, api_kwargs=api_kwargs, - protect_content=protect_content, ) @_log @@ -1566,15 +1599,16 @@ class Bot(TelegramObject, AbstractAsyncContextManager): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + filename: str = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, - filename: str = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> Message: """ Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). @@ -1599,11 +1633,6 @@ class Bot(TelegramObject, AbstractAsyncContextManager): .. versionchanged:: 13.2 Accept :obj:`bytes` as input. - filename (:obj:`str`, optional): Custom file name for the animation, when uploading a - new file. Convenience parameter, useful e.g. when sending files generated by the - :obj:`tempfile` module. - - .. versionadded:: 13.1 duration (:obj:`int`, optional): Duration of sent animation in seconds. width (:obj:`int`, optional): Animation width. height (:obj:`int`, optional): Animation height. @@ -1641,6 +1670,13 @@ class Bot(TelegramObject, AbstractAsyncContextManager): :class:`ReplyKeyboardRemove` | :class:`ForceReply`, optional): Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. + + Keyword Args: + filename (:obj:`str`, optional): Custom file name for the animation, when uploading a + new file. Convenience parameter, useful e.g. when sending files generated by the + :obj:`tempfile` module. + + .. versionadded:: 13.1 read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -1688,12 +1724,12 @@ class Bot(TelegramObject, AbstractAsyncContextManager): disable_notification=disable_notification, reply_markup=reply_markup, allow_sending_without_reply=allow_sending_without_reply, + protect_content=protect_content, read_timeout=read_timeout, write_timeout=write_timeout, connect_timeout=connect_timeout, pool_timeout=pool_timeout, api_kwargs=api_kwargs, - protect_content=protect_content, ) @_log @@ -1706,16 +1742,17 @@ class Bot(TelegramObject, AbstractAsyncContextManager): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, + parse_mode: ODVInput[str] = DEFAULT_NONE, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + filename: str = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - parse_mode: ODVInput[str] = DEFAULT_NONE, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, - filename: str = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> Message: """ Use this method to send audio files, if you want Telegram clients to display the file @@ -1743,11 +1780,6 @@ class Bot(TelegramObject, AbstractAsyncContextManager): .. versionchanged:: 13.2 Accept :obj:`bytes` as input. - filename (:obj:`str`, optional): Custom file name for the voice, when uploading a - new file. Convenience parameter, useful e.g. when sending files generated by the - :obj:`tempfile` module. - - .. versionadded:: 13.1 caption (:obj:`str`, optional): Voice message caption, 0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters after entities parsing. @@ -1773,6 +1805,13 @@ class Bot(TelegramObject, AbstractAsyncContextManager): :class:`ReplyKeyboardRemove` | :class:`ForceReply`, optional): Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. + + Keyword Args: + filename (:obj:`str`, optional): Custom file name for the voice, when uploading a + new file. Convenience parameter, useful e.g. when sending files generated by the + :obj:`tempfile` module. + + .. versionadded:: 13.1 read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -1815,12 +1854,12 @@ class Bot(TelegramObject, AbstractAsyncContextManager): disable_notification=disable_notification, reply_markup=reply_markup, allow_sending_without_reply=allow_sending_without_reply, + protect_content=protect_content, read_timeout=read_timeout, write_timeout=write_timeout, connect_timeout=connect_timeout, pool_timeout=pool_timeout, api_kwargs=api_kwargs, - protect_content=protect_content, ) @_log @@ -1832,13 +1871,14 @@ class Bot(TelegramObject, AbstractAsyncContextManager): ], disable_notification: ODVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> List[Message]: """Use this method to send a group of photos or videos as an album. @@ -1859,6 +1899,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): original message. allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message should be sent even if the specified replied-to message is not found. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -1911,18 +1953,19 @@ class Bot(TelegramObject, AbstractAsyncContextManager): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, - read_timeout: ODVInput[float] = DEFAULT_NONE, - write_timeout: ODVInput[float] = DEFAULT_NONE, - connect_timeout: ODVInput[float] = DEFAULT_NONE, - pool_timeout: ODVInput[float] = DEFAULT_NONE, - location: Location = None, live_period: int = None, - api_kwargs: JSONDict = None, horizontal_accuracy: float = None, heading: int = None, proximity_alert_radius: int = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + location: Location = None, + read_timeout: ODVInput[float] = DEFAULT_NONE, + write_timeout: ODVInput[float] = DEFAULT_NONE, + connect_timeout: ODVInput[float] = DEFAULT_NONE, + pool_timeout: ODVInput[float] = DEFAULT_NONE, + api_kwargs: JSONDict = None, ) -> Message: """Use this method to send point on the map. @@ -1935,7 +1978,6 @@ class Bot(TelegramObject, AbstractAsyncContextManager): of the target channel (in the format ``@channelusername``). latitude (:obj:`float`, optional): Latitude of location. longitude (:obj:`float`, optional): Longitude of location. - location (:class:`telegram.Location`, optional): The location to send. horizontal_accuracy (:obj:`int`, optional): The radius of uncertainty for the location, measured in meters; 0-:tg-const:`telegram.constants.LocationLimit.HORIZONTAL_ACCURACY`. @@ -1962,6 +2004,9 @@ class Bot(TelegramObject, AbstractAsyncContextManager): :class:`ReplyKeyboardRemove` | :class:`ForceReply`, optional): Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. + + Keyword Args: + location (:class:`telegram.Location`, optional): The location to send. read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -2016,12 +2061,12 @@ class Bot(TelegramObject, AbstractAsyncContextManager): disable_notification=disable_notification, reply_markup=reply_markup, allow_sending_without_reply=allow_sending_without_reply, + protect_content=protect_content, read_timeout=read_timeout, write_timeout=write_timeout, connect_timeout=connect_timeout, pool_timeout=pool_timeout, api_kwargs=api_kwargs, - protect_content=protect_content, ) @_log @@ -2032,16 +2077,17 @@ class Bot(TelegramObject, AbstractAsyncContextManager): inline_message_id: int = None, latitude: float = None, longitude: float = None, - location: Location = None, reply_markup: InlineKeyboardMarkup = None, + horizontal_accuracy: float = None, + heading: int = None, + proximity_alert_radius: int = None, + *, + location: Location = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - horizontal_accuracy: float = None, - heading: int = None, - proximity_alert_radius: int = None, ) -> 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:`telegram.Location.live_period` @@ -2061,7 +2107,6 @@ class Bot(TelegramObject, AbstractAsyncContextManager): specified. Identifier of the inline message. latitude (:obj:`float`, optional): Latitude of location. longitude (:obj:`float`, optional): Longitude of location. - location (:class:`telegram.Location`, optional): The location to send. horizontal_accuracy (:obj:`float`, optional): The radius of uncertainty for the location, measured in meters; 0-:tg-const:`telegram.constants.LocationLimit.HORIZONTAL_ACCURACY`. @@ -2072,6 +2117,9 @@ class Bot(TelegramObject, AbstractAsyncContextManager): :tg-const:`telegram.constants.LocationLimit.HEADING` if specified. reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): An object for a new inline keyboard. + + Keyword Args: + location (:class:`telegram.Location`, optional): The location to send. read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -2139,6 +2187,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): message_id: int = None, inline_message_id: int = None, reply_markup: InlineKeyboardMarkup = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -2158,6 +2207,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): specified. Identifier of the inline message. reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): An object for a new inline keyboard. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -2209,17 +2260,18 @@ class Bot(TelegramObject, AbstractAsyncContextManager): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, - read_timeout: ODVInput[float] = DEFAULT_NONE, - write_timeout: ODVInput[float] = DEFAULT_NONE, - connect_timeout: ODVInput[float] = DEFAULT_NONE, - pool_timeout: ODVInput[float] = DEFAULT_NONE, - venue: Venue = None, foursquare_type: str = None, - api_kwargs: JSONDict = None, google_place_id: str = None, google_place_type: str = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + venue: Venue = None, + read_timeout: ODVInput[float] = DEFAULT_NONE, + write_timeout: ODVInput[float] = DEFAULT_NONE, + connect_timeout: ODVInput[float] = DEFAULT_NONE, + pool_timeout: ODVInput[float] = DEFAULT_NONE, + api_kwargs: JSONDict = None, ) -> Message: """Use this method to send information about a venue. @@ -2247,7 +2299,6 @@ class Bot(TelegramObject, AbstractAsyncContextManager): google_place_type (:obj:`str`, optional): Google Places type of the venue. (See `supported types \ `_.) - venue (:class:`telegram.Venue`, optional): The venue to send. disable_notification (:obj:`bool`, optional): Sends the message silently. Users will receive a notification with no sound. protect_content (:obj:`bool`, optional): Protects the contents of the sent message from @@ -2263,6 +2314,9 @@ class Bot(TelegramObject, AbstractAsyncContextManager): :class:`ReplyKeyboardRemove` | :class:`ForceReply`, optional): Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. + + Keyword Args: + venue (:class:`telegram.Venue`, optional): The venue to send. read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -2332,12 +2386,12 @@ class Bot(TelegramObject, AbstractAsyncContextManager): disable_notification=disable_notification, reply_markup=reply_markup, allow_sending_without_reply=allow_sending_without_reply, + protect_content=protect_content, read_timeout=read_timeout, write_timeout=write_timeout, connect_timeout=connect_timeout, pool_timeout=pool_timeout, api_kwargs=api_kwargs, - protect_content=protect_content, ) @_log @@ -2350,15 +2404,16 @@ class Bot(TelegramObject, AbstractAsyncContextManager): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, + vcard: str = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + contact: Contact = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - contact: Contact = None, - vcard: str = None, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> Message: """Use this method to send phone contacts. @@ -2375,7 +2430,6 @@ class Bot(TelegramObject, AbstractAsyncContextManager): last_name (:obj:`str`, optional): Contact's last name. vcard (:obj:`str`, optional): Additional data about the contact in the form of a vCard, 0-2048 bytes. - contact (:class:`telegram.Contact`, optional): The contact to send. disable_notification (:obj:`bool`, optional): Sends the message silently. Users will receive a notification with no sound. protect_content (:obj:`bool`, optional): Protects the contents of the sent message from @@ -2391,6 +2445,9 @@ class Bot(TelegramObject, AbstractAsyncContextManager): :class:`ReplyKeyboardRemove` | :class:`ForceReply`, optional): Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. + + Keyword Args: + contact (:class:`telegram.Contact`, optional): The contact to send. read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -2449,12 +2506,12 @@ class Bot(TelegramObject, AbstractAsyncContextManager): disable_notification=disable_notification, reply_markup=reply_markup, allow_sending_without_reply=allow_sending_without_reply, + protect_content=protect_content, read_timeout=read_timeout, write_timeout=write_timeout, connect_timeout=connect_timeout, pool_timeout=pool_timeout, api_kwargs=api_kwargs, - protect_content=protect_content, ) @_log @@ -2465,13 +2522,14 @@ class Bot(TelegramObject, AbstractAsyncContextManager): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: InlineKeyboardMarkup = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> Message: """Use this method to send a game. @@ -2493,6 +2551,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): An object for a new inline keyboard. If empty, one ‘Play game_title’ button will be shown. If not empty, the first button must launch the game. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -2524,12 +2584,12 @@ class Bot(TelegramObject, AbstractAsyncContextManager): disable_notification=disable_notification, reply_markup=reply_markup, allow_sending_without_reply=allow_sending_without_reply, + protect_content=protect_content, read_timeout=read_timeout, write_timeout=write_timeout, connect_timeout=connect_timeout, pool_timeout=pool_timeout, api_kwargs=api_kwargs, - protect_content=protect_content, ) @_log @@ -2537,6 +2597,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): self, chat_id: Union[str, int], action: str, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -2555,6 +2616,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): action(:obj:`str`): Type of action to broadcast. Choose one, depending on what the user is about to receive. For convenience look at the constants in :class:`telegram.constants.ChatAction`. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -2678,11 +2741,12 @@ class Bot(TelegramObject, AbstractAsyncContextManager): next_offset: str = None, switch_pm_text: str = None, switch_pm_parameter: str = None, + *, + current_offset: str = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - current_offset: str = None, api_kwargs: JSONDict = None, ) -> bool: """ @@ -2719,6 +2783,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): :guilabel:`/start` message sent to the bot when user presses the switch button. 1-:tg-const:`telegram.InlineQuery.MAX_SWITCH_PM_TEXT_LENGTH` characters, only ``A-Z``, ``a-z``, ``0-9``, ``_`` and ``-`` are allowed. + + Keyword Args: current_offset (:obj:`str`, optional): The :attr:`telegram.InlineQuery.offset` of the inline query to answer. If passed, PTB will automatically take care of the pagination for you, i.e. pass the correct :paramref:`next_offset` and truncate @@ -2791,6 +2857,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): user_id: Union[str, int], offset: int = None, limit: int = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -2805,6 +2872,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): By default, all photos are returned. limit (:obj:`int`, optional): Limits the number of photos to be retrieved. Values between 1-100 are accepted. Defaults to ``100``. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -2852,6 +2921,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): file_id: Union[ str, Animation, Audio, ChatPhoto, Document, PhotoSize, Sticker, Video, VideoNote, Voice ], + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -2880,6 +2950,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): :class:`telegram.Voice`): Either the file identifier or an object that has a file_id attribute to get file information about. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -2933,13 +3005,14 @@ class Bot(TelegramObject, AbstractAsyncContextManager): self, chat_id: Union[str, int], user_id: Union[str, int], + until_date: Union[int, datetime] = None, + revoke_messages: bool = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - until_date: Union[int, datetime] = None, api_kwargs: JSONDict = None, - revoke_messages: bool = None, ) -> bool: """ Use this method to ban a user from a group, supergroup or a channel. In the case of @@ -2953,18 +3026,6 @@ class Bot(TelegramObject, AbstractAsyncContextManager): chat_id (:obj:`int` | :obj:`str`): Unique identifier for the target group or username of the target supergroup or channel (in the format ``@channelusername``). user_id (:obj:`int`): Unique identifier of the target user. - read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to - :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to - :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. - write_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to - :paramref:`telegram.request.BaseRequest.post.write_timeout`. Defaults to - :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. - connect_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to - :paramref:`telegram.request.BaseRequest.post.connect_timeout`. Defaults to - :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. - pool_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to - :paramref:`telegram.request.BaseRequest.post.pool_timeout`. Defaults to - :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. until_date (:obj:`int` | :obj:`datetime.datetime`, optional): Date when the user will be unbanned, unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever. Applied @@ -2977,6 +3038,20 @@ class Bot(TelegramObject, AbstractAsyncContextManager): Always :obj:`True` for supergroups and channels. .. versionadded:: 13.4 + + Keyword Args: + read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to + :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to + :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. + write_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to + :paramref:`telegram.request.BaseRequest.post.write_timeout`. Defaults to + :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. + connect_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to + :paramref:`telegram.request.BaseRequest.post.connect_timeout`. Defaults to + :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. + pool_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to + :paramref:`telegram.request.BaseRequest.post.pool_timeout`. Defaults to + :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. api_kwargs (:obj:`dict`, optional): Arbitrary keyword arguments to be passed to the Telegram API. @@ -3012,6 +3087,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): self, chat_id: Union[str, int], sender_chat_id: int, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -3030,6 +3106,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): chat_id (:obj:`int` | :obj:`str`): Unique identifier for the target group or username of the target supergroup or channel (in the format ``@channelusername``). sender_chat_id (:obj:`int`): Unique identifier of the target sender chat. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -3071,12 +3149,13 @@ class Bot(TelegramObject, AbstractAsyncContextManager): self, chat_id: Union[str, int], user_id: Union[str, int], + only_if_banned: bool = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - only_if_banned: bool = None, ) -> bool: """Use this method to unban a previously kicked user in a supergroup or channel. @@ -3091,6 +3170,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): of the target supergroup or channel (in the format ``@channelusername``). user_id (:obj:`int`): Unique identifier of the target user. only_if_banned (:obj:`bool`, optional): Do nothing if the user is not banned. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -3135,6 +3216,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): self, chat_id: Union[str, int], sender_chat_id: int, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -3151,6 +3233,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): chat_id (:obj:`int` | :obj:`str`): Unique identifier for the target chat or username of the target supergroup or channel (in the format ``@channelusername``). sender_chat_id (:obj:`int`): Unique identifier of the target sender chat. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -3195,6 +3279,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): show_alert: bool = None, url: str = None, cache_time: int = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -3226,6 +3311,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): your bot with a parameter. cache_time (:obj:`int`, optional): The maximum amount of time in seconds that the result of the callback query may be cached client-side. Defaults to 0. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -3281,12 +3368,13 @@ class Bot(TelegramObject, AbstractAsyncContextManager): parse_mode: ODVInput[str] = DEFAULT_NONE, disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE, reply_markup: InlineKeyboardMarkup = None, + entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, ) -> Union[Message, bool]: """ Use this method to edit text and game messages. @@ -3312,6 +3400,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): this message. reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): An object for an inline keyboard. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -3366,16 +3456,17 @@ class Bot(TelegramObject, AbstractAsyncContextManager): self, chat_id: Union[str, int] = None, message_id: int = None, - inline_message_id: int = None, + inline_message_id: str = None, caption: str = None, reply_markup: InlineKeyboardMarkup = None, + parse_mode: ODVInput[str] = DEFAULT_NONE, + caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - parse_mode: ODVInput[str] = DEFAULT_NONE, api_kwargs: JSONDict = None, - caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, ) -> Union[Message, bool]: """ Use this method to edit captions of messages. @@ -3399,6 +3490,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): :paramref:`parse_mode`. reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): An object for an inline keyboard. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -3454,6 +3547,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): message_id: int = None, inline_message_id: int = None, reply_markup: InlineKeyboardMarkup = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -3479,6 +3573,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): specified. Identifier of the inline message. reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): An object for an inline keyboard. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -3528,6 +3624,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): message_id: int = None, inline_message_id: int = None, reply_markup: Optional["InlineKeyboardMarkup"] = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -3548,6 +3645,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): specified. Identifier of the inline message. reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): An object for an inline keyboard. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -3597,11 +3696,12 @@ class Bot(TelegramObject, AbstractAsyncContextManager): offset: int = None, limit: int = None, timeout: float = None, + allowed_updates: List[str] = None, + *, read_timeout: float = 2, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - allowed_updates: List[str] = None, api_kwargs: JSONDict = None, ) -> List[Update]: """Use this method to receive incoming updates using long polling. @@ -3619,6 +3719,17 @@ class Bot(TelegramObject, AbstractAsyncContextManager): timeout (:obj:`int`, optional): Timeout in seconds for long polling. Defaults to ``0``, i.e. usual short polling. Should be positive, short polling should be used for testing purposes only. + allowed_updates (List[:obj:`str`]), optional): A list the types of + updates you want your bot to receive. For example, specify ["message", + "edited_channel_post", "callback_query"] to only receive updates of these types. + See :class:`telegram.Update` for a complete list of available update types. + Specify an empty list to receive all updates except + :attr:`telegram.Update.chat_member` (default). If not specified, the previous + setting will be used. Please note that this parameter doesn't affect updates + created before the call to the get_updates, so unwanted updates may be received for + a short period of time. + + Keyword Args: read_timeout (:obj:`float`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to ``2``. :paramref:`timeout` will be added to this value. @@ -3631,15 +3742,6 @@ class Bot(TelegramObject, AbstractAsyncContextManager): pool_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.pool_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. - allowed_updates (List[:obj:`str`]), optional): A list the types of - updates you want your bot to receive. For example, specify ["message", - "edited_channel_post", "callback_query"] to only receive updates of these types. - See :class:`telegram.Update` for a complete list of available update types. - Specify an empty list to receive all updates except - :attr:`telegram.Update.chat_member` (default). If not specified, the previous - setting will be used. Please note that this parameter doesn't affect updates - created before the call to the get_updates, so unwanted updates may be received for - a short period of time. api_kwargs (:obj:`dict`, optional): Arbitrary keyword arguments to be passed to the Telegram API. @@ -3695,15 +3797,16 @@ class Bot(TelegramObject, AbstractAsyncContextManager): self, url: str, certificate: FileInput = None, + max_connections: int = None, + allowed_updates: List[str] = None, + ip_address: str = None, + drop_pending_updates: bool = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - max_connections: int = None, - allowed_updates: List[str] = None, api_kwargs: JSONDict = None, - ip_address: str = None, - drop_pending_updates: bool = None, ) -> bool: """ Use this method to specify a url and receive incoming updates via an outgoing webhook. @@ -3741,6 +3844,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): a short period of time. drop_pending_updates (:obj:`bool`, optional): Pass :obj:`True` to drop all pending updates. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -3805,12 +3910,13 @@ class Bot(TelegramObject, AbstractAsyncContextManager): @_log async def delete_webhook( self, + drop_pending_updates: bool = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - drop_pending_updates: bool = None, ) -> bool: """ Use this method to remove webhook integration if you decide to switch back to @@ -3819,6 +3925,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): Args: drop_pending_updates (:obj:`bool`, optional): Pass :obj:`True` to drop all pending updates. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -3862,6 +3970,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): async def leave_chat( self, chat_id: Union[str, int], + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -3873,6 +3982,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): Args: chat_id (:obj:`int` | :obj:`str`): Unique identifier for the target chat or username of the target supergroup or channel (in the format ``@channelusername``). + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -3913,6 +4024,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): async def get_chat( self, chat_id: Union[str, int], + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -3926,6 +4038,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): Args: chat_id (:obj:`int` | :obj:`str`): Unique identifier for the target chat or username of the target supergroup or channel (in the format ``@channelusername``). + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -3966,6 +4080,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): async def get_chat_administrators( self, chat_id: Union[str, int], + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -3978,6 +4093,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): Args: chat_id (:obj:`int` | :obj:`str`): Unique identifier for the target chat or username of the target supergroup or channel (in the format ``@channelusername``). + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -4019,6 +4136,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): async def get_chat_member_count( self, chat_id: Union[str, int], + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -4032,6 +4150,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): Args: chat_id (:obj:`int` | :obj:`str`): Unique identifier for the target chat or username of the target supergroup or channel (in the format ``@channelusername``). + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -4071,6 +4191,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): self, chat_id: Union[str, int], user_id: Union[str, int], + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -4083,6 +4204,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): chat_id (:obj:`int` | :obj:`str`): Unique identifier for the target chat or username of the target supergroup or channel (in the format ``@channelusername``). user_id (:obj:`int`): Unique identifier of the target user. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -4122,6 +4245,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): self, chat_id: Union[str, int], sticker_set_name: str, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -4138,6 +4262,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): of the target supergroup (in the format @supergroupusername). sticker_set_name (:obj:`str`): Name of the sticker set to be set as the group sticker set. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -4172,6 +4298,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): async def delete_chat_sticker_set( self, chat_id: Union[str, int], + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -4186,6 +4313,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): Args: chat_id (:obj:`int` | :obj:`str`): Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername). + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -4218,6 +4347,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): async def get_webhook_info( self, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -4229,7 +4359,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): If the bot is using :meth:`get_updates`, will return an object with the :attr:`telegram.WebhookInfo.url` field empty. - Args: + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -4270,6 +4400,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): inline_message_id: int = None, force: bool = None, disable_edit_message: bool = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -4292,6 +4423,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): Identifier of the sent message. inline_message_id (:obj:`str`, optional): Required if chat_id and message_id are not specified. Identifier of the inline message. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -4346,6 +4479,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): chat_id: Union[str, int] = None, message_id: int = None, inline_message_id: int = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -4369,6 +4503,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): Identifier of the sent message. inline_message_id (:obj:`str`, optional): Required if chat_id and message_id are not specified. Identifier of the inline message. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -4438,15 +4574,16 @@ class Bot(TelegramObject, AbstractAsyncContextManager): provider_data: Union[str, object] = None, send_phone_number_to_provider: bool = None, send_email_to_provider: bool = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + max_tip_amount: int = None, + suggested_tip_amounts: List[int] = None, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - max_tip_amount: int = None, - suggested_tip_amounts: List[int] = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> Message: """Use this method to send invoices. @@ -4533,6 +4670,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): An object for an inline keyboard. If empty, one 'Pay total price' button will be shown. If not empty, the first button must be a Pay button. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -4605,12 +4744,12 @@ class Bot(TelegramObject, AbstractAsyncContextManager): disable_notification=disable_notification, reply_markup=reply_markup, allow_sending_without_reply=allow_sending_without_reply, + protect_content=protect_content, read_timeout=read_timeout, write_timeout=write_timeout, connect_timeout=connect_timeout, pool_timeout=pool_timeout, api_kwargs=api_kwargs, - protect_content=protect_content, ) @_log @@ -4620,6 +4759,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): ok: bool, shipping_options: List[ShippingOption] = None, error_message: str = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -4643,6 +4783,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): human readable form that explains why it is impossible to complete the order (e.g. "Sorry, delivery to your desired address is unavailable"). Telegram will display this message to the user. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -4690,6 +4832,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): pre_checkout_query_id: str, ok: bool, error_message: str = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -4716,6 +4859,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): the checkout (e.g. "Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!"). Telegram will display this message to the user. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -4760,6 +4905,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): self, web_app_query_id: str, result: "InlineQueryResult", + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -4775,6 +4921,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): web_app_query_id (:obj:`str`): Unique identifier for the query to be answered. result (:class:`telegram.InlineQueryResult`): An object describing the message to be sent. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -4819,6 +4967,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): user_id: Union[str, int], permissions: ChatPermissions, until_date: Union[int, datetime] = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -4844,6 +4993,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): bot will be used. permissions (:class:`telegram.ChatPermissions`): An object for new user permissions. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -4899,14 +5050,15 @@ class Bot(TelegramObject, AbstractAsyncContextManager): can_restrict_members: bool = None, can_pin_messages: bool = None, can_promote_members: bool = None, + is_anonymous: bool = None, + can_manage_chat: bool = None, + can_manage_video_chats: bool = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - is_anonymous: bool = None, - can_manage_chat: bool = None, - can_manage_video_chats: bool = None, ) -> bool: """ Use this method to promote or demote a user in a supergroup or a channel. The bot must be @@ -4953,6 +5105,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): add new administrators with a subset of his own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by him). + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -5017,6 +5171,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): self, chat_id: Union[str, int], permissions: ChatPermissions, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -5032,6 +5187,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): chat_id (:obj:`int` | :obj:`str`): Unique identifier for the target chat or username of the target supergroup (in the format `@supergroupusername`). permissions (:class:`telegram.ChatPermissions`): New default chat permissions. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -5072,6 +5229,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): chat_id: Union[int, str], user_id: Union[int, str], custom_title: str, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -5088,6 +5246,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): user_id (:obj:`int`): Unique identifier of the target administrator. custom_title (:obj:`str`): New custom title for the administrator; 0-16 characters, emoji are not allowed. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -5128,6 +5288,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): async def export_chat_invite_link( self, chat_id: Union[str, int], + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -5142,6 +5303,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): Args: chat_id (:obj:`int` | :obj:`str`): Unique identifier for the target chat or username of the target channel (in the format ``@channelusername``). + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -5189,13 +5352,14 @@ class Bot(TelegramObject, AbstractAsyncContextManager): chat_id: Union[str, int], expire_date: Union[int, datetime] = None, member_limit: int = None, + name: str = None, + creates_join_request: bool = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - name: str = None, - creates_join_request: bool = None, ) -> ChatInviteLink: """ Use this method to create an additional invite link for a chat. The bot must be an @@ -5214,6 +5378,17 @@ class Bot(TelegramObject, AbstractAsyncContextManager): member_limit (:obj:`int`, optional): Maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-:tg-const:`telegram.constants.ChatInviteLinkLimit.MEMBER_LIMIT`. + name (:obj:`str`, optional): Invite link name; + 0-:tg-const:`telegram.constants.ChatInviteLinkLimit.NAME_LENGTH` characters. + + .. versionadded:: 13.8 + creates_join_request (:obj:`bool`, optional): :obj:`True`, if users joining the chat + via the link need to be approved by chat administrators. + If :obj:`True`, ``member_limit`` can't be specified. + + .. versionadded:: 13.8 + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -5228,15 +5403,6 @@ class Bot(TelegramObject, AbstractAsyncContextManager): :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. api_kwargs (:obj:`dict`, optional): Arbitrary keyword arguments to be passed to the Telegram API. - name (:obj:`str`, optional): Invite link name; - 0-:tg-const:`telegram.constants.ChatInviteLinkLimit.NAME_LENGTH` characters. - - .. versionadded:: 13.8 - creates_join_request (:obj:`bool`, optional): :obj:`True`, if users joining the chat - via the link need to be approved by chat administrators. - If :obj:`True`, ``member_limit`` can't be specified. - - .. versionadded:: 13.8 Returns: :class:`telegram.ChatInviteLink` @@ -5278,13 +5444,14 @@ class Bot(TelegramObject, AbstractAsyncContextManager): invite_link: Union[str, "ChatInviteLink"], expire_date: Union[int, datetime] = None, member_limit: int = None, + name: str = None, + creates_join_request: bool = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - name: str = None, - creates_join_request: bool = None, ) -> ChatInviteLink: """ Use this method to edit a non-primary invite link created by the bot. The bot must be an @@ -5312,6 +5479,17 @@ class Bot(TelegramObject, AbstractAsyncContextManager): member_limit (:obj:`int`, optional): Maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-:tg-const:`telegram.constants.ChatInviteLinkLimit.MEMBER_LIMIT`. + name (:obj:`str`, optional): Invite link name; + 0-:tg-const:`telegram.constants.ChatInviteLinkLimit.NAME_LENGTH` characters. + + .. versionadded:: 13.8 + creates_join_request (:obj:`bool`, optional): :obj:`True`, if users joining the chat + via the link need to be approved by chat administrators. + If :obj:`True`, ``member_limit`` can't be specified. + + .. versionadded:: 13.8 + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -5326,15 +5504,6 @@ class Bot(TelegramObject, AbstractAsyncContextManager): :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. api_kwargs (:obj:`dict`, optional): Arbitrary keyword arguments to be passed to the Telegram API. - name (:obj:`str`, optional): Invite link name; - 0-:tg-const:`telegram.constants.ChatInviteLinkLimit.NAME_LENGTH` characters. - - .. versionadded:: 13.8 - creates_join_request (:obj:`bool`, optional): :obj:`True`, if users joining the chat - via the link need to be approved by chat administrators. - If :obj:`True`, ``member_limit`` can't be specified. - - .. versionadded:: 13.8 Returns: :class:`telegram.ChatInviteLink` @@ -5375,6 +5544,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): self, chat_id: Union[str, int], invite_link: Union[str, "ChatInviteLink"], + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -5395,6 +5565,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): .. versionchanged:: 20.0 Now also accepts :obj:`telegram.ChatInviteLink` instances. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -5437,6 +5609,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): self, chat_id: Union[str, int], user_id: int, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -5454,6 +5627,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): chat_id (:obj:`int` | :obj:`str`): Unique identifier for the target chat or username of the target channel (in the format ``@channelusername``). user_id (:obj:`int`): Unique identifier of the target user. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -5494,6 +5669,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): self, chat_id: Union[str, int], user_id: int, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -5511,6 +5687,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): chat_id (:obj:`int` | :obj:`str`): Unique identifier for the target chat or username of the target channel (in the format ``@channelusername``). user_id (:obj:`int`): Unique identifier of the target user. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -5551,6 +5729,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): self, chat_id: Union[str, int], photo: FileInput, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -5569,6 +5748,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): .. versionchanged:: 13.2 Accept :obj:`bytes` as input. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -5607,6 +5788,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): async def delete_chat_photo( self, chat_id: Union[str, int], + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -5621,6 +5803,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): Args: chat_id (:obj:`int` | :obj:`str`): Unique identifier for the target chat or username of the target channel (in the format ``@channelusername``). + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -5660,6 +5844,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): self, chat_id: Union[str, int], title: str, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -5675,6 +5860,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): chat_id (:obj:`int` | :obj:`str`): Unique identifier for the target chat or username of the target channel (in the format ``@channelusername``). title (:obj:`str`): New chat title, 1-255 characters. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -5714,6 +5901,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): self, chat_id: Union[str, int], description: str = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -5729,6 +5917,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): chat_id (:obj:`int` | :obj:`str`): Unique identifier for the target chat or username of the target channel (in the format ``@channelusername``). description (:obj:`str`, optional): New chat description, 0-255 characters. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -5772,6 +5962,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): chat_id: Union[str, int], message_id: int, disable_notification: ODVInput[bool] = DEFAULT_NONE, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -5791,6 +5982,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): disable_notification (:obj:`bool`, optional): Pass :obj:`True`, if it is not necessary to send a notification to all chat members about the new pinned message. Notifications are always disabled in channels and private chats. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -5833,12 +6026,13 @@ class Bot(TelegramObject, AbstractAsyncContextManager): async def unpin_chat_message( self, chat_id: Union[str, int], + message_id: int = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - message_id: int = None, ) -> bool: """ Use this method to remove a message from the list of pinned messages in a chat. If the @@ -5852,6 +6046,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): of the target channel (in the format ``@channelusername``). message_id (:obj:`int`, optional): Identifier of a message to unpin. If not specified, the most recent pinned message (by sending date) will be unpinned. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -5893,6 +6089,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): async def unpin_all_chat_messages( self, chat_id: Union[str, int], + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -5909,6 +6106,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): Args: chat_id (:obj:`int` | :obj:`str`): Unique identifier for the target chat or username of the target channel (in the format ``@channelusername``). + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -5946,6 +6145,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): async def get_sticker_set( self, name: str, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -5956,6 +6156,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): Args: name (:obj:`str`): Name of the sticker set. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -5995,6 +6197,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): self, user_id: Union[str, int], png_sticker: FileInput, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -6018,6 +6221,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): .. versionchanged:: 13.2 Accept :obj:`bytes` as input. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -6062,13 +6267,14 @@ class Bot(TelegramObject, AbstractAsyncContextManager): png_sticker: FileInput = None, contains_masks: bool = None, mask_position: MaskPosition = None, + tgs_sticker: FileInput = None, + webm_sticker: FileInput = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - tgs_sticker: FileInput = None, api_kwargs: JSONDict = None, - webm_sticker: FileInput = None, ) -> bool: """ Use this method to create new sticker set owned by a user. @@ -6122,6 +6328,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): should be created. mask_position (:class:`telegram.MaskPosition`, optional): Position where the mask should be placed on faces. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -6177,13 +6385,14 @@ class Bot(TelegramObject, AbstractAsyncContextManager): emojis: str, png_sticker: FileInput = None, mask_position: MaskPosition = None, + tgs_sticker: FileInput = None, + webm_sticker: FileInput = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - tgs_sticker: FileInput = None, api_kwargs: JSONDict = None, - webm_sticker: FileInput = None, ) -> bool: """ Use this method to add a new sticker to a set created by the bot. @@ -6231,6 +6440,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): emojis (:obj:`str`): One or more emoji corresponding to the sticker. mask_position (:class:`telegram.MaskPosition`, optional): Position where the mask should be placed on faces. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -6281,6 +6492,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): self, sticker: str, position: int, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -6292,6 +6504,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): Args: sticker (:obj:`str`): File identifier of the sticker. position (:obj:`int`): New sticker position in the set, zero-based. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -6330,6 +6544,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): async def delete_sticker_from_set( self, sticker: str, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -6340,6 +6555,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): Args: sticker (:obj:`str`): File identifier of the sticker. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -6380,6 +6597,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): name: str, user_id: Union[str, int], thumb: FileInput = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -6412,6 +6630,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): .. versionchanged:: 13.2 Accept :obj:`bytes` as input. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -6455,6 +6675,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): self, user_id: Union[str, int], errors: List[PassportElementError], + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -6475,6 +6696,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): user_id (:obj:`int`): User identifier errors (List[:class:`PassportElementError`]): An array describing the errors. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -6523,18 +6746,19 @@ class Bot(TelegramObject, AbstractAsyncContextManager): disable_notification: ODVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, - read_timeout: ODVInput[float] = DEFAULT_NONE, - write_timeout: ODVInput[float] = DEFAULT_NONE, - connect_timeout: ODVInput[float] = DEFAULT_NONE, - pool_timeout: ODVInput[float] = DEFAULT_NONE, explanation: str = None, explanation_parse_mode: ODVInput[str] = DEFAULT_NONE, open_period: int = None, close_date: Union[int, datetime] = None, - api_kwargs: JSONDict = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, explanation_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + read_timeout: ODVInput[float] = DEFAULT_NONE, + write_timeout: ODVInput[float] = DEFAULT_NONE, + connect_timeout: ODVInput[float] = DEFAULT_NONE, + pool_timeout: ODVInput[float] = DEFAULT_NONE, + api_kwargs: JSONDict = None, ) -> Message: """ Use this method to send a native poll. @@ -6589,6 +6813,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): :class:`ReplyKeyboardRemove` | :class:`ForceReply`, optional): Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -6644,12 +6870,12 @@ class Bot(TelegramObject, AbstractAsyncContextManager): disable_notification=disable_notification, reply_markup=reply_markup, allow_sending_without_reply=allow_sending_without_reply, + protect_content=protect_content, read_timeout=read_timeout, write_timeout=write_timeout, connect_timeout=connect_timeout, pool_timeout=pool_timeout, api_kwargs=api_kwargs, - protect_content=protect_content, ) @_log @@ -6658,6 +6884,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): chat_id: Union[int, str], message_id: int, reply_markup: InlineKeyboardMarkup = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -6673,6 +6900,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): message_id (:obj:`int`): Identifier of the original message with the poll. reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): An object for a new message inline keyboard. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -6718,14 +6947,15 @@ class Bot(TelegramObject, AbstractAsyncContextManager): disable_notification: ODVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, + emoji: str = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - emoji: str = None, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> Message: """ Use this method to send an animated emoji that will display a random value. @@ -6760,6 +6990,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): :class:`ReplyKeyboardRemove` | :class:`ForceReply`, optional): Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -6793,18 +7025,19 @@ class Bot(TelegramObject, AbstractAsyncContextManager): disable_notification=disable_notification, reply_markup=reply_markup, allow_sending_without_reply=allow_sending_without_reply, + protect_content=protect_content, read_timeout=read_timeout, write_timeout=write_timeout, connect_timeout=connect_timeout, pool_timeout=pool_timeout, api_kwargs=api_kwargs, - protect_content=protect_content, ) @_log async def get_my_default_administrator_rights( self, for_channels: bool = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -6821,6 +7054,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): for_channels (:obj:`bool`, optional): Pass :obj:`True` to get default administrator rights of the bot in channels. Otherwise, default administrator rights of the bot for groups and supergroups will be returned. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -6864,6 +7099,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): self, rights: ChatAdministratorRights = None, for_channels: bool = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -6885,6 +7121,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): for_channels (:obj:`bool`, optional): Pass :obj:`True` to change the default administrator rights of the bot in channels. Otherwise, the default administrator rights of the bot for groups and supergroups will be changed. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -6929,19 +7167,31 @@ class Bot(TelegramObject, AbstractAsyncContextManager): @_log async def get_my_commands( self, + scope: BotCommandScope = None, + language_code: str = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - scope: BotCommandScope = None, - language_code: str = None, ) -> List[BotCommand]: """ Use this method to get the current list of the bot's commands for the given scope and user language. Args: + scope (:class:`telegram.BotCommandScope`, optional): An object, + describing scope of users. Defaults to :class:`telegram.BotCommandScopeDefault`. + + .. versionadded:: 13.7 + + language_code (:obj:`str`, optional): A two-letter ISO 639-1 language code or an empty + string. + + .. versionadded:: 13.7 + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -6956,15 +7206,6 @@ class Bot(TelegramObject, AbstractAsyncContextManager): :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. api_kwargs (:obj:`dict`, optional): Arbitrary keyword arguments to be passed to the Telegram API. - scope (:class:`telegram.BotCommandScope`, optional): An object, - describing scope of users. Defaults to :class:`telegram.BotCommandScopeDefault`. - - .. versionadded:: 13.7 - - language_code (:obj:`str`, optional): A two-letter ISO 639-1 language code or an empty - string. - - .. versionadded:: 13.7 Returns: List[:class:`telegram.BotCommand`]: On success, the commands set for the bot. An empty @@ -6998,13 +7239,14 @@ class Bot(TelegramObject, AbstractAsyncContextManager): async def set_my_commands( self, commands: List[Union[BotCommand, Tuple[str, str]]], + scope: BotCommandScope = None, + language_code: str = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - scope: BotCommandScope = None, - language_code: str = None, ) -> bool: """ Use this method to change the list of the bot's commands. See the @@ -7015,6 +7257,19 @@ class Bot(TelegramObject, AbstractAsyncContextManager): commands (List[:class:`BotCommand` | (:obj:`str`, :obj:`str`)]): A list of bot commands to be set as the list of the bot's commands. At most 100 commands can be specified. + scope (:class:`telegram.BotCommandScope`, optional): An object, + describing scope of users for which the commands are relevant. Defaults to + :class:`telegram.BotCommandScopeDefault`. + + .. versionadded:: 13.7 + + language_code (:obj:`str`, optional): A two-letter ISO 639-1 language code. If empty, + commands will be applied to all users from the given scope, for whose language + there are no dedicated commands. + + .. versionadded:: 13.7 + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -7029,17 +7284,6 @@ class Bot(TelegramObject, AbstractAsyncContextManager): :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. api_kwargs (:obj:`dict`, optional): Arbitrary keyword arguments to be passed to the Telegram API. - scope (:class:`telegram.BotCommandScope`, optional): An object, - describing scope of users for which the commands are relevant. Defaults to - :class:`telegram.BotCommandScopeDefault`. - - .. versionadded:: 13.7 - - language_code (:obj:`str`, optional): A two-letter ISO 639-1 language code. If empty, - commands will be applied to all users from the given scope, for whose language - there are no dedicated commands. - - .. versionadded:: 13.7 Returns: :obj:`bool`: On success, :obj:`True` is returned. @@ -7074,11 +7318,12 @@ class Bot(TelegramObject, AbstractAsyncContextManager): self, scope: BotCommandScope = None, language_code: str = None, - api_kwargs: JSONDict = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, + api_kwargs: JSONDict = None, ) -> bool: """ Use this method to delete the list of the bot's commands for the given scope and user @@ -7095,6 +7340,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): language_code (:obj:`str`, optional): A two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -7139,6 +7386,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): @_log async def log_out( self, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -7151,7 +7399,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): local server, but will not be able to log in back to the cloud Bot API server for 10 minutes. - Args: + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -7183,10 +7431,12 @@ class Bot(TelegramObject, AbstractAsyncContextManager): @_log async def close( self, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, + api_kwargs: JSONDict = None, ) -> bool: """ Use this method to close the bot instance before moving it from one local server to @@ -7194,7 +7444,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): isn't launched again after server restart. The method will return error 429 in the first 10 minutes after the bot is launched. - Args: + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -7207,6 +7457,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): pool_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.pool_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. + api_kwargs (:obj:`dict`, optional): Arbitrary keyword arguments to be passed to the + Telegram API. Returns: :obj:`True`: On success @@ -7221,6 +7473,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): write_timeout=write_timeout, connect_timeout=connect_timeout, pool_timeout=pool_timeout, + api_kwargs=api_kwargs, ) @_log @@ -7236,12 +7489,13 @@ class Bot(TelegramObject, AbstractAsyncContextManager): reply_to_message_id: int = None, allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE, reply_markup: ReplyMarkup = None, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> MessageId: """ Use this method to copy messages of any kind. Service messages and invoice messages can't @@ -7277,6 +7531,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): :class:`ReplyKeyboardRemove` | :class:`ForceReply`, optional): Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -7332,6 +7588,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): self, chat_id: int = None, menu_button: MenuButton = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -7351,6 +7608,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): specified, default bot's menu button will be changed menu_button (:class:`telegram.MenuButton`, optional): An object for the new bot's menu button. Defaults to :class:`telegram.MenuButtonDefault`. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. @@ -7389,6 +7648,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager): async def get_chat_menu_button( self, chat_id: int = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -7406,6 +7666,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): Args: chat_id (:obj:`int`, optional): Unique identifier for the target private chat. If not specified, default bot's menu button will be returned. + + Keyword Args: read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to :paramref:`telegram.request.BaseRequest.post.read_timeout`. Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. diff --git a/telegram/_callbackquery.py b/telegram/_callbackquery.py index 455616970..ece1d3425 100644 --- a/telegram/_callbackquery.py +++ b/telegram/_callbackquery.py @@ -152,6 +152,7 @@ class CallbackQuery(TelegramObject): show_alert: bool = None, url: str = None, cache_time: int = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -188,12 +189,13 @@ class CallbackQuery(TelegramObject): parse_mode: ODVInput[str] = DEFAULT_NONE, disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE, reply_markup: "InlineKeyboardMarkup" = None, + entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, ) -> Union[Message, bool]: """Shortcut for either:: @@ -245,13 +247,14 @@ class CallbackQuery(TelegramObject): self, caption: str = None, reply_markup: "InlineKeyboardMarkup" = None, + parse_mode: ODVInput[str] = DEFAULT_NONE, + caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - parse_mode: ODVInput[str] = DEFAULT_NONE, api_kwargs: JSONDict = None, - caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, ) -> Union[Message, bool]: """Shortcut for either:: @@ -301,6 +304,7 @@ class CallbackQuery(TelegramObject): async def edit_message_reply_markup( self, reply_markup: Optional["InlineKeyboardMarkup"] = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -358,6 +362,7 @@ class CallbackQuery(TelegramObject): self, media: "InputMedia", reply_markup: "InlineKeyboardMarkup" = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -408,16 +413,17 @@ class CallbackQuery(TelegramObject): self, latitude: float = None, longitude: float = None, - location: Location = None, reply_markup: "InlineKeyboardMarkup" = None, + horizontal_accuracy: float = None, + heading: int = None, + proximity_alert_radius: int = None, + *, + location: Location = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - horizontal_accuracy: float = None, - heading: int = None, - proximity_alert_radius: int = None, ) -> Union[Message, bool]: """Shortcut for either:: @@ -475,6 +481,7 @@ class CallbackQuery(TelegramObject): async def stop_message_live_location( self, reply_markup: "InlineKeyboardMarkup" = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -528,6 +535,7 @@ class CallbackQuery(TelegramObject): score: int, force: bool = None, disable_edit_message: bool = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -581,6 +589,7 @@ class CallbackQuery(TelegramObject): async def get_game_high_scores( self, user_id: Union[int, str], + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -627,6 +636,7 @@ class CallbackQuery(TelegramObject): async def delete_message( self, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -655,6 +665,7 @@ class CallbackQuery(TelegramObject): async def pin_message( self, disable_notification: ODVInput[bool] = DEFAULT_NONE, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -683,6 +694,7 @@ class CallbackQuery(TelegramObject): async def unpin_message( self, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -718,12 +730,13 @@ class CallbackQuery(TelegramObject): reply_to_message_id: int = None, allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE, reply_markup: ReplyMarkup = None, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "MessageId": """Shortcut for:: diff --git a/telegram/_chat.py b/telegram/_chat.py index dda1066c6..700bcd841 100644 --- a/telegram/_chat.py +++ b/telegram/_chat.py @@ -66,7 +66,12 @@ class Chat(TelegramObject): considered equal, if their :attr:`id` is equal. .. versionchanged:: 20.0 - Removed the deprecated methods ``kick_member`` and ``get_members_count``. + + * Removed the deprecated methods ``kick_member`` and ``get_members_count``. + * The following are now keyword-only arguments in Bot methods: + ``location``, ``filename``, ``contact``, ``{read, write, connect, pool}_timeout``, + ``api_kwargs``. Use a named argument for those, + and notice that some positional arguments changed position as a result. Args: id (:obj:`int`): Unique identifier for this chat. This number may be greater than 32 bits @@ -305,6 +310,7 @@ class Chat(TelegramObject): async def leave( self, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -332,6 +338,7 @@ class Chat(TelegramObject): async def get_administrators( self, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -363,6 +370,7 @@ class Chat(TelegramObject): async def get_member_count( self, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -391,6 +399,7 @@ class Chat(TelegramObject): async def get_member( self, user_id: Union[str, int], + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -420,13 +429,14 @@ class Chat(TelegramObject): async def ban_member( self, user_id: Union[str, int], + revoke_messages: bool = None, + until_date: Union[int, datetime] = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - until_date: Union[int, datetime] = None, api_kwargs: JSONDict = None, - revoke_messages: bool = None, ) -> bool: """Shortcut for:: @@ -453,6 +463,7 @@ class Chat(TelegramObject): async def ban_sender_chat( self, sender_chat_id: int, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -485,6 +496,7 @@ class Chat(TelegramObject): async def ban_chat( self, chat_id: Union[str, int], + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -519,6 +531,7 @@ class Chat(TelegramObject): async def unban_sender_chat( self, sender_chat_id: int, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -551,6 +564,7 @@ class Chat(TelegramObject): async def unban_chat( self, chat_id: Union[str, int], + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -585,12 +599,13 @@ class Chat(TelegramObject): async def unban_member( self, user_id: Union[str, int], + only_if_banned: bool = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - only_if_banned: bool = None, ) -> bool: """Shortcut for:: @@ -624,14 +639,15 @@ class Chat(TelegramObject): can_restrict_members: bool = None, can_pin_messages: bool = None, can_promote_members: bool = None, + is_anonymous: bool = None, + can_manage_chat: bool = None, + can_manage_video_chats: bool = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - is_anonymous: bool = None, - can_manage_chat: bool = None, - can_manage_video_chats: bool = None, ) -> bool: """Shortcut for:: @@ -676,6 +692,7 @@ class Chat(TelegramObject): user_id: Union[str, int], permissions: ChatPermissions, until_date: Union[int, datetime] = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -710,6 +727,7 @@ class Chat(TelegramObject): async def set_permissions( self, permissions: ChatPermissions, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -741,6 +759,7 @@ class Chat(TelegramObject): self, user_id: Union[int, str], custom_title: str, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -775,6 +794,7 @@ class Chat(TelegramObject): self, message_id: int, disable_notification: ODVInput[bool] = DEFAULT_NONE, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -805,12 +825,13 @@ class Chat(TelegramObject): async def unpin_message( self, + message_id: int = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - message_id: int = None, ) -> bool: """Shortcut for:: @@ -835,6 +856,7 @@ class Chat(TelegramObject): async def unpin_all_messages( self, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -869,14 +891,15 @@ class Chat(TelegramObject): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "Message": """Shortcut for:: @@ -896,14 +919,14 @@ class Chat(TelegramObject): disable_notification=disable_notification, reply_to_message_id=reply_to_message_id, reply_markup=reply_markup, + allow_sending_without_reply=allow_sending_without_reply, + entities=entities, + protect_content=protect_content, read_timeout=read_timeout, write_timeout=write_timeout, connect_timeout=connect_timeout, pool_timeout=pool_timeout, api_kwargs=api_kwargs, - allow_sending_without_reply=allow_sending_without_reply, - entities=entities, - protect_content=protect_content, ) async def send_media_group( @@ -913,13 +936,14 @@ class Chat(TelegramObject): ], disable_notification: ODVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> List["Message"]: """Shortcut for:: @@ -948,6 +972,7 @@ class Chat(TelegramObject): async def send_chat_action( self, action: str, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -984,16 +1009,17 @@ class Chat(TelegramObject): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, + parse_mode: ODVInput[str] = DEFAULT_NONE, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + filename: str = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - parse_mode: ODVInput[str] = DEFAULT_NONE, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, - filename: str = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "Message": """Shortcut for:: @@ -1012,16 +1038,16 @@ class Chat(TelegramObject): disable_notification=disable_notification, reply_to_message_id=reply_to_message_id, reply_markup=reply_markup, - read_timeout=read_timeout, - write_timeout=write_timeout, - connect_timeout=connect_timeout, - pool_timeout=pool_timeout, parse_mode=parse_mode, - api_kwargs=api_kwargs, allow_sending_without_reply=allow_sending_without_reply, caption_entities=caption_entities, filename=filename, protect_content=protect_content, + read_timeout=read_timeout, + write_timeout=write_timeout, + connect_timeout=connect_timeout, + pool_timeout=pool_timeout, + api_kwargs=api_kwargs, ) async def send_contact( @@ -1032,15 +1058,16 @@ class Chat(TelegramObject): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, + vcard: str = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + contact: "Contact" = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - contact: "Contact" = None, - vcard: str = None, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "Message": """Shortcut for:: @@ -1081,17 +1108,18 @@ class Chat(TelegramObject): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, + parse_mode: ODVInput[str] = DEFAULT_NONE, + thumb: FileInput = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + filename: str = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - parse_mode: ODVInput[str] = DEFAULT_NONE, - thumb: FileInput = None, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, - filename: str = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "Message": """Shortcut for:: @@ -1113,38 +1141,39 @@ class Chat(TelegramObject): disable_notification=disable_notification, reply_to_message_id=reply_to_message_id, reply_markup=reply_markup, - read_timeout=read_timeout, - write_timeout=write_timeout, - connect_timeout=connect_timeout, - pool_timeout=pool_timeout, parse_mode=parse_mode, thumb=thumb, - api_kwargs=api_kwargs, allow_sending_without_reply=allow_sending_without_reply, caption_entities=caption_entities, filename=filename, protect_content=protect_content, + read_timeout=read_timeout, + write_timeout=write_timeout, + connect_timeout=connect_timeout, + pool_timeout=pool_timeout, + api_kwargs=api_kwargs, ) async def send_document( self, document: Union[FileInput, "Document"], - filename: str = None, caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, - read_timeout: ODVInput[float] = DEFAULT_NONE, - write_timeout: ODVInput[float] = 20, - connect_timeout: ODVInput[float] = DEFAULT_NONE, - pool_timeout: ODVInput[float] = DEFAULT_NONE, parse_mode: ODVInput[str] = DEFAULT_NONE, thumb: FileInput = None, - api_kwargs: JSONDict = None, disable_content_type_detection: bool = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + filename: str = None, + read_timeout: ODVInput[float] = DEFAULT_NONE, + write_timeout: ODVInput[float] = 20, + connect_timeout: ODVInput[float] = DEFAULT_NONE, + pool_timeout: ODVInput[float] = DEFAULT_NONE, + api_kwargs: JSONDict = None, ) -> "Message": """Shortcut for:: @@ -1182,14 +1211,15 @@ class Chat(TelegramObject): disable_notification: ODVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, + emoji: str = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - emoji: str = None, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "Message": """Shortcut for:: @@ -1222,13 +1252,14 @@ class Chat(TelegramObject): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: "InlineKeyboardMarkup" = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "Message": """Shortcut for:: @@ -1279,15 +1310,16 @@ class Chat(TelegramObject): provider_data: Union[str, object] = None, send_phone_number_to_provider: bool = None, send_email_to_provider: bool = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + max_tip_amount: int = None, + suggested_tip_amounts: List[int] = None, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - max_tip_amount: int = None, - suggested_tip_amounts: List[int] = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "Message": """Shortcut for:: @@ -1351,18 +1383,19 @@ class Chat(TelegramObject): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, - read_timeout: ODVInput[float] = DEFAULT_NONE, - write_timeout: ODVInput[float] = DEFAULT_NONE, - connect_timeout: ODVInput[float] = DEFAULT_NONE, - pool_timeout: ODVInput[float] = DEFAULT_NONE, - location: "Location" = None, live_period: int = None, - api_kwargs: JSONDict = None, horizontal_accuracy: float = None, heading: int = None, proximity_alert_radius: int = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + location: "Location" = None, + read_timeout: ODVInput[float] = DEFAULT_NONE, + write_timeout: ODVInput[float] = DEFAULT_NONE, + connect_timeout: ODVInput[float] = DEFAULT_NONE, + pool_timeout: ODVInput[float] = DEFAULT_NONE, + api_kwargs: JSONDict = None, ) -> "Message": """Shortcut for:: @@ -1407,15 +1440,16 @@ class Chat(TelegramObject): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + filename: str = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, - filename: str = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "Message": """Shortcut for:: @@ -1456,13 +1490,14 @@ class Chat(TelegramObject): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "Message": """Shortcut for:: @@ -1499,17 +1534,18 @@ class Chat(TelegramObject): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, - read_timeout: ODVInput[float] = DEFAULT_NONE, - write_timeout: ODVInput[float] = DEFAULT_NONE, - connect_timeout: ODVInput[float] = DEFAULT_NONE, - pool_timeout: ODVInput[float] = DEFAULT_NONE, - venue: "Venue" = None, foursquare_type: str = None, - api_kwargs: JSONDict = None, google_place_id: str = None, google_place_type: str = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + venue: "Venue" = None, + read_timeout: ODVInput[float] = DEFAULT_NONE, + write_timeout: ODVInput[float] = DEFAULT_NONE, + connect_timeout: ODVInput[float] = DEFAULT_NONE, + pool_timeout: ODVInput[float] = DEFAULT_NONE, + api_kwargs: JSONDict = None, ) -> "Message": """Shortcut for:: @@ -1552,20 +1588,21 @@ class Chat(TelegramObject): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, - read_timeout: ODVInput[float] = DEFAULT_NONE, - write_timeout: ODVInput[float] = 20, - connect_timeout: ODVInput[float] = DEFAULT_NONE, - pool_timeout: ODVInput[float] = DEFAULT_NONE, width: int = None, height: int = None, parse_mode: ODVInput[str] = DEFAULT_NONE, supports_streaming: bool = None, thumb: FileInput = None, - api_kwargs: JSONDict = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, - filename: str = None, protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + filename: str = None, + read_timeout: ODVInput[float] = DEFAULT_NONE, + write_timeout: ODVInput[float] = 20, + connect_timeout: ODVInput[float] = DEFAULT_NONE, + pool_timeout: ODVInput[float] = DEFAULT_NONE, + api_kwargs: JSONDict = None, ) -> "Message": """Shortcut for:: @@ -1609,15 +1646,16 @@ class Chat(TelegramObject): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, + thumb: FileInput = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + filename: str = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - thumb: FileInput = None, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - filename: str = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "Message": """Shortcut for:: @@ -1656,16 +1694,17 @@ class Chat(TelegramObject): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, + parse_mode: ODVInput[str] = DEFAULT_NONE, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + filename: str = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - parse_mode: ODVInput[str] = DEFAULT_NONE, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, - filename: str = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "Message": """Shortcut for:: @@ -1709,18 +1748,19 @@ class Chat(TelegramObject): disable_notification: ODVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, - read_timeout: ODVInput[float] = DEFAULT_NONE, - write_timeout: ODVInput[float] = DEFAULT_NONE, - connect_timeout: ODVInput[float] = DEFAULT_NONE, - pool_timeout: ODVInput[float] = DEFAULT_NONE, explanation: str = None, explanation_parse_mode: ODVInput[str] = DEFAULT_NONE, open_period: int = None, close_date: Union[int, datetime] = None, - api_kwargs: JSONDict = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, explanation_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + read_timeout: ODVInput[float] = DEFAULT_NONE, + write_timeout: ODVInput[float] = DEFAULT_NONE, + connect_timeout: ODVInput[float] = DEFAULT_NONE, + pool_timeout: ODVInput[float] = DEFAULT_NONE, + api_kwargs: JSONDict = None, ) -> "Message": """Shortcut for:: @@ -1769,12 +1809,13 @@ class Chat(TelegramObject): reply_to_message_id: int = None, allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE, reply_markup: ReplyMarkup = None, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "MessageId": """Shortcut for:: @@ -1816,12 +1857,13 @@ class Chat(TelegramObject): reply_to_message_id: int = None, allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE, reply_markup: ReplyMarkup = None, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "MessageId": """Shortcut for:: @@ -1854,6 +1896,7 @@ class Chat(TelegramObject): async def export_invite_link( self, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -1886,13 +1929,14 @@ class Chat(TelegramObject): self, expire_date: Union[int, datetime] = None, member_limit: int = None, + name: str = None, + creates_join_request: bool = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - name: str = None, - creates_join_request: bool = None, ) -> "ChatInviteLink": """Shortcut for:: @@ -1929,13 +1973,14 @@ class Chat(TelegramObject): invite_link: Union[str, "ChatInviteLink"], expire_date: Union[int, datetime] = None, member_limit: int = None, + name: str = None, + creates_join_request: bool = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - name: str = None, - creates_join_request: bool = None, ) -> "ChatInviteLink": """Shortcut for:: @@ -1970,6 +2015,7 @@ class Chat(TelegramObject): async def revoke_invite_link( self, invite_link: Union[str, "ChatInviteLink"], + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -2002,6 +2048,7 @@ class Chat(TelegramObject): async def approve_join_request( self, user_id: int, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -2034,6 +2081,7 @@ class Chat(TelegramObject): async def decline_join_request( self, user_id: int, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -2066,6 +2114,7 @@ class Chat(TelegramObject): async def set_menu_button( self, menu_button: MenuButton = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -2101,6 +2150,7 @@ class Chat(TelegramObject): async def get_menu_button( self, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, diff --git a/telegram/_chatjoinrequest.py b/telegram/_chatjoinrequest.py index b34101e79..87a5bd21c 100644 --- a/telegram/_chatjoinrequest.py +++ b/telegram/_chatjoinrequest.py @@ -114,6 +114,7 @@ class ChatJoinRequest(TelegramObject): async def approve( self, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -145,6 +146,7 @@ class ChatJoinRequest(TelegramObject): async def decline( self, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, diff --git a/telegram/_files/_basemedium.py b/telegram/_files/_basemedium.py index 08dee8726..e814fe4c9 100644 --- a/telegram/_files/_basemedium.py +++ b/telegram/_files/_basemedium.py @@ -67,6 +67,7 @@ class _BaseMedium(TelegramObject): async def get_file( self, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, diff --git a/telegram/_files/chatphoto.py b/telegram/_files/chatphoto.py index 54ab7fb92..215b11af1 100644 --- a/telegram/_files/chatphoto.py +++ b/telegram/_files/chatphoto.py @@ -95,6 +95,7 @@ class ChatPhoto(TelegramObject): async def get_small_file( self, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -124,6 +125,7 @@ class ChatPhoto(TelegramObject): async def get_big_file( self, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, diff --git a/telegram/_inline/inlinequery.py b/telegram/_inline/inlinequery.py index dfb6d087e..3cc6100d9 100644 --- a/telegram/_inline/inlinequery.py +++ b/telegram/_inline/inlinequery.py @@ -43,6 +43,13 @@ class InlineQuery(TelegramObject): Note: In Python :keyword:`from` is a reserved word use :paramref:`from_user` instead. + .. versionchanged:: 20.0 + + * The following are now keyword-only arguments in Bot methods: + ``{read, write, connect, pool}_timeout``, :paramref:`answer.api_kwargs`, + ``auto_pagination``. Use a named argument for those, + and notice that some positional arguments changed position as a result. + Args: id (:obj:`str`): Unique identifier for this query. from_user (:class:`telegram.User`): Sender. @@ -123,13 +130,14 @@ class InlineQuery(TelegramObject): next_offset: str = None, switch_pm_text: str = None, switch_pm_parameter: str = None, + *, + current_offset: str = None, + auto_pagination: bool = False, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - current_offset: str = None, api_kwargs: JSONDict = None, - auto_pagination: bool = False, ) -> bool: """Shortcut for:: @@ -146,7 +154,7 @@ class InlineQuery(TelegramObject): .. versionchanged:: 20.0 Raises :class:`ValueError` instead of :class:`TypeError`. - Args: + Keyword Args: auto_pagination (:obj:`bool`, optional): If set to :obj:`True`, :attr:`offset` will be passed as :paramref:`current_offset ` to diff --git a/telegram/_message.py b/telegram/_message.py index fda28eb94..ea10c5dfd 100644 --- a/telegram/_message.py +++ b/telegram/_message.py @@ -85,13 +85,18 @@ class Message(TelegramObject): In Python :keyword:`from` is a reserved word use :paramref:`from_user` instead. .. versionchanged:: 20.0 - The arguments and attributes ``voice_chat_scheduled``, ``voice_chat_started`` and - ``voice_chat_ended``, ``voice_chat_participants_invited`` were renamed to - :paramref:`video_chat_scheduled`/:attr:`video_chat_scheduled`, - :paramref:`video_chat_started`/:attr:`video_chat_started`, - :paramref:`video_chat_ended`/:attr:`video_chat_ended` and - :paramref:`video_chat_participants_invited`/:attr:`video_chat_participants_invited`, - respectively, in accordance to Bot API 6.0. + + * The arguments and attributes ``voice_chat_scheduled``, ``voice_chat_started`` and + ``voice_chat_ended``, ``voice_chat_participants_invited`` were renamed to + :paramref:`video_chat_scheduled`/:attr:`video_chat_scheduled`, + :paramref:`video_chat_started`/:attr:`video_chat_started`, + :paramref:`video_chat_ended`/:attr:`video_chat_ended` and + :paramref:`video_chat_participants_invited`/:attr:`video_chat_participants_invited`, + respectively, in accordance to Bot API 6.0. + * The following are now keyword-only arguments in Bot methods: + ``{read, write, connect, pool}_timeout``, ``api_kwargs``, ``contact``, ``quote``, + ``filename``, ``loaction``, ``venue``. Use a named argument for those, + and notice that some positional arguments changed position as a result. Args: message_id (:obj:`int`): Unique message identifier inside this chat. @@ -754,15 +759,16 @@ class Message(TelegramObject): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + quote: bool = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, - quote: bool = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "Message": """Shortcut for:: @@ -770,7 +776,7 @@ class Message(TelegramObject): For the documentation of the arguments, please see :meth:`telegram.Bot.send_message`. - Args: + Keyword Args: quote (:obj:`bool`, optional): If set to :obj:`True`, the message is sent as an actual reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this parameter will be ignored. Default: :obj:`True` in group chats and :obj:`False` in @@ -789,14 +795,14 @@ class Message(TelegramObject): disable_notification=disable_notification, reply_to_message_id=reply_to_message_id, reply_markup=reply_markup, + allow_sending_without_reply=allow_sending_without_reply, + entities=entities, + protect_content=protect_content, read_timeout=read_timeout, write_timeout=write_timeout, connect_timeout=connect_timeout, pool_timeout=pool_timeout, api_kwargs=api_kwargs, - allow_sending_without_reply=allow_sending_without_reply, - entities=entities, - protect_content=protect_content, ) async def reply_markdown( @@ -806,15 +812,16 @@ class Message(TelegramObject): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + quote: bool = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, - quote: bool = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "Message": """Shortcut for:: @@ -833,7 +840,7 @@ class Message(TelegramObject): :tg-const:`telegram.constants.ParseMode.MARKDOWN` is a legacy mode, retained by Telegram for backward compatibility. You should use :meth:`reply_markdown_v2` instead. - Args: + Keyword Args: quote (:obj:`bool`, optional): If set to :obj:`True`, the message is sent as an actual reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this parameter will be ignored. Default: :obj:`True` in group chats and :obj:`False` in @@ -851,14 +858,14 @@ class Message(TelegramObject): disable_notification=disable_notification, reply_to_message_id=reply_to_message_id, reply_markup=reply_markup, + allow_sending_without_reply=allow_sending_without_reply, + entities=entities, + protect_content=protect_content, read_timeout=read_timeout, write_timeout=write_timeout, connect_timeout=connect_timeout, pool_timeout=pool_timeout, api_kwargs=api_kwargs, - allow_sending_without_reply=allow_sending_without_reply, - entities=entities, - protect_content=protect_content, ) async def reply_markdown_v2( @@ -868,15 +875,16 @@ class Message(TelegramObject): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + quote: bool = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, - quote: bool = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "Message": """Shortcut for:: @@ -891,7 +899,7 @@ class Message(TelegramObject): For the documentation of the arguments, please see :meth:`telegram.Bot.send_message`. - Args: + Keyword Args: quote (:obj:`bool`, optional): If set to :obj:`True`, the message is sent as an actual reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this parameter will be ignored. Default: :obj:`True` in group chats and :obj:`False` in @@ -909,14 +917,14 @@ class Message(TelegramObject): disable_notification=disable_notification, reply_to_message_id=reply_to_message_id, reply_markup=reply_markup, + allow_sending_without_reply=allow_sending_without_reply, + entities=entities, + protect_content=protect_content, read_timeout=read_timeout, write_timeout=write_timeout, connect_timeout=connect_timeout, pool_timeout=pool_timeout, api_kwargs=api_kwargs, - allow_sending_without_reply=allow_sending_without_reply, - entities=entities, - protect_content=protect_content, ) async def reply_html( @@ -926,15 +934,16 @@ class Message(TelegramObject): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + quote: bool = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, - quote: bool = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "Message": """Shortcut for:: @@ -949,7 +958,7 @@ class Message(TelegramObject): For the documentation of the arguments, please see :meth:`telegram.Bot.send_message`. - Args: + Keyword Args: quote (:obj:`bool`, optional): If set to :obj:`True`, the message is sent as an actual reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this parameter will be ignored. Default: :obj:`True` in group chats and :obj:`False` in @@ -967,14 +976,14 @@ class Message(TelegramObject): disable_notification=disable_notification, reply_to_message_id=reply_to_message_id, reply_markup=reply_markup, + allow_sending_without_reply=allow_sending_without_reply, + entities=entities, + protect_content=protect_content, read_timeout=read_timeout, write_timeout=write_timeout, connect_timeout=connect_timeout, pool_timeout=pool_timeout, api_kwargs=api_kwargs, - allow_sending_without_reply=allow_sending_without_reply, - entities=entities, - protect_content=protect_content, ) async def reply_media_group( @@ -984,14 +993,15 @@ class Message(TelegramObject): ], disable_notification: ODVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + quote: bool = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - quote: bool = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> List["Message"]: """Shortcut for:: @@ -999,7 +1009,7 @@ class Message(TelegramObject): For the documentation of the arguments, please see :meth:`telegram.Bot.send_media_group`. - Args: + Keyword Args: quote (:obj:`bool`, optional): If set to :obj:`True`, the media group is sent as an actual reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this parameter will be ignored. Default: :obj:`True` in group chats and @@ -1033,17 +1043,18 @@ class Message(TelegramObject): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, + parse_mode: ODVInput[str] = DEFAULT_NONE, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + filename: str = None, + quote: bool = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - parse_mode: ODVInput[str] = DEFAULT_NONE, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, - filename: str = None, - quote: bool = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "Message": """Shortcut for:: @@ -1051,7 +1062,7 @@ class Message(TelegramObject): For the documentation of the arguments, please see :meth:`telegram.Bot.send_photo`. - Args: + Keyword Args: quote (:obj:`bool`, optional): If set to :obj:`True`, the photo is sent as an actual reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this parameter will be ignored. Default: :obj:`True` in group chats and @@ -1069,16 +1080,16 @@ class Message(TelegramObject): disable_notification=disable_notification, reply_to_message_id=reply_to_message_id, reply_markup=reply_markup, - read_timeout=read_timeout, - write_timeout=write_timeout, - connect_timeout=connect_timeout, - pool_timeout=pool_timeout, parse_mode=parse_mode, - api_kwargs=api_kwargs, allow_sending_without_reply=allow_sending_without_reply, caption_entities=caption_entities, filename=filename, protect_content=protect_content, + read_timeout=read_timeout, + write_timeout=write_timeout, + connect_timeout=connect_timeout, + pool_timeout=pool_timeout, + api_kwargs=api_kwargs, ) async def reply_audio( @@ -1091,18 +1102,19 @@ class Message(TelegramObject): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, + parse_mode: ODVInput[str] = DEFAULT_NONE, + thumb: FileInput = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + filename: str = None, + quote: bool = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - parse_mode: ODVInput[str] = DEFAULT_NONE, - thumb: FileInput = None, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, - filename: str = None, - quote: bool = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "Message": """Shortcut for:: @@ -1110,7 +1122,7 @@ class Message(TelegramObject): For the documentation of the arguments, please see :meth:`telegram.Bot.send_audio`. - Args: + Keyword Args: quote (:obj:`bool`, optional): If set to :obj:`True`, the audio is sent as an actual reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this parameter will be ignored. Default: :obj:`True` in group chats and @@ -1131,39 +1143,40 @@ class Message(TelegramObject): disable_notification=disable_notification, reply_to_message_id=reply_to_message_id, reply_markup=reply_markup, - read_timeout=read_timeout, - write_timeout=write_timeout, - connect_timeout=connect_timeout, - pool_timeout=pool_timeout, parse_mode=parse_mode, thumb=thumb, - api_kwargs=api_kwargs, allow_sending_without_reply=allow_sending_without_reply, caption_entities=caption_entities, filename=filename, protect_content=protect_content, + read_timeout=read_timeout, + write_timeout=write_timeout, + connect_timeout=connect_timeout, + pool_timeout=pool_timeout, + api_kwargs=api_kwargs, ) async def reply_document( self, document: Union[FileInput, "Document"], - filename: str = None, caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, + parse_mode: ODVInput[str] = DEFAULT_NONE, + thumb: FileInput = None, + disable_content_type_detection: bool = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + filename: str = None, + quote: bool = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - parse_mode: ODVInput[str] = DEFAULT_NONE, - thumb: FileInput = None, api_kwargs: JSONDict = None, - disable_content_type_detection: bool = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, - quote: bool = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "Message": """Shortcut for:: @@ -1171,7 +1184,7 @@ class Message(TelegramObject): For the documentation of the arguments, please see :meth:`telegram.Bot.send_document`. - Args: + Keyword Args: quote (:obj:`bool`, optional): If set to :obj:`True`, the document is sent as an actual reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this parameter will be ignored. Default: :obj:`True` in group chats and :obj:`False` in @@ -1215,16 +1228,17 @@ class Message(TelegramObject): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + filename: str = None, + quote: bool = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, - filename: str = None, - quote: bool = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "Message": """Shortcut for:: @@ -1232,7 +1246,7 @@ class Message(TelegramObject): For the documentation of the arguments, please see :meth:`telegram.Bot.send_animation`. - Args: + Keyword Args: quote (:obj:`bool`, optional): If set to :obj:`True`, the animation is sent as an actual reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this parameter will be ignored. Default: :obj:`True` in group chats and @@ -1272,14 +1286,15 @@ class Message(TelegramObject): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + quote: bool = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - quote: bool = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "Message": """Shortcut for:: @@ -1287,7 +1302,7 @@ class Message(TelegramObject): For the documentation of the arguments, please see :meth:`telegram.Bot.send_sticker`. - Args: + Keyword Args: quote (:obj:`bool`, optional): If set to :obj:`True`, the sticker is sent as an actual reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this parameter will be ignored. Default: :obj:`True` in group chats and :obj:`False` in @@ -1321,21 +1336,22 @@ class Message(TelegramObject): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, - read_timeout: ODVInput[float] = DEFAULT_NONE, - write_timeout: ODVInput[float] = 20, - connect_timeout: ODVInput[float] = DEFAULT_NONE, - pool_timeout: ODVInput[float] = DEFAULT_NONE, width: int = None, height: int = None, parse_mode: ODVInput[str] = DEFAULT_NONE, supports_streaming: bool = None, thumb: FileInput = None, - api_kwargs: JSONDict = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, filename: str = None, quote: bool = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, + read_timeout: ODVInput[float] = DEFAULT_NONE, + write_timeout: ODVInput[float] = 20, + connect_timeout: ODVInput[float] = DEFAULT_NONE, + pool_timeout: ODVInput[float] = DEFAULT_NONE, + api_kwargs: JSONDict = None, ) -> "Message": """Shortcut for:: @@ -1343,7 +1359,7 @@ class Message(TelegramObject): For the documentation of the arguments, please see :meth:`telegram.Bot.send_video`. - Args: + Keyword Args: quote (:obj:`bool`, optional): If set to :obj:`True`, the video is sent as an actual reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this parameter will be ignored. Default: :obj:`True` in group chats and :obj:`False` in @@ -1386,16 +1402,17 @@ class Message(TelegramObject): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, + thumb: FileInput = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + filename: str = None, + quote: bool = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - thumb: FileInput = None, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - filename: str = None, - quote: bool = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "Message": """Shortcut for:: @@ -1403,7 +1420,7 @@ class Message(TelegramObject): For the documentation of the arguments, please see :meth:`telegram.Bot.send_video_note`. - Args: + Keyword Args: quote (:obj:`bool`, optional): If set to :obj:`True`, the video note is sent as an actual reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this parameter will be ignored. Default: :obj:`True` in group chats and @@ -1441,17 +1458,18 @@ class Message(TelegramObject): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, + parse_mode: ODVInput[str] = DEFAULT_NONE, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + filename: str = None, + quote: bool = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - parse_mode: ODVInput[str] = DEFAULT_NONE, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, - filename: str = None, - quote: bool = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "Message": """Shortcut for:: @@ -1459,7 +1477,7 @@ class Message(TelegramObject): For the documentation of the arguments, please see :meth:`telegram.Bot.send_voice`. - Args: + Keyword Args: quote (:obj:`bool`, optional): If set to :obj:`True`, the voice note is sent as an actual reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this parameter will be ignored. Default: :obj:`True` in group chats and @@ -1497,19 +1515,20 @@ class Message(TelegramObject): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, - read_timeout: ODVInput[float] = DEFAULT_NONE, - write_timeout: ODVInput[float] = DEFAULT_NONE, - connect_timeout: ODVInput[float] = DEFAULT_NONE, - pool_timeout: ODVInput[float] = DEFAULT_NONE, - location: Location = None, live_period: int = None, - api_kwargs: JSONDict = None, horizontal_accuracy: float = None, heading: int = None, proximity_alert_radius: int = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - quote: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + location: Location = None, + quote: bool = None, + read_timeout: ODVInput[float] = DEFAULT_NONE, + write_timeout: ODVInput[float] = DEFAULT_NONE, + connect_timeout: ODVInput[float] = DEFAULT_NONE, + pool_timeout: ODVInput[float] = DEFAULT_NONE, + api_kwargs: JSONDict = None, ) -> "Message": """Shortcut for:: @@ -1517,7 +1536,7 @@ class Message(TelegramObject): For the documentation of the arguments, please see :meth:`telegram.Bot.send_location`. - Args: + Keyword Args: quote (:obj:`bool`, optional): If set to :obj:`True`, the location is sent as an actual reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this parameter will be ignored. Default: :obj:`True` in group chats and :obj:`False` in @@ -1559,18 +1578,19 @@ class Message(TelegramObject): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, + foursquare_type: str = None, + google_place_id: str = None, + google_place_type: str = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + venue: Venue = None, + quote: bool = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - venue: Venue = None, - foursquare_type: str = None, api_kwargs: JSONDict = None, - google_place_id: str = None, - google_place_type: str = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - quote: bool = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "Message": """Shortcut for:: @@ -1578,7 +1598,7 @@ class Message(TelegramObject): For the documentation of the arguments, please see :meth:`telegram.Bot.send_venue`. - Args: + Keyword Args: quote (:obj:`bool`, optional): If set to :obj:`True`, the venue is sent as an actual reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this parameter will be ignored. Default: :obj:`True` in group chats and :obj:`False` in @@ -1620,16 +1640,17 @@ class Message(TelegramObject): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, + vcard: str = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + contact: Contact = None, + quote: bool = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - contact: Contact = None, - vcard: str = None, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - quote: bool = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "Message": """Shortcut for:: @@ -1637,7 +1658,7 @@ class Message(TelegramObject): For the documentation of the arguments, please see :meth:`telegram.Bot.send_contact`. - Args: + Keyword Args: quote (:obj:`bool`, optional): If set to :obj:`True`, the contact is sent as an actual reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this parameter will be ignored. Default: :obj:`True` in group chats and :obj:`False` in @@ -1679,19 +1700,20 @@ class Message(TelegramObject): disable_notification: ODVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, - read_timeout: ODVInput[float] = DEFAULT_NONE, - write_timeout: ODVInput[float] = DEFAULT_NONE, - connect_timeout: ODVInput[float] = DEFAULT_NONE, - pool_timeout: ODVInput[float] = DEFAULT_NONE, explanation: str = None, explanation_parse_mode: ODVInput[str] = DEFAULT_NONE, open_period: int = None, close_date: Union[int, datetime.datetime] = None, - api_kwargs: JSONDict = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, explanation_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, - quote: bool = None, protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + quote: bool = None, + read_timeout: ODVInput[float] = DEFAULT_NONE, + write_timeout: ODVInput[float] = DEFAULT_NONE, + connect_timeout: ODVInput[float] = DEFAULT_NONE, + pool_timeout: ODVInput[float] = DEFAULT_NONE, + api_kwargs: JSONDict = None, ) -> "Message": """Shortcut for:: @@ -1699,7 +1721,7 @@ class Message(TelegramObject): For the documentation of the arguments, please see :meth:`telegram.Bot.send_poll`. - Args: + Keyword Args: quote (:obj:`bool`, optional): If set to :obj:`True`, the poll is sent as an actual reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this parameter will be ignored. Default: :obj:`True` in group chats and @@ -1741,15 +1763,16 @@ class Message(TelegramObject): disable_notification: ODVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, + emoji: str = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + quote: bool = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - emoji: str = None, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - quote: bool = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "Message": """Shortcut for:: @@ -1757,7 +1780,7 @@ class Message(TelegramObject): For the documentation of the arguments, please see :meth:`telegram.Bot.send_dice`. - Args: + Keyword Args: quote (:obj:`bool`, optional): If set to :obj:`True`, the dice is sent as an actual reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this parameter will be ignored. Default: :obj:`True` in group chats and :obj:`False` @@ -1786,6 +1809,7 @@ class Message(TelegramObject): async def reply_chat_action( self, action: str, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -1820,14 +1844,15 @@ class Message(TelegramObject): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: "InlineKeyboardMarkup" = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + quote: bool = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - quote: bool = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "Message": """Shortcut for:: @@ -1835,7 +1860,7 @@ class Message(TelegramObject): For the documentation of the arguments, please see :meth:`telegram.Bot.send_game`. - Args: + Keyword Args: quote (:obj:`bool`, optional): If set to :obj:`True`, the game is sent as an actual reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this parameter will be ignored. Default: :obj:`True` in group chats and :obj:`False` @@ -1887,16 +1912,17 @@ class Message(TelegramObject): provider_data: Union[str, object] = None, send_phone_number_to_provider: bool = None, send_email_to_provider: bool = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + max_tip_amount: int = None, + suggested_tip_amounts: List[int] = None, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + quote: bool = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - quote: bool = None, - max_tip_amount: int = None, - suggested_tip_amounts: List[int] = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "Message": """Shortcut for:: @@ -1916,7 +1942,7 @@ class Message(TelegramObject): As of Bot API 5.2, the parameter :paramref:`start_parameter ` is optional. - Args: + Keyword Args: quote (:obj:`bool`, optional): If set to :obj:`True`, the invoice is sent as an actual reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this parameter will be ignored. Default: :obj:`True` in group chats and :obj:`False` @@ -1966,12 +1992,13 @@ class Message(TelegramObject): self, chat_id: Union[int, str], disable_notification: DVInput[bool] = DEFAULT_NONE, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "Message": """Shortcut for:: @@ -2002,12 +2029,12 @@ class Message(TelegramObject): from_chat_id=self.chat_id, message_id=self.message_id, disable_notification=disable_notification, + protect_content=protect_content, read_timeout=read_timeout, write_timeout=write_timeout, connect_timeout=connect_timeout, pool_timeout=pool_timeout, api_kwargs=api_kwargs, - protect_content=protect_content, ) async def copy( @@ -2020,12 +2047,13 @@ class Message(TelegramObject): reply_to_message_id: int = None, allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE, reply_markup: ReplyMarkup = None, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "MessageId": """Shortcut for:: @@ -2073,13 +2101,14 @@ class Message(TelegramObject): reply_to_message_id: int = None, allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE, reply_markup: ReplyMarkup = None, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + quote: bool = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - quote: bool = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "MessageId": """Shortcut for:: @@ -2093,7 +2122,7 @@ class Message(TelegramObject): For the documentation of the arguments, please see :meth:`telegram.Bot.copy_message`. - Args: + Keyword Args: quote (:obj:`bool`, optional): If set to :obj:`True`, the copy is sent as an actual reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this parameter will be ignored. Default: :obj:`True` in group chats and @@ -2131,12 +2160,13 @@ class Message(TelegramObject): parse_mode: ODVInput[str] = DEFAULT_NONE, disable_web_page_preview: ODVInput[bool] = DEFAULT_NONE, reply_markup: InlineKeyboardMarkup = None, + entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, ) -> Union["Message", bool]: """Shortcut for:: @@ -2176,13 +2206,14 @@ class Message(TelegramObject): self, caption: str = None, reply_markup: InlineKeyboardMarkup = None, + parse_mode: ODVInput[str] = DEFAULT_NONE, + caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - parse_mode: ODVInput[str] = DEFAULT_NONE, api_kwargs: JSONDict = None, - caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, ) -> Union["Message", bool]: """Shortcut for:: @@ -2222,6 +2253,7 @@ class Message(TelegramObject): self, media: "InputMedia", reply_markup: InlineKeyboardMarkup = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -2263,6 +2295,7 @@ class Message(TelegramObject): async def edit_reply_markup( self, reply_markup: Optional["InlineKeyboardMarkup"] = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -2303,16 +2336,17 @@ class Message(TelegramObject): self, latitude: float = None, longitude: float = None, - location: Location = None, reply_markup: InlineKeyboardMarkup = None, + horizontal_accuracy: float = None, + heading: int = None, + proximity_alert_radius: int = None, + *, + location: Location = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - horizontal_accuracy: float = None, - heading: int = None, - proximity_alert_radius: int = None, ) -> Union["Message", bool]: """Shortcut for:: @@ -2353,6 +2387,7 @@ class Message(TelegramObject): async def stop_live_location( self, reply_markup: InlineKeyboardMarkup = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -2395,6 +2430,7 @@ class Message(TelegramObject): score: int, force: bool = None, disable_edit_message: bool = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -2436,6 +2472,7 @@ class Message(TelegramObject): async def get_game_high_scores( self, user_id: Union[int, str], + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -2473,6 +2510,7 @@ class Message(TelegramObject): async def delete( self, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -2504,6 +2542,7 @@ class Message(TelegramObject): async def stop_poll( self, reply_markup: InlineKeyboardMarkup = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -2537,6 +2576,7 @@ class Message(TelegramObject): async def pin( self, disable_notification: ODVInput[bool] = DEFAULT_NONE, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -2568,6 +2608,7 @@ class Message(TelegramObject): async def unpin( self, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, diff --git a/telegram/_passport/passportfile.py b/telegram/_passport/passportfile.py index 546e35cc7..c0e18f0a5 100644 --- a/telegram/_passport/passportfile.py +++ b/telegram/_passport/passportfile.py @@ -138,6 +138,7 @@ class PassportFile(TelegramObject): async def get_file( self, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, diff --git a/telegram/_payment/precheckoutquery.py b/telegram/_payment/precheckoutquery.py index 421bb42c4..56d5c94b3 100644 --- a/telegram/_payment/precheckoutquery.py +++ b/telegram/_payment/precheckoutquery.py @@ -120,6 +120,7 @@ class PreCheckoutQuery(TelegramObject): self, ok: bool, error_message: str = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, diff --git a/telegram/_payment/shippingquery.py b/telegram/_payment/shippingquery.py index 7d8031b88..ab970690d 100644 --- a/telegram/_payment/shippingquery.py +++ b/telegram/_payment/shippingquery.py @@ -95,6 +95,7 @@ class ShippingQuery(TelegramObject): ok: bool, shipping_options: List[ShippingOption] = None, error_message: str = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, diff --git a/telegram/_user.py b/telegram/_user.py index e0ba8086b..beb2ee26a 100644 --- a/telegram/_user.py +++ b/telegram/_user.py @@ -62,6 +62,13 @@ class User(TelegramObject): Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`id` is equal. + .. versionchanged:: 20.0 + + The following are now keyword-only arguments in Bot methods: + ``location``, ``filename``, ``venue``, ``contact``, + ``{read, write, connect, pool}_timeout`` ``api_kwargs``. Use a named argument for those, + and notice that some positional arguments changed position as a result. + Args: id (:obj:`int`): Unique identifier for this user or bot. is_bot (:obj:`bool`): :obj:`True`, if this user is a bot. @@ -166,6 +173,7 @@ class User(TelegramObject): self, offset: int = None, limit: int = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -254,6 +262,7 @@ class User(TelegramObject): self, message_id: int, disable_notification: ODVInput[bool] = DEFAULT_NONE, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -283,12 +292,13 @@ class User(TelegramObject): async def unpin_message( self, + message_id: int = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - message_id: int = None, ) -> bool: """Shortcut for:: @@ -312,6 +322,7 @@ class User(TelegramObject): async def unpin_all_messages( self, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -346,14 +357,15 @@ class User(TelegramObject): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "Message": """Shortcut for:: @@ -373,14 +385,14 @@ class User(TelegramObject): disable_notification=disable_notification, reply_to_message_id=reply_to_message_id, reply_markup=reply_markup, + allow_sending_without_reply=allow_sending_without_reply, + entities=entities, + protect_content=protect_content, read_timeout=read_timeout, write_timeout=write_timeout, connect_timeout=connect_timeout, pool_timeout=pool_timeout, api_kwargs=api_kwargs, - allow_sending_without_reply=allow_sending_without_reply, - entities=entities, - protect_content=protect_content, ) async def send_photo( @@ -390,16 +402,17 @@ class User(TelegramObject): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, + parse_mode: ODVInput[str] = DEFAULT_NONE, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + filename: str = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - parse_mode: ODVInput[str] = DEFAULT_NONE, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, - filename: str = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "Message": """Shortcut for:: @@ -418,16 +431,16 @@ class User(TelegramObject): disable_notification=disable_notification, reply_to_message_id=reply_to_message_id, reply_markup=reply_markup, - read_timeout=read_timeout, - write_timeout=write_timeout, - connect_timeout=connect_timeout, - pool_timeout=pool_timeout, parse_mode=parse_mode, - api_kwargs=api_kwargs, allow_sending_without_reply=allow_sending_without_reply, caption_entities=caption_entities, filename=filename, protect_content=protect_content, + read_timeout=read_timeout, + write_timeout=write_timeout, + connect_timeout=connect_timeout, + pool_timeout=pool_timeout, + api_kwargs=api_kwargs, ) async def send_media_group( @@ -437,13 +450,14 @@ class User(TelegramObject): ], disable_notification: ODVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> List["Message"]: """Shortcut for:: @@ -479,17 +493,18 @@ class User(TelegramObject): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, + parse_mode: ODVInput[str] = DEFAULT_NONE, + thumb: FileInput = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + filename: str = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - parse_mode: ODVInput[str] = DEFAULT_NONE, - thumb: FileInput = None, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, - filename: str = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "Message": """Shortcut for:: @@ -511,22 +526,23 @@ class User(TelegramObject): disable_notification=disable_notification, reply_to_message_id=reply_to_message_id, reply_markup=reply_markup, - read_timeout=read_timeout, - write_timeout=write_timeout, - connect_timeout=connect_timeout, - pool_timeout=pool_timeout, parse_mode=parse_mode, thumb=thumb, - api_kwargs=api_kwargs, allow_sending_without_reply=allow_sending_without_reply, caption_entities=caption_entities, filename=filename, protect_content=protect_content, + read_timeout=read_timeout, + write_timeout=write_timeout, + connect_timeout=connect_timeout, + pool_timeout=pool_timeout, + api_kwargs=api_kwargs, ) async def send_chat_action( self, action: str, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -564,15 +580,16 @@ class User(TelegramObject): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, + vcard: str = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + contact: "Contact" = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - contact: "Contact" = None, - vcard: str = None, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "Message": """Shortcut for:: @@ -608,14 +625,15 @@ class User(TelegramObject): disable_notification: ODVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, + emoji: str = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - emoji: str = None, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "Message": """Shortcut for:: @@ -645,22 +663,23 @@ class User(TelegramObject): async def send_document( self, document: Union[FileInput, "Document"], - filename: str = None, caption: str = None, disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, - read_timeout: ODVInput[float] = DEFAULT_NONE, - write_timeout: ODVInput[float] = 20, - connect_timeout: ODVInput[float] = DEFAULT_NONE, - pool_timeout: ODVInput[float] = DEFAULT_NONE, parse_mode: ODVInput[str] = DEFAULT_NONE, thumb: FileInput = None, - api_kwargs: JSONDict = None, disable_content_type_detection: bool = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + filename: str = None, + read_timeout: ODVInput[float] = DEFAULT_NONE, + write_timeout: ODVInput[float] = 20, + connect_timeout: ODVInput[float] = DEFAULT_NONE, + pool_timeout: ODVInput[float] = DEFAULT_NONE, + api_kwargs: JSONDict = None, ) -> "Message": """Shortcut for:: @@ -699,13 +718,14 @@ class User(TelegramObject): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: "InlineKeyboardMarkup" = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "Message": """Shortcut for:: @@ -756,15 +776,16 @@ class User(TelegramObject): provider_data: Union[str, object] = None, send_phone_number_to_provider: bool = None, send_email_to_provider: bool = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + max_tip_amount: int = None, + suggested_tip_amounts: List[int] = None, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - max_tip_amount: int = None, - suggested_tip_amounts: List[int] = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "Message": """Shortcut for:: @@ -828,18 +849,19 @@ class User(TelegramObject): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, - read_timeout: ODVInput[float] = DEFAULT_NONE, - write_timeout: ODVInput[float] = DEFAULT_NONE, - connect_timeout: ODVInput[float] = DEFAULT_NONE, - pool_timeout: ODVInput[float] = DEFAULT_NONE, - location: "Location" = None, live_period: int = None, - api_kwargs: JSONDict = None, horizontal_accuracy: float = None, heading: int = None, proximity_alert_radius: int = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + location: "Location" = None, + read_timeout: ODVInput[float] = DEFAULT_NONE, + write_timeout: ODVInput[float] = DEFAULT_NONE, + connect_timeout: ODVInput[float] = DEFAULT_NONE, + pool_timeout: ODVInput[float] = DEFAULT_NONE, + api_kwargs: JSONDict = None, ) -> "Message": """Shortcut for:: @@ -884,15 +906,16 @@ class User(TelegramObject): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + filename: str = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, - filename: str = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "Message": """Shortcut for:: @@ -933,13 +956,14 @@ class User(TelegramObject): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "Message": """Shortcut for:: @@ -974,20 +998,21 @@ class User(TelegramObject): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, - read_timeout: ODVInput[float] = DEFAULT_NONE, - write_timeout: ODVInput[float] = 20, - connect_timeout: ODVInput[float] = DEFAULT_NONE, - pool_timeout: ODVInput[float] = DEFAULT_NONE, width: int = None, height: int = None, parse_mode: ODVInput[str] = DEFAULT_NONE, supports_streaming: bool = None, thumb: FileInput = None, - api_kwargs: JSONDict = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, - filename: str = None, protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + filename: str = None, + read_timeout: ODVInput[float] = DEFAULT_NONE, + write_timeout: ODVInput[float] = 20, + connect_timeout: ODVInput[float] = DEFAULT_NONE, + pool_timeout: ODVInput[float] = DEFAULT_NONE, + api_kwargs: JSONDict = None, ) -> "Message": """Shortcut for:: @@ -1033,17 +1058,18 @@ class User(TelegramObject): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, - read_timeout: ODVInput[float] = DEFAULT_NONE, - write_timeout: ODVInput[float] = DEFAULT_NONE, - connect_timeout: ODVInput[float] = DEFAULT_NONE, - pool_timeout: ODVInput[float] = DEFAULT_NONE, - venue: "Venue" = None, foursquare_type: str = None, - api_kwargs: JSONDict = None, google_place_id: str = None, google_place_type: str = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + venue: "Venue" = None, + read_timeout: ODVInput[float] = DEFAULT_NONE, + write_timeout: ODVInput[float] = DEFAULT_NONE, + connect_timeout: ODVInput[float] = DEFAULT_NONE, + pool_timeout: ODVInput[float] = DEFAULT_NONE, + api_kwargs: JSONDict = None, ) -> "Message": """Shortcut for:: @@ -1086,15 +1112,16 @@ class User(TelegramObject): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, + thumb: FileInput = None, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + filename: str = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - thumb: FileInput = None, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - filename: str = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "Message": """Shortcut for:: @@ -1133,16 +1160,17 @@ class User(TelegramObject): disable_notification: DVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, + parse_mode: ODVInput[str] = DEFAULT_NONE, + allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + filename: str = None, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = 20, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - parse_mode: ODVInput[str] = DEFAULT_NONE, api_kwargs: JSONDict = None, - allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, - caption_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, - filename: str = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "Message": """Shortcut for:: @@ -1186,18 +1214,19 @@ class User(TelegramObject): disable_notification: ODVInput[bool] = DEFAULT_NONE, reply_to_message_id: int = None, reply_markup: ReplyMarkup = None, - read_timeout: ODVInput[float] = DEFAULT_NONE, - write_timeout: ODVInput[float] = DEFAULT_NONE, - connect_timeout: ODVInput[float] = DEFAULT_NONE, - pool_timeout: ODVInput[float] = DEFAULT_NONE, explanation: str = None, explanation_parse_mode: ODVInput[str] = DEFAULT_NONE, open_period: int = None, close_date: Union[int, datetime] = None, - api_kwargs: JSONDict = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, explanation_entities: Union[List["MessageEntity"], Tuple["MessageEntity", ...]] = None, protect_content: ODVInput[bool] = DEFAULT_NONE, + *, + read_timeout: ODVInput[float] = DEFAULT_NONE, + write_timeout: ODVInput[float] = DEFAULT_NONE, + connect_timeout: ODVInput[float] = DEFAULT_NONE, + pool_timeout: ODVInput[float] = DEFAULT_NONE, + api_kwargs: JSONDict = None, ) -> "Message": """Shortcut for:: @@ -1246,12 +1275,13 @@ class User(TelegramObject): reply_to_message_id: int = None, allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE, reply_markup: ReplyMarkup = None, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "MessageId": """Shortcut for:: @@ -1293,12 +1323,13 @@ class User(TelegramObject): reply_to_message_id: int = None, allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE, reply_markup: ReplyMarkup = None, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> "MessageId": """Shortcut for:: @@ -1332,6 +1363,7 @@ class User(TelegramObject): async def approve_join_request( self, chat_id: Union[int, str], + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -1364,6 +1396,7 @@ class User(TelegramObject): async def decline_join_request( self, chat_id: Union[int, str], + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -1396,6 +1429,7 @@ class User(TelegramObject): async def set_menu_button( self, menu_button: MenuButton = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -1428,6 +1462,7 @@ class User(TelegramObject): async def get_menu_button( self, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, diff --git a/telegram/ext/_extbot.py b/telegram/ext/_extbot.py index c768746da..7e2e2065a 100644 --- a/telegram/ext/_extbot.py +++ b/telegram/ext/_extbot.py @@ -241,12 +241,13 @@ class ExtBot(Bot): disable_notification: ODVInput[bool] = DEFAULT_NONE, reply_markup: ReplyMarkup = None, allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> Union[bool, Message]: # We override this method to call self._replace_keyboard and self._insert_callback_data. # This covers most methods that have a reply_markup @@ -257,12 +258,12 @@ class ExtBot(Bot): disable_notification=disable_notification, reply_markup=self._replace_keyboard(reply_markup), allow_sending_without_reply=allow_sending_without_reply, + protect_content=protect_content, read_timeout=read_timeout, write_timeout=write_timeout, connect_timeout=connect_timeout, pool_timeout=pool_timeout, api_kwargs=api_kwargs, - protect_content=protect_content, ) if isinstance(result, Message): self._insert_callback_data(result) @@ -273,22 +274,23 @@ class ExtBot(Bot): offset: int = None, limit: int = None, timeout: float = None, + allowed_updates: List[str] = None, + *, read_timeout: float = 2, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, - allowed_updates: List[str] = None, api_kwargs: JSONDict = None, ) -> List[Update]: updates = await super().get_updates( offset=offset, limit=limit, timeout=timeout, + allowed_updates=allowed_updates, read_timeout=read_timeout, write_timeout=write_timeout, connect_timeout=connect_timeout, pool_timeout=pool_timeout, - allowed_updates=allowed_updates, api_kwargs=api_kwargs, ) @@ -360,6 +362,7 @@ class ExtBot(Bot): chat_id: Union[int, str], message_id: int, reply_markup: InlineKeyboardMarkup = None, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, @@ -390,12 +393,13 @@ class ExtBot(Bot): reply_to_message_id: int = None, allow_sending_without_reply: DVInput[bool] = DEFAULT_NONE, reply_markup: ReplyMarkup = None, + protect_content: ODVInput[bool] = DEFAULT_NONE, + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, pool_timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, - protect_content: ODVInput[bool] = DEFAULT_NONE, ) -> MessageId: # We override this method to call self._replace_keyboard return await super().copy_message( @@ -409,17 +413,18 @@ class ExtBot(Bot): reply_to_message_id=reply_to_message_id, allow_sending_without_reply=allow_sending_without_reply, reply_markup=self._replace_keyboard(reply_markup), + protect_content=protect_content, read_timeout=read_timeout, write_timeout=write_timeout, connect_timeout=connect_timeout, pool_timeout=pool_timeout, api_kwargs=api_kwargs, - protect_content=protect_content, ) async def get_chat( self, chat_id: Union[str, int], + *, read_timeout: ODVInput[float] = DEFAULT_NONE, write_timeout: ODVInput[float] = DEFAULT_NONE, connect_timeout: ODVInput[float] = DEFAULT_NONE, diff --git a/tests/conftest.py b/tests/conftest.py index 628c68960..621d363e0 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -504,6 +504,10 @@ def check_shortcut_signature( # shortcuts to return more specific types than the bot method, but it's only annotations after # all for kwarg in effective_shortcut_args: + expected_kind = bot_sig.parameters[kwarg].kind + if shortcut_sig.parameters[kwarg].kind != expected_kind: + raise Exception(f"Argument {kwarg} must be of kind {expected_kind}.") + if bot_sig.parameters[kwarg].annotation != shortcut_sig.parameters[kwarg].annotation: if isinstance(bot_sig.parameters[kwarg].annotation, type): if bot_sig.parameters[kwarg].annotation.__name__ != str( @@ -527,6 +531,10 @@ def check_shortcut_signature( f"Default for argument {arg} does not match the default of the Bot method." ) + for kwarg in additional_kwargs: + if not shortcut_sig.parameters[kwarg].kind == inspect.Parameter.KEYWORD_ONLY: + raise Exception(f"Argument {kwarg} must be a positional-only argument!") + return True diff --git a/tests/test_bot.py b/tests/test_bot.py index 607ea02a6..e61c42599 100644 --- a/tests/test_bot.py +++ b/tests/test_bot.py @@ -2381,7 +2381,7 @@ class TestBot: # Test setting our chat menu button to Webapp. my_menu = MenuButtonWebApp("click me!", WebAppInfo("https://telegram.org/")) - await bot.set_chat_menu_button(chat_id, my_menu) + await bot.set_chat_menu_button(chat_id=chat_id, menu_button=my_menu) menu_button = await bot.get_chat_menu_button(chat_id) assert isinstance(menu_button, MenuButtonWebApp) assert menu_button.type == MenuButtonType.WEB_APP diff --git a/tests/test_chat.py b/tests/test_chat.py index 99ade9ec6..d44d23806 100644 --- a/tests/test_chat.py +++ b/tests/test_chat.py @@ -28,8 +28,8 @@ from tests.conftest import check_defaults_handling, check_shortcut_call, check_s def chat(bot): return Chat( TestChat.id_, - TestChat.title, - TestChat.type_, + title=TestChat.title, + type=TestChat.type_, username=TestChat.username, all_members_are_administrators=TestChat.all_members_are_administrators, bot=bot, diff --git a/tests/test_message.py b/tests/test_message.py index 6eb258aa4..a9e1181de 100644 --- a/tests/test_message.py +++ b/tests/test_message.py @@ -62,9 +62,9 @@ from tests.test_passport import RAW_PASSPORT_DATA @pytest.fixture(scope="class") def message(bot): return Message( - TestMessage.id_, - TestMessage.date, - TestMessage.chat, + message_id=TestMessage.id_, + date=TestMessage.date, + chat=TestMessage.chat, from_user=TestMessage.from_user, bot=bot, ) @@ -344,7 +344,14 @@ class TestMessage: b"\\u200d\\U0001f467\\U0001f431http://google.com" ).decode("unicode-escape") entity = MessageEntity(type=MessageEntity.URL, offset=13, length=17) - message = Message(1, self.from_user, self.date, self.chat, text=text, entities=[entity]) + message = Message( + 1, + from_user=self.from_user, + date=self.date, + chat=self.chat, + text=text, + entities=[entity], + ) assert message.parse_entity(entity) == "http://google.com" with pytest.raises(RuntimeError, match="Message has no"): @@ -357,7 +364,12 @@ class TestMessage: ).decode("unicode-escape") entity = MessageEntity(type=MessageEntity.URL, offset=13, length=17) message = Message( - 1, self.from_user, self.date, self.chat, caption=caption, caption_entities=[entity] + 1, + from_user=self.from_user, + date=self.date, + chat=self.chat, + caption=caption, + caption_entities=[entity], ) assert message.parse_caption_entity(entity) == "http://google.com" @@ -372,7 +384,12 @@ class TestMessage: entity = MessageEntity(type=MessageEntity.URL, offset=13, length=17) entity_2 = MessageEntity(type=MessageEntity.BOLD, offset=13, length=1) message = Message( - 1, self.from_user, self.date, self.chat, text=text, entities=[entity_2, entity] + 1, + from_user=self.from_user, + date=self.date, + chat=self.chat, + text=text, + entities=[entity_2, entity], ) assert message.parse_entities(MessageEntity.URL) == {entity: "http://google.com"} assert message.parse_entities() == {entity: "http://google.com", entity_2: "h"} @@ -386,9 +403,9 @@ class TestMessage: entity_2 = MessageEntity(type=MessageEntity.BOLD, offset=13, length=1) message = Message( 1, - self.from_user, - self.date, - self.chat, + from_user=self.from_user, + date=self.date, + chat=self.chat, caption=text, caption_entities=[entity_2, entity], ) @@ -507,7 +524,12 @@ class TestMessage: expected = b"\\U0001f469\\u200d\\U0001f469\\u200d ABC".decode("unicode-escape") bold_entity = MessageEntity(type=MessageEntity.BOLD, offset=7, length=3) message = Message( - 1, self.from_user, self.date, self.chat, text=text, entities=[bold_entity] + 1, + from_user=self.from_user, + date=self.date, + chat=self.chat, + text=text, + entities=[bold_entity], ) assert expected == message.text_html @@ -607,9 +629,9 @@ class TestMessage: bold_entity = MessageEntity(type=MessageEntity.BOLD, offset=7, length=3) message = Message( 1, - self.from_user, - self.date, - self.chat, + from_user=self.from_user, + date=self.date, + chat=self.chat, caption=caption, caption_entities=[bold_entity], ) @@ -621,9 +643,9 @@ class TestMessage: bold_entity = MessageEntity(type=MessageEntity.BOLD, offset=7, length=3) message = Message( 1, - self.from_user, - self.date, - self.chat, + from_user=self.from_user, + date=self.date, + chat=self.chat, caption=caption, caption_entities=[bold_entity], ) diff --git a/tests/test_official.py b/tests/test_official.py index 60de72032..3d5b4e565 100644 --- a/tests/test_official.py +++ b/tests/test_official.py @@ -123,6 +123,14 @@ def check_method(h4): assert (sig.parameters.keys() ^ checked) - ignored == set() + kw_or_positional_args = [ + p.name for p in sig.parameters.values() if p.kind != inspect.Parameter.KEYWORD_ONLY + ] + assert set(kw_or_positional_args).difference(checked).difference(["self"]) == set(), ( + f"In {method.__qualname__}, extra args should be keyword only " + f"(compared to {name} in API)" + ) + def check_object(h4): name = h4.text