* 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
This commit is contained in:
Bibo-Joshi 2020-02-02 20:20:54 +01:00 committed by GitHub
parent 7cde6ca268
commit a397e6c3c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 150 additions and 115 deletions

View file

@ -0,0 +1,6 @@
telegram.ext.DispatcherHandlerStop
==================================
.. autoclass:: telegram.ext.DispatcherHandlerStop
:members:
:show-inheritance:

View file

@ -5,6 +5,7 @@ telegram.ext package
telegram.ext.updater telegram.ext.updater
telegram.ext.dispatcher telegram.ext.dispatcher
telegram.ext.dispatcherhandlerstop
telegram.ext.filters telegram.ext.filters
telegram.ext.job telegram.ext.job
telegram.ext.jobqueue telegram.ext.jobqueue

View file

@ -455,10 +455,10 @@ class Bot(TelegramObject):
reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options. A reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options. A
JSON-serialized object for an inline keyboard, custom reply keyboard, instructions JSON-serialized object for an inline keyboard, custom reply keyboard, instructions
to remove reply keyboard or to force a reply from the user. to remove reply keyboard or to force a reply from the user.
thumb (`filelike object`, optional): Thumbnail of the file sent. thumb (`filelike object`, optional): Thumbnail of the
The thumbnail should be in JPEG format and less than 200 kB in size. 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. A thumbnail's width and height should not exceed 320. Ignored if the file is not
Ignored if the file is passed as a string or file_id. is passed as a string or file_id.
timeout (:obj:`int` | :obj:`float`, optional): Send file timeout (default: 20 seconds). timeout (:obj:`int` | :obj:`float`, optional): Send file timeout (default: 20 seconds).
**kwargs (:obj:`dict`): Arbitrary keyword arguments. **kwargs (:obj:`dict`): Arbitrary keyword arguments.
@ -538,10 +538,10 @@ class Bot(TelegramObject):
reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options. A reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options. A
JSON-serialized object for an inline keyboard, custom reply keyboard, instructions JSON-serialized object for an inline keyboard, custom reply keyboard, instructions
to remove reply keyboard or to force a reply from the user. to remove reply keyboard or to force a reply from the user.
thumb (`filelike object`, optional): Thumbnail of the file sent. thumb (`filelike object`, optional): Thumbnail of the
The thumbnail should be in JPEG format and less than 200 kB in size. 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. A thumbnail's width and height should not exceed 320. Ignored if the file is not
Ignored if the file is passed as a string or file_id. is passed as a string or file_id.
timeout (:obj:`int` | :obj:`float`, optional): Send file timeout (default: 20 seconds). timeout (:obj:`int` | :obj:`float`, optional): Send file timeout (default: 20 seconds).
**kwargs (:obj:`dict`): Arbitrary keyword arguments. **kwargs (:obj:`dict`): Arbitrary keyword arguments.
@ -676,10 +676,10 @@ class Bot(TelegramObject):
reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options. A reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options. A
JSON-serialized object for an inline keyboard, custom reply keyboard, instructions JSON-serialized object for an inline keyboard, custom reply keyboard, instructions
to remove reply keyboard or to force a reply from the user. to remove reply keyboard or to force a reply from the user.
thumb (`filelike object`, optional): Thumbnail of the file sent. thumb (`filelike object`, optional): Thumbnail of the
The thumbnail should be in JPEG format and less than 200 kB in size. 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. A thumbnail's width and height should not exceed 320. Ignored if the file is not
Ignored if the file is passed as a string or file_id. is passed as a string or file_id.
timeout (:obj:`int` | :obj:`float`, optional): Send file timeout (default: 20 seconds). timeout (:obj:`int` | :obj:`float`, optional): Send file timeout (default: 20 seconds).
**kwargs (:obj:`dict`): Arbitrary keyword arguments. **kwargs (:obj:`dict`): Arbitrary keyword arguments.
@ -755,10 +755,10 @@ class Bot(TelegramObject):
reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options. A reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options. A
JSON-serialized object for an inline keyboard, custom reply keyboard, JSON-serialized object for an inline keyboard, custom reply keyboard,
instructions to remove reply keyboard or to force a reply from the user. instructions to remove reply keyboard or to force a reply from the user.
thumb (`filelike object`, optional): Thumbnail of the file sent. thumb (`filelike object`, optional): Thumbnail of the
The thumbnail should be in JPEG format and less than 200 kB in size. 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. A thumbnail's width and height should not exceed 320. Ignored if the file is not
Ignored if the file is passed as a string or file_id. is passed as a string or file_id.
timeout (:obj:`int` | :obj:`float`, optional): Send file timeout (default: 20 seconds). timeout (:obj:`int` | :obj:`float`, optional): Send file timeout (default: 20 seconds).
**kwargs (:obj:`dict`): Arbitrary keyword arguments. **kwargs (:obj:`dict`): Arbitrary keyword arguments.
@ -820,10 +820,10 @@ class Bot(TelegramObject):
duration (:obj:`int`, optional): Duration of sent animation in seconds. duration (:obj:`int`, optional): Duration of sent animation in seconds.
width (:obj:`int`, optional): Animation width. width (:obj:`int`, optional): Animation width.
height (:obj:`int`, optional): Animation height. height (:obj:`int`, optional): Animation height.
thumb (`filelike object`, optional): Thumbnail of the file sent. thumb (`filelike object`, optional): Thumbnail of the
The thumbnail should be in JPEG format and less than 200 kB in size. 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. A thumbnail's width and height should not exceed 320. Ignored if the file is not
Ignored if the file is passed as a string or file_id. is passed as a string or file_id.
caption (:obj:`str`, optional): Animation caption (may also be used when resending caption (:obj:`str`, optional): Animation caption (may also be used when resending
animations by file_id), 0-1024 characters. animations by file_id), 0-1024 characters.
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to 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`. You can either supply a :obj:`latitude` and :obj:`longitude` or a :obj:`location`.
Args: Args:
chat_id (:obj:`int` | :obj:`str`): Unique identifier for the target chat or username chat_id (:obj:`int` | :obj:`str`, optional): Required if inline_message_id is not
of the target channel (in the format @channelusername). 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. message_id (:obj:`int`, optional): Required if inline_message_id is not specified.
Identifier of the sent message. Identifier of the sent message.
inline_message_id (:obj:`str`, optional): Required if chat_id and message_id are not 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. latitude (:obj:`float`, optional): Latitude of location.
longitude (:obj:`float`, optional): Longitude of location. longitude (:obj:`float`, optional): Longitude of location.
location (:class:`telegram.Location`, optional): The location to send. location (:class:`telegram.Location`, optional): The location to send.
reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options. A reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): A JSON-serialized
JSON-serialized object for an inline keyboard, custom reply keyboard, instructions object for an inline keyboard.
to remove reply keyboard or to force a reply from the user.
timeout (:obj:`int` | :obj:`float`, optional): If this value is specified, use it as 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 read timeout from the server (instead of the one specified during creation of
the connection pool). the connection pool).
@ -1704,21 +1704,21 @@ class Bot(TelegramObject):
bots). bots).
Args: Args:
chat_id (:obj:`int` | :obj:`str`): Unique identifier for the target chat or username chat_id (:obj:`int` | :obj:`str`, optional): Required if inline_message_id is not
of the target channel (in the format @channelusername). 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. message_id (:obj:`int`, optional): Required if inline_message_id is not specified.
Identifier of the sent message. Identifier of the sent message.
inline_message_id (:obj:`str`, optional): Required if chat_id and message_id are not inline_message_id (:obj:`str`, optional): Required if chat_id and message_id are not
specified. Identifier of the inline message. specified. Identifier of the inline message.
text (:obj:`str`): New text of the 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, parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to
italic, fixed-width text or inline URLs in your bot's message. See the constants in show bold, italic, fixed-width text or inline URLs in your bot's message. See the
:class:`telegram.ParseMode` for the available modes. constants in :class:`telegram.ParseMode` for the available modes.
disable_web_page_preview (:obj:`bool`, optional): Disables link previews for links in disable_web_page_preview (:obj:`bool`, optional): Disables link previews for links in
this message. this message.
reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options. A reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): A JSON-serialized
JSON-serialized object for an inline keyboard, custom reply keyboard, instructions object for an inline keyboard.
to remove reply keyboard or to force a reply from the user.
timeout (:obj:`int` | :obj:`float`, optional): If this value is specified, use it as 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 read timeout from the server (instead of the one specified during creation of
the connection pool). the connection pool).
@ -1764,8 +1764,9 @@ class Bot(TelegramObject):
(for inline bots). (for inline bots).
Args: Args:
chat_id (:obj:`int` | :obj:`str`): Unique identifier for the target chat or username chat_id (:obj:`int` | :obj:`str`, optional): Required if inline_message_id is not
of the target channel (in the format @channelusername). 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. message_id (:obj:`int`, optional): Required if inline_message_id is not specified.
Identifier of the sent message. Identifier of the sent message.
inline_message_id (:obj:`str`, optional): Required if chat_id and message_id are not 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 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 show bold, italic, fixed-width text or inline URLs in the media caption. See the
constants in :class:`telegram.ParseMode` for the available modes. constants in :class:`telegram.ParseMode` for the available modes.
reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options. A reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): A JSON-serialized
JSON-serialized object for an inline keyboard, custom reply keyboard, instructions object for an inline keyboard.
to remove reply keyboard or to force a reply from the user.
timeout (:obj:`int` | :obj:`float`, optional): If this value is specified, use it as 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 read timeout from the server (instead of the one specified during creation of
the connection pool). the connection pool).
@ -1829,17 +1829,17 @@ class Bot(TelegramObject):
returned. returned.
Args: Args:
chat_id (:obj:`int` | :obj:`str`, optional): Unique identifier for the target chat or chat_id (:obj:`int` | :obj:`str`, optional): Required if inline_message_id is not
username of the target channel (in the format @channelusername). 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. message_id (:obj:`int`, optional): Required if inline_message_id is not specified.
Identifier of the sent message. Identifier of the sent message.
inline_message_id (:obj:`str`, optional): Required if chat_id and message_id are not inline_message_id (:obj:`str`, optional): Required if chat_id and message_id are not
specified. Identifier of the inline message. specified. Identifier of the inline message.
media (:class:`telegram.InputMedia`): An object for a new media content media (:class:`telegram.InputMedia`): An object for a new media content
of the message. of the message.
reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options. A reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): A JSON-serialized
JSON-serialized object for an inline keyboard, custom reply keyboard, instructions object for an inline keyboard.
to remove reply keyboard or to force a reply from the user.
timeout (:obj:`int` | :obj:`float`, optional): If this value is specified, use it as 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 read timeout from the server (instead of the one specified during creation of
the connection pool). the connection pool).
@ -1877,15 +1877,15 @@ class Bot(TelegramObject):
(for inline bots). (for inline bots).
Args: Args:
chat_id (:obj:`int` | :obj:`str`): Unique identifier for the target chat or username chat_id (:obj:`int` | :obj:`str`, optional): Required if inline_message_id is not
of the target channel (in the format @channelusername). 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. message_id (:obj:`int`, optional): Required if inline_message_id is not specified.
Identifier of the sent message. Identifier of the sent message.
inline_message_id (:obj:`str`, optional): Required if chat_id and message_id are not inline_message_id (:obj:`str`, optional): Required if chat_id and message_id are not
specified. Identifier of the inline message. specified. Identifier of the inline message.
reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options. A reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): A JSON-serialized
JSON-serialized object for an inline keyboard, custom reply keyboard, instructions object for an inline keyboard.
to remove reply keyboard or to force a reply from the user.
timeout (:obj:`int` | :obj:`float`, optional): If this value is specified, use it as 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 read timeout from the server (instead of the one specified during creation of
the connection pool). the connection pool).
@ -1940,10 +1940,10 @@ class Bot(TelegramObject):
timeout (:obj:`int`, optional): Timeout in seconds for long polling. Defaults to 0, 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 i.e. usual short polling. Should be positive, short polling should be used for
testing purposes only. testing purposes only.
allowed_updates (List[:obj:`str`]), optional): List the types of updates you want your allowed_updates (List[:obj:`str`]), optional): A JSON-serialized list the types of
bot to receive. For example, specify ["message", "edited_channel_post", updates you want your bot to receive. For example, specify ["message",
"callback_query"] to only receive updates of these types. See "edited_channel_post", "callback_query"] to only receive updates of these types.
:class:`telegram.Update` for a complete list of available update 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 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 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 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 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 values to limit the load on your bot's server, and higher values to increase your
bot's throughput. bot's throughput.
allowed_updates (List[:obj:`str`], optional): List the types of updates you want your allowed_updates (List[:obj:`str`], optional): A JSON-serialized list the types of
bot to receive. For example, specify ["message", "edited_channel_post", updates you want your bot to receive. For example, specify ["message",
"callback_query"] to only receive updates of these types. See "edited_channel_post", "callback_query"] to only receive updates of these types.
:class:`telegram.Update` for a complete list of available update types. Specify an See :class:`telegram.Update` for a complete list of available update types.
empty list to receive all updates regardless of type (default). If not specified, Specify an empty list to receive all updates regardless of type (default). If not
the previous setting will be used. Please note that this parameter doesn't affect specified, the previous setting will be used. Please note that this parameter
updates created before the call to the set_webhook, so unwanted updates may be doesn't affect updates created before the call to the set_webhook, so unwanted
received for a short period of time. updates may be received for a short period of time.
timeout (:obj:`int` | :obj:`float`, optional): If this value is specified, use it as 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 read timeout from the server (instead of the one specified during creation of
the connection pool). the connection pool).
@ -2041,12 +2041,17 @@ class Bot(TelegramObject):
work. work.
3. Ports currently supported for Webhooks: 443, 80, 88, 8443. 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: Returns:
:obj:`bool` On success, ``True`` is returned. :obj:`bool` On success, ``True`` is returned.
Raises: Raises:
:class:`telegram.TelegramError` :class:`telegram.TelegramError`
.. _`guide to Webhooks`: https://core.telegram.org/bots/webhooks
""" """
url_ = '{0}/setWebhook'.format(self.base_url) 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 start_parameter (:obj:`str`): Unique deep-linking parameter that can be used to
generate this invoice when used as a start parameter. generate this invoice when used as a start parameter.
currency (:obj:`str`): Three-letter ISO 4217 currency code. currency (:obj:`str`): Three-letter ISO 4217 currency code.
prices (List[:class:`telegram.LabeledPrice`)]: Price breakdown, a list of components prices (List[:class:`telegram.LabeledPrice`)]: Price breakdown, a JSON-serialized list
(e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). 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 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 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 required fields should be provided by the payment provider. When an object is

View file

@ -397,7 +397,8 @@ class Dispatcher(object):
def add_handler(self, handler, group=DEFAULT_GROUP): def add_handler(self, handler, group=DEFAULT_GROUP):
"""Register a handler. """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 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 are organized in groups with a numeric value. The default group is 0. All groups will be

View file

@ -113,9 +113,12 @@ class JobQueue(object):
Args: Args:
callback (:obj:`callable`): The callback function that should be executed by the new 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 job. Callback signature for context based API:
:class:`telegram.ext.Job` instance. It can be used to access its
``job.context`` or change it to a repeating job. ``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` | \ when (:obj:`int` | :obj:`float` | :obj:`datetime.timedelta` | \
:obj:`datetime.datetime` | :obj:`datetime.time`): :obj:`datetime.datetime` | :obj:`datetime.time`):
Time in or at which the job should run. This parameter will be interpreted Time in or at which the job should run. This parameter will be interpreted
@ -150,9 +153,12 @@ class JobQueue(object):
Args: Args:
callback (:obj:`callable`): The callback function that should be executed by the new 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 job. Callback signature for context based API:
:class:`telegram.ext.Job` instance. It can be used to access its
``Job.context`` or change it to a repeating job. ``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 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 the job will run. If it is an :obj:`int` or a :obj:`float`, it will be interpreted
as seconds. as seconds.
@ -201,9 +207,12 @@ class JobQueue(object):
Args: Args:
callback (:obj:`callable`): The callback function that should be executed by the new 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 job. Callback signature for context based API:
:class:`telegram.ext.Job` instance. It can be used to access its ``Job.context``
or change it to a repeating job. ``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 (:obj:`datetime.time`): Time of day at which the job should run. If the timezone
(``time.tzinfo``) is ``None``, UTC will be assumed. (``time.tzinfo``) is ``None``, UTC will be assumed.
days (Tuple[:obj:`int`], optional): Defines on which days of the week the job should days (Tuple[:obj:`int`], optional): Defines on which days of the week the job should
@ -358,9 +367,12 @@ class Job(object):
Args: Args:
callback (:obj:`callable`): The callback function that should be executed by the new job. 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 Callback signature for context based API:
:class:`telegram.ext.Job` instance. It can be used to access it's :attr:`context`
or change it to a repeating job. ``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 (: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`, 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 it will be interpreted as seconds. If you don't set this value, you must set

View file

@ -44,7 +44,7 @@ class InputMediaAnimation(InputMedia):
Lastly you can pass an existing :class:`telegram.Animation` object to send. Lastly you can pass an existing :class:`telegram.Animation` object to send.
thumb (`filelike object`): Optional. Thumbnail of the thumb (`filelike object`): Optional. Thumbnail of the
file sent. The thumbnail should be in JPEG format and less than 200 kB in size. 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. is passed as a string or file_id.
caption (:obj:`str`): Optional. Caption of the animation to be sent, 0-1024 characters. 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 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. Lastly you can pass an existing :class:`telegram.Animation` object to send.
thumb (`filelike object`, optional): Thumbnail of the thumb (`filelike object`, optional): Thumbnail of the
file sent. The thumbnail should be in JPEG format and less than 200 kB in size. 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. is passed as a string or file_id.
caption (:obj:`str`, optional): Caption of the animation to be sent, 0-1024 characters. 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 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. for streaming.
thumb (`filelike object`): Optional. Thumbnail of the thumb (`filelike object`): Optional. Thumbnail of the
file sent. The thumbnail should be in JPEG format and less than 200 kB in size. 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. is passed as a string or file_id.
Args: Args:
@ -188,7 +188,7 @@ class InputMediaVideo(InputMedia):
for streaming. for streaming.
thumb (`filelike object`, optional): Thumbnail of the thumb (`filelike object`, optional): Thumbnail of the
file sent. The thumbnail should be in JPEG format and less than 200 kB in size. 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. is passed as a string or file_id.
Note: Note:
@ -250,7 +250,7 @@ class InputMediaAudio(InputMedia):
title (:obj:`str`): Optional. Title of the audio as defined by sender or by audio tags. title (:obj:`str`): Optional. Title of the audio as defined by sender or by audio tags.
thumb (`filelike object`): Optional. Thumbnail of the thumb (`filelike object`): Optional. Thumbnail of the
file sent. The thumbnail should be in JPEG format and less than 200 kB in size. 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. is passed as a string or file_id.
Args: Args:
@ -267,7 +267,7 @@ class InputMediaAudio(InputMedia):
title (:obj:`str`, optional): Title of the audio as defined by sender or by audio tags. title (:obj:`str`, optional): Title of the audio as defined by sender or by audio tags.
thumb (`filelike object`, optional): Thumbnail of the thumb (`filelike object`, optional): Thumbnail of the
file sent. The thumbnail should be in JPEG format and less than 200 kB in size. 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. is passed as a string or file_id.
Note: Note:
@ -323,7 +323,7 @@ class InputMediaDocument(InputMedia):
in :class:`telegram.ParseMode` for the available modes. in :class:`telegram.ParseMode` for the available modes.
thumb (`filelike object`): Optional. Thumbnail of the thumb (`filelike object`): Optional. Thumbnail of the
file sent. The thumbnail should be in JPEG format and less than 200 kB in size. 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. is passed as a string or file_id.
Args: Args:
@ -336,7 +336,7 @@ class InputMediaDocument(InputMedia):
in :class:`telegram.ParseMode` for the available modes. in :class:`telegram.ParseMode` for the available modes.
thumb (`filelike object`, optional): Thumbnail of the thumb (`filelike object`, optional): Thumbnail of the
file sent. The thumbnail should be in JPEG format and less than 200 kB in size. 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. is passed as a string or file_id.
""" """

View file

@ -35,7 +35,7 @@ class InlineQuery(TelegramObject):
from_user (:class:`telegram.User`): Sender. from_user (:class:`telegram.User`): Sender.
location (:class:`telegram.Location`): Optional. Sender location, only for bots that location (:class:`telegram.Location`): Optional. Sender location, only for bots that
request user location. 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. offset (:obj:`str`): Offset of the results to be returned, can be controlled by the bot.
Args: Args:
@ -43,7 +43,7 @@ class InlineQuery(TelegramObject):
from_user (:class:`telegram.User`): Sender. from_user (:class:`telegram.User`): Sender.
location (:class:`telegram.Location`, optional): Sender location, only for bots that location (:class:`telegram.Location`, optional): Sender location, only for bots that
request user location. 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. 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. bot (:class:`telegram.Bot`, optional): The Bot to use for instance methods.
**kwargs (:obj:`dict`): Arbitrary keyword arguments. **kwargs (:obj:`dict`): Arbitrary keyword arguments.

View file

@ -580,7 +580,7 @@ class Message(TelegramObject):
bot.send_audio(update.message.chat_id, *args, **kwargs) bot.send_audio(update.message.chat_id, *args, **kwargs)
Keyword Args: 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 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. 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) bot.send_document(update.message.chat_id, *args, **kwargs)
Keyword Args: 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 document is sent as an actual
to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this parameter reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this
will be ignored. Default: ``True`` in group chats and ``False`` in private chats. parameter will be ignored. Default: ``True`` in group chats and ``False`` in
private chats.
Returns: Returns:
:class:`telegram.Message`: On success, instance representing the message posted. :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) bot.send_animation(update.message.chat_id, *args, **kwargs)
Keyword Args: 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 animation is sent as an actual
to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this parameter reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this
will be ignored. Default: ``True`` in group chats and ``False`` in private chats. parameter will be ignored. Default: ``True`` in group chats and ``False`` in
private chats.
Returns: Returns:
:class:`telegram.Message`: On success, instance representing the message posted. :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) bot.send_sticker(update.message.chat_id, *args, **kwargs)
Keyword Args: 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 sticker is sent as an actual
to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this parameter reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this
will be ignored. Default: ``True`` in group chats and ``False`` in private chats. parameter will be ignored. Default: ``True`` in group chats and ``False`` in
private chats.
Returns: Returns:
:class:`telegram.Message`: On success, instance representing the message posted. :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) bot.send_video(update.message.chat_id, *args, **kwargs)
Keyword Args: 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 video is sent as an actual
to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this parameter reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this
will be ignored. Default: ``True`` in group chats and ``False`` in private chats. parameter will be ignored. Default: ``True`` in group chats and ``False`` in
private chats.
Returns: Returns:
:class:`telegram.Message`: On success, instance representing the message posted. :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) bot.send_video_note(update.message.chat_id, *args, **kwargs)
Keyword Args: 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 video note is sent as an actual
to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this parameter reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this
will be ignored. Default: ``True`` in group chats and ``False`` in private chats. parameter will be ignored. Default: ``True`` in group chats and ``False`` in
private chats.
Returns: Returns:
:class:`telegram.Message`: On success, instance representing the message posted. :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) bot.send_voice(update.message.chat_id, *args, **kwargs)
Keyword Args: 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 voice note is sent as an actual
to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this parameter reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this
will be ignored. Default: ``True`` in group chats and ``False`` in private chats. parameter will be ignored. Default: ``True`` in group chats and ``False`` in
private chats.
Returns: Returns:
:class:`telegram.Message`: On success, instance representing the message posted. :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) bot.send_location(update.message.chat_id, *args, **kwargs)
Keyword Args: 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 location is sent as an actual
to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this parameter reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this
will be ignored. Default: ``True`` in group chats and ``False`` in private chats. parameter will be ignored. Default: ``True`` in group chats and ``False`` in
private chats.
Returns: Returns:
:class:`telegram.Message`: On success, instance representing the message posted. :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) bot.send_venue(update.message.chat_id, *args, **kwargs)
Keyword Args: 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 venue is sent as an actual
to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this parameter reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this
will be ignored. Default: ``True`` in group chats and ``False`` in private chats. parameter will be ignored. Default: ``True`` in group chats and ``False`` in
private chats.
Returns: Returns:
:class:`telegram.Message`: On success, instance representing the message posted. :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) bot.send_contact(update.message.chat_id, *args, **kwargs)
Keyword Args: 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 contact is sent as an actual
to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this parameter reply to this message. If ``reply_to_message_id`` is passed in ``kwargs``, this
will be ignored. Default: ``True`` in group chats and ``False`` in private chats. parameter will be ignored. Default: ``True`` in group chats and ``False`` in
private chats.
Returns: Returns:
:class:`telegram.Message`: On success, instance representing the message posted. :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) bot.send_poll(update.message.chat_id, *args, **kwargs)
Keyword Args: 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 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. will be ignored. Default: ``True`` in group chats and ``False`` in private chats.

View file

@ -100,7 +100,7 @@ def to_float_timestamp(t, reference_timestamp=None):
Converts a given time object to a float POSIX timestamp. Converts a given time object to a float POSIX timestamp.
Used to convert different time specifications to a common format. The time object 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. 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. to be in UTC.
``None`` s are left alone (i.e. ``to_float_timestamp(None)`` is ``None``). ``None`` s are left alone (i.e. ``to_float_timestamp(None)`` is ``None``).