From a397e6c3c6404a07ac0294c0b6674767ff399bb7 Mon Sep 17 00:00:00 2001 From: Bibo-Joshi Date: Sun, 2 Feb 2020 20:20:54 +0100 Subject: [PATCH] Doc fixes (#1642) * Add missing DispatcherHandlerStop to docs * Forgot to stage new file ... * update docstring for bot.edit_message_* * make job callback docs context based * Flake8 * Fix doc strings of message.reply_ * Update thumb size docs * Add missing DispatcherHandlerStop to docs * Forgot to stage new file ... * update docstring for bot.edit_message_* * make job callback docs context based * Flake8 * Fix doc strings of message.reply_ * Update thumb size docs * Update docs on InlineQuery.query length * Minor doc updates * change module to class in to_float_timestamp doc string --- .../telegram.ext.dispatcherhandlerstop.rst | 6 + docs/source/telegram.ext.rst | 1 + telegram/bot.py | 130 +++++++++--------- telegram/ext/dispatcher.py | 3 +- telegram/ext/jobqueue.py | 36 +++-- telegram/files/inputmedia.py | 16 +-- telegram/inline/inlinequery.py | 4 +- telegram/message.py | 67 +++++---- telegram/utils/helpers.py | 2 +- 9 files changed, 150 insertions(+), 115 deletions(-) create mode 100644 docs/source/telegram.ext.dispatcherhandlerstop.rst diff --git a/docs/source/telegram.ext.dispatcherhandlerstop.rst b/docs/source/telegram.ext.dispatcherhandlerstop.rst new file mode 100644 index 000000000..e115eb8b3 --- /dev/null +++ b/docs/source/telegram.ext.dispatcherhandlerstop.rst @@ -0,0 +1,6 @@ +telegram.ext.DispatcherHandlerStop +================================== + +.. autoclass:: telegram.ext.DispatcherHandlerStop + :members: + :show-inheritance: diff --git a/docs/source/telegram.ext.rst b/docs/source/telegram.ext.rst index 4c7230ad5..02e273768 100644 --- a/docs/source/telegram.ext.rst +++ b/docs/source/telegram.ext.rst @@ -5,6 +5,7 @@ telegram.ext package telegram.ext.updater telegram.ext.dispatcher + telegram.ext.dispatcherhandlerstop telegram.ext.filters telegram.ext.job telegram.ext.jobqueue diff --git a/telegram/bot.py b/telegram/bot.py index becf69ead..f6a5ebf01 100644 --- a/telegram/bot.py +++ b/telegram/bot.py @@ -455,10 +455,10 @@ class Bot(TelegramObject): reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. - thumb (`filelike object`, optional): Thumbnail of the file sent. - The thumbnail should be in JPEG format and less than 200 kB in size. - A thumbnail's width and height should not exceed 320. - Ignored if the file is passed as a string or file_id. + thumb (`filelike object`, optional): Thumbnail of the + file sent. The thumbnail should be in JPEG format and less than 200 kB in size. + A thumbnail's width and height should not exceed 320. Ignored if the file is not + is passed as a string or file_id. timeout (:obj:`int` | :obj:`float`, optional): Send file timeout (default: 20 seconds). **kwargs (:obj:`dict`): Arbitrary keyword arguments. @@ -538,10 +538,10 @@ class Bot(TelegramObject): reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. - thumb (`filelike object`, optional): Thumbnail of the file sent. - The thumbnail should be in JPEG format and less than 200 kB in size. - A thumbnail's width and height should not exceed 320. - Ignored if the file is passed as a string or file_id. + thumb (`filelike object`, optional): Thumbnail of the + file sent. The thumbnail should be in JPEG format and less than 200 kB in size. + A thumbnail's width and height should not exceed 320. Ignored if the file is not + is passed as a string or file_id. timeout (:obj:`int` | :obj:`float`, optional): Send file timeout (default: 20 seconds). **kwargs (:obj:`dict`): Arbitrary keyword arguments. @@ -676,10 +676,10 @@ class Bot(TelegramObject): reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. - thumb (`filelike object`, optional): Thumbnail of the file sent. - The thumbnail should be in JPEG format and less than 200 kB in size. - A thumbnail's width and height should not exceed 320. - Ignored if the file is passed as a string or file_id. + thumb (`filelike object`, optional): Thumbnail of the + file sent. The thumbnail should be in JPEG format and less than 200 kB in size. + A thumbnail's width and height should not exceed 320. Ignored if the file is not + is passed as a string or file_id. timeout (:obj:`int` | :obj:`float`, optional): Send file timeout (default: 20 seconds). **kwargs (:obj:`dict`): Arbitrary keyword arguments. @@ -755,10 +755,10 @@ class Bot(TelegramObject): reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. - thumb (`filelike object`, optional): Thumbnail of the file sent. - The thumbnail should be in JPEG format and less than 200 kB in size. - A thumbnail's width and height should not exceed 320. - Ignored if the file is passed as a string or file_id. + thumb (`filelike object`, optional): Thumbnail of the + file sent. The thumbnail should be in JPEG format and less than 200 kB in size. + A thumbnail's width and height should not exceed 320. Ignored if the file is not + is passed as a string or file_id. timeout (:obj:`int` | :obj:`float`, optional): Send file timeout (default: 20 seconds). **kwargs (:obj:`dict`): Arbitrary keyword arguments. @@ -820,10 +820,10 @@ class Bot(TelegramObject): duration (:obj:`int`, optional): Duration of sent animation in seconds. width (:obj:`int`, optional): Animation width. height (:obj:`int`, optional): Animation height. - thumb (`filelike object`, optional): Thumbnail of the file sent. - The thumbnail should be in JPEG format and less than 200 kB in size. - A thumbnail's width and height should not exceed 320. - Ignored if the file is passed as a string or file_id. + thumb (`filelike object`, optional): Thumbnail of the + file sent. The thumbnail should be in JPEG format and less than 200 kB in size. + A thumbnail's width and height should not exceed 320. Ignored if the file is not + is passed as a string or file_id. caption (:obj:`str`, optional): Animation caption (may also be used when resending animations by file_id), 0-1024 characters. parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to @@ -1073,8 +1073,9 @@ class Bot(TelegramObject): You can either supply a :obj:`latitude` and :obj:`longitude` or a :obj:`location`. Args: - chat_id (:obj:`int` | :obj:`str`): Unique identifier for the target chat or username - of the target channel (in the format @channelusername). + chat_id (:obj:`int` | :obj:`str`, optional): Required if inline_message_id is not + specified. Unique identifier for the target chat or username of the target channel + (in the format @channelusername). message_id (:obj:`int`, optional): Required if inline_message_id is not specified. Identifier of the sent message. inline_message_id (:obj:`str`, optional): Required if chat_id and message_id are not @@ -1082,9 +1083,8 @@ class Bot(TelegramObject): latitude (:obj:`float`, optional): Latitude of location. longitude (:obj:`float`, optional): Longitude of location. location (:class:`telegram.Location`, optional): The location to send. - reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options. A - JSON-serialized object for an inline keyboard, custom reply keyboard, instructions - to remove reply keyboard or to force a reply from the user. + reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): A JSON-serialized + object for an inline keyboard. timeout (:obj:`int` | :obj:`float`, optional): If this value is specified, use it as the read timeout from the server (instead of the one specified during creation of the connection pool). @@ -1704,21 +1704,21 @@ class Bot(TelegramObject): bots). Args: - chat_id (:obj:`int` | :obj:`str`): Unique identifier for the target chat or username - of the target channel (in the format @channelusername). + chat_id (:obj:`int` | :obj:`str`, optional): Required if inline_message_id is not + specified. Unique identifier for the target chat or username of the target channel + (in the format @channelusername) message_id (:obj:`int`, optional): Required if inline_message_id is not specified. 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. text (:obj:`str`): New text of the message. - parse_mode (:obj:`str`): Send Markdown or HTML, if you want Telegram apps to show bold, - italic, fixed-width text or inline URLs in your bot's message. See the constants in - :class:`telegram.ParseMode` for the available modes. + parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to + show bold, italic, fixed-width text or inline URLs in your bot's message. See the + constants in :class:`telegram.ParseMode` for the available modes. disable_web_page_preview (:obj:`bool`, optional): Disables link previews for links in this message. - reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options. A - JSON-serialized object for an inline keyboard, custom reply keyboard, instructions - to remove reply keyboard or to force a reply from the user. + reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): A JSON-serialized + object for an inline keyboard. timeout (:obj:`int` | :obj:`float`, optional): If this value is specified, use it as the read timeout from the server (instead of the one specified during creation of the connection pool). @@ -1764,8 +1764,9 @@ class Bot(TelegramObject): (for inline bots). Args: - chat_id (:obj:`int` | :obj:`str`): Unique identifier for the target chat or username - of the target channel (in the format @channelusername). + chat_id (:obj:`int` | :obj:`str`, optional): Required if inline_message_id is not + specified. Unique identifier for the target chat or username of the target channel + (in the format @channelusername) message_id (:obj:`int`, optional): Required if inline_message_id is not specified. Identifier of the sent message. inline_message_id (:obj:`str`, optional): Required if chat_id and message_id are not @@ -1774,9 +1775,8 @@ class Bot(TelegramObject): parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. See the constants in :class:`telegram.ParseMode` for the available modes. - reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options. A - JSON-serialized object for an inline keyboard, custom reply keyboard, instructions - to remove reply keyboard or to force a reply from the user. + reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): A JSON-serialized + object for an inline keyboard. timeout (:obj:`int` | :obj:`float`, optional): If this value is specified, use it as the read timeout from the server (instead of the one specified during creation of the connection pool). @@ -1829,17 +1829,17 @@ class Bot(TelegramObject): returned. Args: - chat_id (:obj:`int` | :obj:`str`, optional): Unique identifier for the target chat or - username of the target channel (in the format @channelusername). + chat_id (:obj:`int` | :obj:`str`, optional): Required if inline_message_id is not + specified. Unique identifier for the target chat or username of the target channel + (in the format @channelusername). message_id (:obj:`int`, optional): Required if inline_message_id is not specified. 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. media (:class:`telegram.InputMedia`): An object for a new media content of the message. - reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options. A - JSON-serialized object for an inline keyboard, custom reply keyboard, instructions - to remove reply keyboard or to force a reply from the user. + reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): A JSON-serialized + object for an inline keyboard. timeout (:obj:`int` | :obj:`float`, optional): If this value is specified, use it as the read timeout from the server (instead of the one specified during creation of the connection pool). @@ -1877,15 +1877,15 @@ class Bot(TelegramObject): (for inline bots). Args: - chat_id (:obj:`int` | :obj:`str`): Unique identifier for the target chat or username - of the target channel (in the format @channelusername). + chat_id (:obj:`int` | :obj:`str`, optional): Required if inline_message_id is not + specified. Unique identifier for the target chat or username of the target channel + (in the format @channelusername). message_id (:obj:`int`, optional): Required if inline_message_id is not specified. 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. - reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options. A - JSON-serialized object for an inline keyboard, custom reply keyboard, instructions - to remove reply keyboard or to force a reply from the user. + reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): A JSON-serialized + object for an inline keyboard. timeout (:obj:`int` | :obj:`float`, optional): If this value is specified, use it as the read timeout from the server (instead of the one specified during creation of the connection pool). @@ -1940,10 +1940,10 @@ class Bot(TelegramObject): 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): 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. + allowed_updates (List[:obj:`str`]), optional): A JSON-serialized 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 regardless of type (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 @@ -2020,14 +2020,14 @@ class Bot(TelegramObject): connections to the webhook for update delivery, 1-100. Defaults to 40. Use lower values to limit the load on your bot's server, and higher values to increase your bot's throughput. - allowed_updates (List[:obj:`str`], optional): 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 regardless of type (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 set_webhook, so unwanted updates may be - received for a short period of time. + allowed_updates (List[:obj:`str`], optional): A JSON-serialized 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 regardless of type (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 set_webhook, so unwanted + updates may be received for a short period of time. timeout (:obj:`int` | :obj:`float`, optional): If this value is specified, use it as the read timeout from the server (instead of the one specified during creation of the connection pool). @@ -2041,12 +2041,17 @@ class Bot(TelegramObject): work. 3. Ports currently supported for Webhooks: 443, 80, 88, 8443. + If you're having any trouble setting up webhooks, please check out this `guide to + Webhooks`_. + Returns: :obj:`bool` On success, ``True`` is returned. Raises: :class:`telegram.TelegramError` + .. _`guide to Webhooks`: https://core.telegram.org/bots/webhooks + """ url_ = '{0}/setWebhook'.format(self.base_url) @@ -2481,8 +2486,9 @@ class Bot(TelegramObject): start_parameter (:obj:`str`): Unique deep-linking parameter that can be used to generate this invoice when used as a start parameter. currency (:obj:`str`): Three-letter ISO 4217 currency code. - prices (List[:class:`telegram.LabeledPrice`)]: Price breakdown, a list of components - (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). + prices (List[:class:`telegram.LabeledPrice`)]: Price breakdown, a JSON-serialized list + of components (e.g. product price, tax, discount, delivery cost, delivery tax, + bonus, etc.). provider_data (:obj:`str` | :obj:`object`, optional): JSON-encoded data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider. When an object is diff --git a/telegram/ext/dispatcher.py b/telegram/ext/dispatcher.py index 1c64c4b5a..c8f2964b4 100644 --- a/telegram/ext/dispatcher.py +++ b/telegram/ext/dispatcher.py @@ -397,7 +397,8 @@ class Dispatcher(object): def add_handler(self, handler, group=DEFAULT_GROUP): """Register a handler. - TL;DR: Order and priority counts. 0 or 1 handlers per group will be used. + TL;DR: Order and priority counts. 0 or 1 handlers per group will be used. End handling of + update with :class:`telegram.ext.DispatcherHandlerStop`. A handler must be an instance of a subclass of :class:`telegram.ext.Handler`. All handlers are organized in groups with a numeric value. The default group is 0. All groups will be diff --git a/telegram/ext/jobqueue.py b/telegram/ext/jobqueue.py index 50c96014d..78e38d9d1 100644 --- a/telegram/ext/jobqueue.py +++ b/telegram/ext/jobqueue.py @@ -113,9 +113,12 @@ class JobQueue(object): Args: callback (:obj:`callable`): The callback function that should be executed by the new - job. It should take ``bot, job`` as parameters, where ``job`` is the - :class:`telegram.ext.Job` instance. It can be used to access its - ``job.context`` or change it to a repeating job. + job. Callback signature for context based API: + + ``def callback(CallbackContext)`` + + ``context.job`` is the :class:`telegram.ext.Job` instance. It can be used to access + its ``job.context`` or change it to a repeating job. when (:obj:`int` | :obj:`float` | :obj:`datetime.timedelta` | \ :obj:`datetime.datetime` | :obj:`datetime.time`): Time in or at which the job should run. This parameter will be interpreted @@ -150,9 +153,12 @@ class JobQueue(object): Args: callback (:obj:`callable`): The callback function that should be executed by the new - job. It should take ``bot, job`` as parameters, where ``job`` is the - :class:`telegram.ext.Job` instance. It can be used to access its - ``Job.context`` or change it to a repeating job. + job. Callback signature for context based API: + + ``def callback(CallbackContext)`` + + ``context.job`` is the :class:`telegram.ext.Job` instance. It can be used to access + its ``job.context`` or change it to a repeating job. interval (:obj:`int` | :obj:`float` | :obj:`datetime.timedelta`): The interval in which the job will run. If it is an :obj:`int` or a :obj:`float`, it will be interpreted as seconds. @@ -201,9 +207,12 @@ class JobQueue(object): Args: callback (:obj:`callable`): The callback function that should be executed by the new - job. It should take ``bot, job`` as parameters, where ``job`` is the - :class:`telegram.ext.Job` instance. It can be used to access its ``Job.context`` - or change it to a repeating job. + job. Callback signature for context based API: + + ``def callback(CallbackContext)`` + + ``context.job`` is the :class:`telegram.ext.Job` instance. It can be used to access + its ``job.context`` or change it to a repeating job. time (:obj:`datetime.time`): Time of day at which the job should run. If the timezone (``time.tzinfo``) is ``None``, UTC will be assumed. days (Tuple[:obj:`int`], optional): Defines on which days of the week the job should @@ -358,9 +367,12 @@ class Job(object): Args: callback (:obj:`callable`): The callback function that should be executed by the new job. - It should take ``bot, job`` as parameters, where ``job`` is the - :class:`telegram.ext.Job` instance. It can be used to access it's :attr:`context` - or change it to a repeating job. + Callback signature for context based API: + + ``def callback(CallbackContext)`` + + a ``context.job`` is the :class:`telegram.ext.Job` instance. It can be used to access + its ``job.context`` or change it to a repeating job. interval (:obj:`int` | :obj:`float` | :obj:`datetime.timedelta`, optional): The time interval between executions of the job. If it is an :obj:`int` or a :obj:`float`, it will be interpreted as seconds. If you don't set this value, you must set diff --git a/telegram/files/inputmedia.py b/telegram/files/inputmedia.py index e8187ba54..d63f1b902 100644 --- a/telegram/files/inputmedia.py +++ b/telegram/files/inputmedia.py @@ -44,7 +44,7 @@ class InputMediaAnimation(InputMedia): Lastly you can pass an existing :class:`telegram.Animation` object to send. thumb (`filelike object`): Optional. Thumbnail of the file sent. The thumbnail should be in JPEG format and less than 200 kB in size. - A thumbnail's width and height should not exceed 90. Ignored if the file is not + A thumbnail's width and height should not exceed 320. Ignored if the file is not is passed as a string or file_id. caption (:obj:`str`): Optional. Caption of the animation to be sent, 0-1024 characters. parse_mode (:obj:`str`): Optional. Send Markdown or HTML, if you want Telegram apps to show @@ -61,7 +61,7 @@ class InputMediaAnimation(InputMedia): Lastly you can pass an existing :class:`telegram.Animation` object to send. thumb (`filelike object`, optional): Thumbnail of the file sent. The thumbnail should be in JPEG format and less than 200 kB in size. - A thumbnail's width and height should not exceed 90. Ignored if the file is not + A thumbnail's width and height should not exceed 320. Ignored if the file is not is passed as a string or file_id. caption (:obj:`str`, optional): Caption of the animation to be sent, 0-1024 characters. parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to show @@ -170,7 +170,7 @@ class InputMediaVideo(InputMedia): for streaming. thumb (`filelike object`): Optional. Thumbnail of the file sent. The thumbnail should be in JPEG format and less than 200 kB in size. - A thumbnail's width and height should not exceed 90. Ignored if the file is not + A thumbnail's width and height should not exceed 320. Ignored if the file is not is passed as a string or file_id. Args: @@ -188,7 +188,7 @@ class InputMediaVideo(InputMedia): for streaming. thumb (`filelike object`, optional): Thumbnail of the file sent. The thumbnail should be in JPEG format and less than 200 kB in size. - A thumbnail's width and height should not exceed 90. Ignored if the file is not + A thumbnail's width and height should not exceed 320. Ignored if the file is not is passed as a string or file_id. Note: @@ -250,7 +250,7 @@ class InputMediaAudio(InputMedia): title (:obj:`str`): Optional. Title of the audio as defined by sender or by audio tags. thumb (`filelike object`): Optional. Thumbnail of the file sent. The thumbnail should be in JPEG format and less than 200 kB in size. - A thumbnail's width and height should not exceed 90. Ignored if the file is not + A thumbnail's width and height should not exceed 320. Ignored if the file is not is passed as a string or file_id. Args: @@ -267,7 +267,7 @@ class InputMediaAudio(InputMedia): title (:obj:`str`, optional): Title of the audio as defined by sender or by audio tags. thumb (`filelike object`, optional): Thumbnail of the file sent. The thumbnail should be in JPEG format and less than 200 kB in size. - A thumbnail's width and height should not exceed 90. Ignored if the file is not + A thumbnail's width and height should not exceed 320. Ignored if the file is not is passed as a string or file_id. Note: @@ -323,7 +323,7 @@ class InputMediaDocument(InputMedia): in :class:`telegram.ParseMode` for the available modes. thumb (`filelike object`): Optional. Thumbnail of the file sent. The thumbnail should be in JPEG format and less than 200 kB in size. - A thumbnail's width and height should not exceed 90. Ignored if the file is not + A thumbnail's width and height should not exceed 320. Ignored if the file is not is passed as a string or file_id. Args: @@ -336,7 +336,7 @@ class InputMediaDocument(InputMedia): in :class:`telegram.ParseMode` for the available modes. thumb (`filelike object`, optional): Thumbnail of the file sent. The thumbnail should be in JPEG format and less than 200 kB in size. - A thumbnail's width and height should not exceed 90. Ignored if the file is not + A thumbnail's width and height should not exceed 320. Ignored if the file is not is passed as a string or file_id. """ diff --git a/telegram/inline/inlinequery.py b/telegram/inline/inlinequery.py index 79b7e127b..892193e0f 100644 --- a/telegram/inline/inlinequery.py +++ b/telegram/inline/inlinequery.py @@ -35,7 +35,7 @@ class InlineQuery(TelegramObject): from_user (:class:`telegram.User`): Sender. location (:class:`telegram.Location`): Optional. Sender location, only for bots that request user location. - query (:obj:`str`): Text of the query (up to 512 characters). + query (:obj:`str`): Text of the query (up to 256 characters). offset (:obj:`str`): Offset of the results to be returned, can be controlled by the bot. Args: @@ -43,7 +43,7 @@ class InlineQuery(TelegramObject): from_user (:class:`telegram.User`): Sender. location (:class:`telegram.Location`, optional): Sender location, only for bots that request user location. - query (:obj:`str`): Text of the query (up to 512 characters). + query (:obj:`str`): Text of the query (up to 256 characters). offset (:obj:`str`): Offset of the results to be returned, can be controlled by the bot. bot (:class:`telegram.Bot`, optional): The Bot to use for instance methods. **kwargs (:obj:`dict`): Arbitrary keyword arguments. diff --git a/telegram/message.py b/telegram/message.py index 0879427d7..772ea7c34 100644 --- a/telegram/message.py +++ b/telegram/message.py @@ -580,7 +580,7 @@ class Message(TelegramObject): bot.send_audio(update.message.chat_id, *args, **kwargs) Keyword Args: - quote (:obj:`bool`, optional): If set to ``True``, the photo is sent as an actual reply + quote (:obj:`bool`, optional): If set to ``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: ``True`` in group chats and ``False`` in private chats. @@ -597,9 +597,10 @@ class Message(TelegramObject): bot.send_document(update.message.chat_id, *args, **kwargs) Keyword Args: - quote (:obj:`bool`, optional): If set to ``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: ``True`` in group chats and ``False`` in private chats. + quote (:obj:`bool`, optional): If set to ``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: ``True`` in group chats and ``False`` in + private chats. Returns: :class:`telegram.Message`: On success, instance representing the message posted. @@ -614,9 +615,10 @@ class Message(TelegramObject): bot.send_animation(update.message.chat_id, *args, **kwargs) Keyword Args: - quote (:obj:`bool`, optional): If set to ``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: ``True`` in group chats and ``False`` in private chats. + quote (:obj:`bool`, optional): If set to ``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: ``True`` in group chats and ``False`` in + private chats. Returns: :class:`telegram.Message`: On success, instance representing the message posted. @@ -631,9 +633,10 @@ class Message(TelegramObject): bot.send_sticker(update.message.chat_id, *args, **kwargs) Keyword Args: - quote (:obj:`bool`, optional): If set to ``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: ``True`` in group chats and ``False`` in private chats. + quote (:obj:`bool`, optional): If set to ``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: ``True`` in group chats and ``False`` in + private chats. Returns: :class:`telegram.Message`: On success, instance representing the message posted. @@ -648,9 +651,10 @@ class Message(TelegramObject): bot.send_video(update.message.chat_id, *args, **kwargs) Keyword Args: - quote (:obj:`bool`, optional): If set to ``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: ``True`` in group chats and ``False`` in private chats. + quote (:obj:`bool`, optional): If set to ``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: ``True`` in group chats and ``False`` in + private chats. Returns: :class:`telegram.Message`: On success, instance representing the message posted. @@ -665,9 +669,10 @@ class Message(TelegramObject): bot.send_video_note(update.message.chat_id, *args, **kwargs) Keyword Args: - quote (:obj:`bool`, optional): If set to ``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: ``True`` in group chats and ``False`` in private chats. + quote (:obj:`bool`, optional): If set to ``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: ``True`` in group chats and ``False`` in + private chats. Returns: :class:`telegram.Message`: On success, instance representing the message posted. @@ -682,9 +687,10 @@ class Message(TelegramObject): bot.send_voice(update.message.chat_id, *args, **kwargs) Keyword Args: - quote (:obj:`bool`, optional): If set to ``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: ``True`` in group chats and ``False`` in private chats. + quote (:obj:`bool`, optional): If set to ``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: ``True`` in group chats and ``False`` in + private chats. Returns: :class:`telegram.Message`: On success, instance representing the message posted. @@ -699,9 +705,10 @@ class Message(TelegramObject): bot.send_location(update.message.chat_id, *args, **kwargs) Keyword Args: - quote (:obj:`bool`, optional): If set to ``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: ``True`` in group chats and ``False`` in private chats. + quote (:obj:`bool`, optional): If set to ``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: ``True`` in group chats and ``False`` in + private chats. Returns: :class:`telegram.Message`: On success, instance representing the message posted. @@ -716,9 +723,10 @@ class Message(TelegramObject): bot.send_venue(update.message.chat_id, *args, **kwargs) Keyword Args: - quote (:obj:`bool`, optional): If set to ``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: ``True`` in group chats and ``False`` in private chats. + quote (:obj:`bool`, optional): If set to ``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: ``True`` in group chats and ``False`` in + private chats. Returns: :class:`telegram.Message`: On success, instance representing the message posted. @@ -733,9 +741,10 @@ class Message(TelegramObject): bot.send_contact(update.message.chat_id, *args, **kwargs) Keyword Args: - quote (:obj:`bool`, optional): If set to ``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: ``True`` in group chats and ``False`` in private chats. + quote (:obj:`bool`, optional): If set to ``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: ``True`` in group chats and ``False`` in + private chats. Returns: :class:`telegram.Message`: On success, instance representing the message posted. @@ -750,7 +759,7 @@ class Message(TelegramObject): bot.send_poll(update.message.chat_id, *args, **kwargs) Keyword Args: - quote (:obj:`bool`, optional): If set to ``True``, the photo is sent as an actual reply + quote (:obj:`bool`, optional): If set to ``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: ``True`` in group chats and ``False`` in private chats. diff --git a/telegram/utils/helpers.py b/telegram/utils/helpers.py index 5eacd10ba..e11bf42a1 100644 --- a/telegram/utils/helpers.py +++ b/telegram/utils/helpers.py @@ -100,7 +100,7 @@ def to_float_timestamp(t, reference_timestamp=None): Converts a given time object to a float POSIX timestamp. Used to convert different time specifications to a common format. The time object can be relative (i.e. indicate a time increment, or a time of day) or absolute. - Any objects from the :module:`datetime` module that are timezone-naive will be assumed + Any objects from the :class:`datetime` module that are timezone-naive will be assumed to be in UTC. ``None`` s are left alone (i.e. ``to_float_timestamp(None)`` is ``None``).