Documentation Improvements (#3428, #3423, #3429, #3441, #3404, #3443)

Co-authored-by: Dmitry Kolomatskiy <58207913+lemontree210@users.noreply.github.com>
Co-authored-by: Viicos <65306057+Viicos@users.noreply.github.com>
Co-authored-by: Harshil <37377066+harshil21@users.noreply.github.com>
Co-authored-by: Eisberge <22561095+Eisberge@users.noreply.github.com>
Co-authored-by: Joshua Tang <joshuaystang@gmail.com>
This commit is contained in:
Bibo-Joshi
2023-01-01 16:24:00 +01:00
committed by GitHub
parent 3e7ab7e7af
commit f408b1a2dd
106 changed files with 688 additions and 408 deletions
+1
View File
@@ -74,6 +74,7 @@ The following wonderful people contributed directly or indirectly to this projec
- `LRezende <https://github.com/lrezende>`_
- `macrojames <https://github.com/macrojames>`_
- `Matheus Lemos <https://github.com/mlemosf>`_
- `Michael Dix <https://github.com/Eisberge>`_
- `Michael Elovskikh <https://github.com/wronglink>`_
- `miles <https://github.com/miles170>`_
- `Mischa Krüger <https://github.com/Makman2>`_
+2 -1
View File
@@ -1,6 +1,7 @@
=========
Changelog
=========
Version 20.0b0
==============
*Released 2022-12-15*
@@ -10,7 +11,7 @@ This is the technical changelog for version 20.0b0. More elaborate release notes
Major Changes
-------------
- Make `TelegramObject` Immutable (`#3249`_)
- Make ``TelegramObject`` Immutable (`#3249`_)
Minor Changes, Documentation Improvements and CI
------------------------------------------------
+3 -3
View File
@@ -148,9 +148,9 @@ Optional Dependencies
PTB can be installed with optional dependencies:
* ``pip install python-telegram-bot[passport]`` installs the `cryptography>=3.0 <https://cryptography.io/en/stable>`_ library. Use this, if you want to use Telegram Passport related functionality.
* ``pip install python-telegram-bot[socks]`` installs ``httpx[socks]``. Use this, if you want to work behind a Socks5 server.
* ``pip install python-telegram-bot[rate-limiter]`` installs ``aiolimiter~=1.0.0``. Use this, if you want to use ``telegram.ext.AIORateLimiter``.
* ``pip install python-telegram-bot[webhooks]`` installs the `tornado~=6.2 <https://www.tornadoweb.org/en/stable/>`_ library. Use this, if you want to use ``telegram.ext.Updater.start_webhook``/``telegram.ext.Application.start_webhook``.
* ``pip install python-telegram-bot[socks]`` installs `httpx[socks] <https://www.python-httpx.org/#dependencies>`_. Use this, if you want to work behind a Socks5 server.
* ``pip install python-telegram-bot[rate-limiter]`` installs `aiolimiter~=1.0.0 <https://aiolimiter.readthedocs.io/en/stable/>`_. Use this, if you want to use ``telegram.ext.AIORateLimiter``.
* ``pip install python-telegram-bot[webhooks]`` installs the `tornado~=6.2 <https://www.tornadoweb.org/en/stable/>`_ library. Use this, if you want to use ``telegram.ext.Updater.start_webhook``/``telegram.ext.Application.run_webhook``.
* ``pip install python-telegram-bot[callback-data]`` installs the `cachetools~=5.2.0 <https://cachetools.readthedocs.io/en/latest/>`_ library. Use this, if you want to use `arbitrary callback_data <https://github.com/python-telegram-bot/python-telegram-bot/wiki/Arbitrary-callback_data>`_.
* ``pip install python-telegram-bot[job-queue]`` installs the `APScheduler~=3.9.1 <https://apscheduler.readthedocs.io/en/3.x/>`_ library and enforces `pytz>=2018.6 <https://pypi.org/project/pytz/>`_, where ``pytz`` is a dependency of ``APScheduler``. Use this, if you want to use the ``telegram.ext.JobQueue``.
+2 -2
View File
@@ -34,7 +34,7 @@
:target: https://github.com/python-telegram-bot/python-telegram-bot/
:alt: Github Actions workflow
.. image:: https://app.codecov.io/gh/python-telegram-bot/python-telegram-bot
.. image:: https://codecov.io/gh/python-telegram-bot/python-telegram-bot/branch/master/graph/badge.svg
:target: https://app.codecov.io/gh/python-telegram-bot/python-telegram-bot
:alt: Code coverage
@@ -149,7 +149,7 @@ Optional Dependencies
PTB can be installed with optional dependencies:
* ``pip install python-telegram-bot-raw[passport]`` installs the `cryptography>=3.0 <https://cryptography.io/en/stable>`_ library. Use this, if you want to use Telegram Passport related functionality.
* ``pip install python-telegram-bot-raw[socks]`` installs ``httpx[socks]``. Use this, if you want to work behind a Socks5 server.
* ``pip install python-telegram-bot-raw[socks]`` installs `httpx[socks] <https://www.python-httpx.org/#dependencies>`_. Use this, if you want to work behind a Socks5 server.
To install multiple optional dependencies, separate them by commas, e.g. ``pip install python-telegram-bot-raw[passport,socks]``.
+4
View File
@@ -44,11 +44,15 @@ extensions = [
"sphinx.ext.napoleon",
"sphinx.ext.intersphinx",
"sphinx.ext.linkcode",
"sphinx.ext.extlinks",
"sphinx_paramlinks",
"sphinxcontrib.mermaid",
"sphinx_search.extension",
]
# For shorter links to Wiki in docstrings
extlinks = {"wiki": ("https://github.com/python-telegram-bot/python-telegram-bot/wiki/%s", "%s")}
# Use intersphinx to reference the python builtin library docs
intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
+36 -20
View File
@@ -150,10 +150,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager):
.. seealso:: :attr:`telegram.ext.Application.bot`,
:attr:`telegram.ext.CallbackContext.bot`,
:attr:`telegram.ext.Updater.bot`,
`Your First Bot <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Extensions--Your-first-Bot>`_,
`Builder Pattern <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Builder-Pattern>`_
:wiki:`Your First Bot <Extensions--Your-first-Bot>`,
:wiki:`Builder Pattern <Builder-Pattern>`
.. versionadded:: 13.2
Objects of this class are comparable in terms of equality. Two objects of this class are
@@ -932,7 +930,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager):
"""Use this method to send photos.
.. seealso:: :meth:`telegram.Message.reply_photo`, :meth:`telegram.Chat.send_photo`,
:meth:`telegram.User.send_photo`
:meth:`telegram.User.send_photo`,
:wiki:`Working with Files and Media <Working-with-Files-and-Media>`
Args:
chat_id (:obj:`int` | :obj:`str`): |chat_id_channel|
@@ -941,6 +940,11 @@ class Bot(TelegramObject, AbstractAsyncContextManager):
|fileinput|
Lastly you can pass an existing :class:`telegram.PhotoSize` object to send.
Caution:
* The photo must be at most 10MB in size.
* The photo's width and height must not exceed 10000 in total.
* Width and height ratio must be at most 20.
.. versionchanged:: 13.2
Accept :obj:`bytes` as input.
@@ -1045,7 +1049,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager):
For sending voice messages, use the :meth:`send_voice` method instead.
.. seealso:: :meth:`telegram.Message.reply_audio`, :meth:`telegram.Chat.send_audio`,
:meth:`telegram.User.send_audio`
:meth:`telegram.User.send_audio`,
:wiki:`Working with Files and Media <Working-with-Files-and-Media>`
Args:
chat_id (:obj:`int` | :obj:`str`): |chat_id_channel|
@@ -1170,7 +1175,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager):
changed in the future.
.. seealso:: :meth:`telegram.Message.reply_document`, :meth:`telegram.Chat.send_document`,
:meth:`telegram.User.send_document`
:meth:`telegram.User.send_document`,
:wiki:`Working with Files and Media <Working-with-Files-and-Media>`
Args:
chat_id (:obj:`int` | :obj:`str`): |chat_id_channel|
@@ -1283,7 +1289,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager):
Use this method to send static ``.WEBP``, animated ``.TGS``, or video ``.WEBM`` stickers.
.. seealso:: :meth:`telegram.Message.reply_sticker`, :meth:`telegram.Chat.send_sticker`,
:meth:`telegram.User.send_sticker`
:meth:`telegram.User.send_sticker`,
:wiki:`Working with Files and Media <Working-with-Files-and-Media>`
Args:
chat_id (:obj:`int` | :obj:`str`): |chat_id_channel|
@@ -1378,7 +1385,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager):
changed by Telegram.
.. seealso:: :meth:`telegram.Message.reply_video`, :meth:`telegram.Chat.send_video`,
:meth:`telegram.User.send_video`
:meth:`telegram.User.send_video`,
:wiki:`Working with Files and Media <Working-with-Files-and-Media>`
Args:
chat_id (:obj:`int` | :obj:`str`): |chat_id_channel|
@@ -1507,7 +1515,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager):
.. seealso:: :meth:`telegram.Message.reply_video_note`,
:meth:`telegram.Chat.send_video_note`,
:meth:`telegram.User.send_video_note`
:meth:`telegram.User.send_video_note`,
:wiki:`Working with Files and Media <Working-with-Files-and-Media>`
Args:
chat_id (:obj:`int` | :obj:`str`): |chat_id_channel|
@@ -1629,7 +1638,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager):
.. seealso:: :meth:`telegram.Message.reply_animation`,
:meth:`telegram.Chat.send_animation`,
:meth:`telegram.User.send_animation`
:meth:`telegram.User.send_animation`,
:wiki:`Working with Files and Media <Working-with-Files-and-Media>`
Args:
chat_id (:obj:`int` | :obj:`str`): |chat_id_channel|
@@ -1758,7 +1768,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager):
sent as files.
.. seealso:: :meth:`telegram.Message.reply_voice`, :meth:`telegram.Chat.send_voice`,
:meth:`telegram.User.send_voice`
:meth:`telegram.User.send_voice`,
:wiki:`Working with Files and Media <Working-with-Files-and-Media>`
Args:
chat_id (:obj:`int` | :obj:`str`): |chat_id_channel|
@@ -1859,7 +1870,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager):
parse_mode: ODVInput[str] = DEFAULT_NONE,
caption_entities: Sequence["MessageEntity"] = None,
) -> Tuple[Message, ...]:
"""Use this method to send a group of photos or videos as an album.
"""Use this method to send a group of photos, videos, documents or audios as an album.
Documents and audio files can be only grouped in an album with messages of the same type.
.. versionchanged:: 20.0
Returns a tuple instead of a list.
@@ -1871,7 +1883,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager):
.. seealso:: :meth:`telegram.Message.reply_media_group`,
:meth:`telegram.Chat.send_media_group`,
:meth:`telegram.User.send_media_group`
:meth:`telegram.User.send_media_group`,
:wiki:`Working with Files and Media <Working-with-Files-and-Media>`
Args:
chat_id (:obj:`int` | :obj:`str`): |chat_id_channel|
@@ -2717,7 +2730,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager):
:paramref:`telegram.InlineQuery.answer.auto_pagination` set to :obj:`True`, which will
take care of passing the correct value.
.. seealso:: :meth:`telegram.InlineQuery.answer`
.. seealso:: :meth:`telegram.InlineQuery.answer`,
:wiki:`Working with Files and Media <Working-with-Files-and-Media>`
Args:
inline_query_id (:obj:`str`): Unique identifier for the answered query.
@@ -2865,7 +2879,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager):
:meth:`telegram.Document.get_file`, :meth:`telegram.PassportFile.get_file`,
:meth:`telegram.PhotoSize.get_file`, :meth:`telegram.Sticker.get_file`,
:meth:`telegram.Video.get_file`, :meth:`telegram.VideoNote.get_file`,
:meth:`telegram.Voice.get_file`
:meth:`telegram.Voice.get_file`,
:wiki:`Working with Files and Media <Working-with-Files-and-Media>`
Args:
file_id (:obj:`str` | :class:`telegram.Animation` | :class:`telegram.Audio` | \
@@ -3364,7 +3379,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager):
|editreplymarkup|
.. seealso:: :meth:`telegram.Message.edit_media`,
:meth:`telegram.CallbackQuery.edit_message_media`
:meth:`telegram.CallbackQuery.edit_message_media`,
:wiki:`Working with Files and Media <Working-with-Files-and-Media>`
Args:
media (:class:`telegram.InputMedia`): An object for a new media content
@@ -3619,9 +3635,9 @@ class Bot(TelegramObject, AbstractAsyncContextManager):
integration.
certificate (:term:`file object` | :obj:`bytes` | :class:`pathlib.Path` | :obj:`str`):
Upload your public key certificate so that the root
certificate in use can be checked. See our `self-signed guide <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Webhooks#creating-a-self-signed-\
certificate-using-openssl>`_ for details. |uploadinputnopath|
certificate in use can be checked. See our :wiki:`self-signed guide\
<Webhooks#creating-a-self-signed-certificate-using-openssl>` for details.
|uploadinputnopath|
ip_address (:obj:`str`, optional): The fixed IP address which will be used to send
webhook requests instead of the IP address resolved through DNS.
max_connections (:obj:`int`, optional): Maximum allowed number of simultaneous HTTPS
+6 -2
View File
@@ -41,8 +41,12 @@ class BotCommand(TelegramObject):
:tg-const:`telegram.BotCommand.MAX_DESCRIPTION` characters.
Attributes:
command (:obj:`str`): Text of the command.
description (:obj:`str`): Description of the command.
command (:obj:`str`): Text of the command; :tg-const:`telegram.BotCommand.MIN_COMMAND`-
:tg-const:`telegram.BotCommand.MAX_COMMAND` characters. Can contain only lowercase
English letters, digits and underscores.
description (:obj:`str`): Description of the command;
:tg-const:`telegram.BotCommand.MIN_DESCRIPTION`-
:tg-const:`telegram.BotCommand.MAX_DESCRIPTION` characters.
"""
+9 -5
View File
@@ -78,23 +78,27 @@ class CallbackQuery(TelegramObject):
inline_message_id (:obj:`str`, optional): Identifier of the message sent via the bot in
inline mode, that originated the query.
game_short_name (:obj:`str`, optional): Short name of a Game to be returned, serves as
the unique identifier for the game
the unique identifier for the game.
Attributes:
id (:obj:`str`): Unique identifier for this query.
from_user (:class:`telegram.User`): Sender.
chat_instance (:obj:`str`): Global identifier, uniquely corresponding to the chat to which
the message with the callback button was sent.
the message with the callback button was sent. Useful for high scores in games.
message (:class:`telegram.Message`): Optional. Message with the callback button that
originated the query.
originated the query. Note that message content and message date will not be available
if the message is too old.
data (:obj:`str` | :obj:`object`): Optional. Data associated with the callback button.
Be aware that the message, which originated the query, can contain no callback buttons
with this data.
Tip:
The value here is the same as the value passed in
:paramref:`telegram.InlineKeyboardButton.callback_data`.
inline_message_id (:obj:`str`): Optional. Identifier of the message sent via the bot in
inline mode, that originated the query.
game_short_name (:obj:`str`): Optional. Short name of a Game to be returned.
inline mode, that originated the query.
game_short_name (:obj:`str`): Optional. Short name of a Game to be returned, serves as
the unique identifier for the game.
"""
+1
View File
@@ -83,6 +83,7 @@ class ChatInviteLink(TelegramObject):
:tg-const:`telegram.constants.ChatInviteLinkLimit.MIN_MEMBER_LIMIT`-
:tg-const:`telegram.constants.ChatInviteLinkLimit.MAX_MEMBER_LIMIT`.
name (:obj:`str`): Optional. Invite link name.
0-:tg-const:`telegram.constants.ChatInviteLinkLimit.NAME_LENGTH` characters.
.. versionadded:: 13.8
pending_join_request_count (:obj:`int`): Optional. Number of pending join requests
+5 -2
View File
@@ -40,10 +40,13 @@ class ChatLocation(TelegramObject):
Can't be a live location.
address (:obj:`str`): Location address;
:tg-const:`telegram.ChatLocation.MIN_ADDRESS`-
:tg-const:`telegram.ChatLocation.MAX_ADDRESS` characters, as defined by the chat owner
:tg-const:`telegram.ChatLocation.MAX_ADDRESS` characters, as defined by the chat owner.
Attributes:
location (:class:`telegram.Location`): The location to which the supergroup is connected.
address (:obj:`str`): Location address, as defined by the chat owner
Can't be a live location.
address (:obj:`str`): Location address;
:tg-const:`telegram.ChatLocation.MIN_ADDRESS`-
:tg-const:`telegram.ChatLocation.MAX_ADDRESS` characters, as defined by the chat owner.
"""
+5 -2
View File
@@ -45,7 +45,7 @@ class ChatMember(TelegramObject):
considered equal, if their :attr:`user` and :attr:`status` are equal.
Examples:
:any:`Chat Member Bot <examples.chatmemberbot>`
:any:`Chat Member Bot <examples.chatmemberbot>`
.. versionchanged:: 20.0
@@ -65,7 +65,10 @@ class ChatMember(TelegramObject):
Attributes:
user (:class:`telegram.User`): Information about the user.
status (:obj:`str`): The member's status in the chat.
status (:obj:`str`): The member's status in the chat. Can be
:attr:`~telegram.ChatMember.ADMINISTRATOR`, :attr:`~telegram.ChatMember.OWNER`,
:attr:`~telegram.ChatMember.BANNED`, :attr:`~telegram.ChatMember.LEFT`,
:attr:`~telegram.ChatMember.MEMBER` or :attr:`~telegram.ChatMember.RESTRICTED`.
"""
+1 -1
View File
@@ -65,7 +65,7 @@ class ChatMemberUpdated(TelegramObject):
old_chat_member (:class:`telegram.ChatMember`): Previous information about the chat member.
new_chat_member (:class:`telegram.ChatMember`): New information about the chat member.
invite_link (:class:`telegram.ChatInviteLink`): Optional. Chat invite link, which was used
by the user to join the chat.
by the user to join the chat. For joining by invite link events only.
"""
+5 -2
View File
@@ -56,8 +56,11 @@ class ChosenInlineResult(TelegramObject):
Attributes:
result_id (:obj:`str`): The unique identifier for the result that was chosen.
from_user (:class:`telegram.User`): The user that chose the result.
location (:class:`telegram.Location`): Optional. Sender location.
inline_message_id (:obj:`str`): Optional. Identifier of the sent inline message.
location (:class:`telegram.Location`): Optional. Sender location, only for bots that
require user location.
inline_message_id (:obj:`str`): Optional. Identifier of the sent inline message. Available
only if there is an inline keyboard attached to the message. Will be also received in
callback queries and can be used to edit the message.
query (:obj:`str`): The query that was used to obtain the result.
"""
+10 -2
View File
@@ -52,8 +52,8 @@ class Dice(TelegramObject):
If :attr:`emoji` is :tg-const:`telegram.Dice.SLOT_MACHINE`, each value
corresponds to a unique combination of symbols, which
can be found at our `wiki <https://github.com/python-telegram-bot/python-telegram-bot/wiki\
/Code-snippets#map-a-slot-machine-dice-value-to-the-corresponding-symbols>`_.
can be found in our
:wiki:`wiki <Code-snippets#map-a-slot-machine-dice-value-to-the-corresponding-symbols>`.
However, this behaviour is undocumented and might be changed by Telegram.
..
@@ -75,6 +75,14 @@ class Dice(TelegramObject):
Attributes:
value (:obj:`int`): Value of the dice.
:tg-const:`telegram.Dice.MIN_VALUE`-:tg-const:`telegram.Dice.MAX_VALUE_BOWLING`
for :tg-const:`telegram.Dice.DICE`, :tg-const:`telegram.Dice.DARTS` and
:tg-const:`telegram.Dice.BOWLING` base emoji,
:tg-const:`telegram.Dice.MIN_VALUE`-:tg-const:`telegram.Dice.MAX_VALUE_BASKETBALL`
for :tg-const:`telegram.Dice.BASKETBALL` and :tg-const:`telegram.Dice.FOOTBALL`
base emoji,
:tg-const:`telegram.Dice.MIN_VALUE`-:tg-const:`telegram.Dice.MAX_VALUE_SLOT_MACHINE`
for :tg-const:`telegram.Dice.SLOT_MACHINE` base emoji.
emoji (:obj:`str`): Emoji on which the dice throw animation is based.
"""
+2 -1
View File
@@ -44,7 +44,8 @@ class Animation(_BaseThumbedMedium):
file_size (:obj:`int`, optional): File size in bytes.
Attributes:
file_id (:obj:`str`): File identifier.
file_id (:obj:`str`): Identifier for this file, which can be used to download
or reuse the file.
file_unique_id (:obj:`str`): Unique identifier for this file, which
is supposed to be the same over time and for different bots.
Can't be used to download or reuse the file.
+5 -5
View File
@@ -46,11 +46,11 @@ class Audio(_BaseThumbedMedium):
which the music file belongs.
Attributes:
file_id (:obj:`str`): Identifier for this file.
file_unique_id (:obj:`str`): Unique identifier for this file, which
is supposed to be the same over time and for different bots.
Can't be used to download or reuse the file.
duration (:obj:`int`): Duration of the audio in seconds.
file_id (:obj:`str`): Identifier for this file, which can be used to download
or reuse the file.
file_unique_id (:obj:`str`): Unique identifier for this file, which is supposed to be
the same over time and for different bots. Can't be used to download or reuse the file.
duration (:obj:`int`): Duration of the audio in seconds as defined by sender.
performer (:obj:`str`): Optional. Performer 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.
+2 -2
View File
@@ -36,7 +36,7 @@ class ChatPhoto(TelegramObject):
equal.
Args:
small_file_id (:obj:`str`): Unique file identifier of small
small_file_id (:obj:`str`): File identifier of small
(:tg-const:`telegram.ChatPhoto.SIZE_SMALL` x :tg-const:`telegram.ChatPhoto.SIZE_SMALL`)
chat photo. This file_id can be used only for photo download and only for as long
as the photo is not changed.
@@ -44,7 +44,7 @@ class ChatPhoto(TelegramObject):
(:tg-const:`telegram.ChatPhoto.SIZE_SMALL` x :tg-const:`telegram.ChatPhoto.SIZE_SMALL`)
chat photo, which is supposed to be the same over time and for different bots.
Can't be used to download or reuse the file.
big_file_id (:obj:`str`): Unique file identifier of big
big_file_id (:obj:`str`): File identifier of big
(:tg-const:`telegram.ChatPhoto.SIZE_BIG` x :tg-const:`telegram.ChatPhoto.SIZE_BIG`)
chat photo. This file_id can be used only for photo download and only for as long as
the photo is not changed.
+7 -8
View File
@@ -41,16 +41,15 @@ class Document(_BaseThumbedMedium):
file_size (:obj:`int`, optional): File size in bytes.
Attributes:
file_id (:obj:`str`): File identifier.
file_unique_id (:obj:`str`): Unique identifier for this file, which
is supposed to be the same over time and for different bots.
Can't be used to download or reuse the file.
thumb (:class:`telegram.PhotoSize`): Optional. Document thumbnail.
file_name (:obj:`str`): Original filename.
mime_type (:obj:`str`): Optional. MIME type of the file.
file_id (:obj:`str`): Identifier for this file, which can be used to download
or reuse the file.
file_unique_id (:obj:`str`): Unique identifier for this file, which is supposed to be
the same over time and for different bots. Can't be used to download or reuse the file.
thumb (:class:`telegram.PhotoSize`): Optional. Document thumbnail as defined by sender.
file_name (:obj:`str`): Optional. Original filename as defined by sender.
mime_type (:obj:`str`): Optional. MIME type of the file as defined by sender.
file_size (:obj:`int`): Optional. File size in bytes.
"""
__slots__ = ("file_name", "mime_type")
+11 -6
View File
@@ -42,7 +42,7 @@ class File(TelegramObject):
Objects of this class are comparable in terms of equality. Two objects of this class are
considered equal, if their :attr:`file_unique_id` is equal.
.. versionchanged:: 20.0:
.. versionchanged:: 20.0
``download`` was split into :meth:`download_to_drive` and :meth:`download_to_memory`.
Note:
@@ -58,18 +58,19 @@ class File(TelegramObject):
file_unique_id (:obj:`str`): Unique identifier for this file, which
is supposed to be the same over time and for different bots.
Can't be used to download or reuse the file.
file_size (:obj:`int`, optional): Optional. File size in bytes, if known.
file_size (:obj:`int`, optional): File size in bytes, if known.
file_path (:obj:`str`, optional): File path. Use e.g. :meth:`download_to_drive` to get the
file.
Attributes:
file_id (:obj:`str`): Identifier for this file.
file_id (:obj:`str`): Identifier for this file, which can be used to download
or reuse the file.
file_unique_id (:obj:`str`): Unique identifier for this file, which
is supposed to be the same over time and for different bots.
Can't be used to download or reuse the file.
file_size (:obj:`str`): Optional. File size in bytes.
file_path (:obj:`str`): Optional. File path. Use e.g. :meth:`download_to_drive` to get
the file.
file_size (:obj:`int`): Optional. File size in bytes, if known.
file_path (:obj:`str`): Optional. File path. Use e.g. :meth:`download_to_drive` to get the
file.
"""
__slots__ = (
@@ -141,6 +142,8 @@ class File(TelegramObject):
original file in order to decrypt the file without changing the existing one
in-place.
.. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`
.. versionchanged:: 20.0
* :paramref:`custom_path` parameter now also accepts :class:`pathlib.Path` as argument.
@@ -224,6 +227,8 @@ class File(TelegramObject):
:obj:`io.BufferedIOBase`, the file contents will be saved to that object using the
:obj:`out.write<io.BufferedIOBase.write>` method.
.. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`
.. versionadded:: 20.0
Args:
+45 -22
View File
@@ -40,10 +40,12 @@ class InputMedia(TelegramObject):
"""
Base class for Telegram InputMedia Objects.
.. versionchanged:: 20.0:
.. versionchanged:: 20.0
Added arguments and attributes :attr:`type`, :attr:`media`, :attr:`caption`,
:attr:`caption_entities`, :paramref:`parse_mode`.
.. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`
Args:
media_type (:obj:`str`): Type of media that the instance represents.
media (:obj:`str` | :term:`file object` | :obj:`bytes` | :class:`pathlib.Path` | \
@@ -66,8 +68,10 @@ class InputMedia(TelegramObject):
Attributes:
type (:obj:`str`): Type of the input media.
media (:obj:`str` | :class:`telegram.InputFile`): Media to send.
caption (:obj:`str`): Optional. Caption of the media to be sent.
parse_mode (:obj:`str`): Optional. The parse mode to use for text formatting.
caption (:obj:`str`): Optional. Caption of the media to be sent,
0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters after entities
parsing.
parse_mode (:obj:`str`): Optional. |parse_mode|
caption_entities (Tuple[:class:`telegram.MessageEntity`]): Optional. |captionentitiesattr|
.. versionchanged:: 20.0
@@ -115,6 +119,8 @@ class InputMediaAnimation(InputMedia):
width, height and duration from that video, unless otherwise specified with the optional
arguments.
.. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`
Args:
media (:obj:`str` | :term:`file object` | :obj:`bytes` | :class:`pathlib.Path` | \
:class:`telegram.Animation`): File to send. |fileinputnopath|
@@ -148,7 +154,10 @@ class InputMediaAnimation(InputMedia):
Attributes:
type (:obj:`str`): :tg-const:`telegram.constants.InputMediaType.ANIMATION`.
media (:obj:`str` | :class:`telegram.InputFile`): Animation to send.
caption (:obj:`str`): Optional. Caption of the document to be sent.
thumb (:class:`telegram.InputFile`): Optional. |thumbdocstringbase|
caption (:obj:`str`): Optional. Caption of the animation to be sent,
0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters
after entities parsing.
parse_mode (:obj:`str`): Optional. The parse mode to use for text formatting.
caption_entities (Tuple[:class:`telegram.MessageEntity`]): Optional. |captionentitiesattr|
@@ -156,8 +165,6 @@ class InputMediaAnimation(InputMedia):
* |tupleclassattrs|
* |alwaystuple|
thumb (:class:`telegram.InputFile`): Optional. Thumbnail of the file to send.
width (:obj:`int`): Optional. Animation width.
height (:obj:`int`): Optional. Animation height.
duration (:obj:`int`): Optional. Animation duration in seconds.
@@ -208,6 +215,8 @@ class InputMediaAnimation(InputMedia):
class InputMediaPhoto(InputMedia):
"""Represents a photo to be sent.
.. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`
Args:
media (:obj:`str` | :term:`file object` | :obj:`bytes` | :class:`pathlib.Path` | \
:class:`telegram.PhotoSize`): File to send. |fileinputnopath|
@@ -232,8 +241,10 @@ class InputMediaPhoto(InputMedia):
Attributes:
type (:obj:`str`): :tg-const:`telegram.constants.InputMediaType.PHOTO`.
media (:obj:`str` | :class:`telegram.InputFile`): Photo to send.
caption (:obj:`str`): Optional. Caption of the document to be sent.
parse_mode (:obj:`str`): Optional. The parse mode to use for text formatting.
caption (:obj:`str`): Optional. Caption of the photo to be sent,
0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters
after entities parsing.
parse_mode (:obj:`str`): Optional. |parse_mode|
caption_entities (Tuple[:class:`telegram.MessageEntity`]): Optional. |captionentitiesattr|
.. versionchanged:: 20.0
@@ -273,6 +284,8 @@ class InputMediaPhoto(InputMedia):
class InputMediaVideo(InputMedia):
"""Represents a video to be sent.
.. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`
Note:
* When using a :class:`telegram.Video` for the :attr:`media` attribute, it will take the
width, height and duration from that video, unless otherwise specified with the optional
@@ -316,8 +329,10 @@ class InputMediaVideo(InputMedia):
Attributes:
type (:obj:`str`): :tg-const:`telegram.constants.InputMediaType.VIDEO`.
media (:obj:`str` | :class:`telegram.InputFile`): Video file to send.
caption (:obj:`str`): Optional. Caption of the document to be sent.
parse_mode (:obj:`str`): Optional. The parse mode to use for text formatting.
caption (:obj:`str`): Optional. Caption of the video to be sent,
0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters
after entities parsing.
parse_mode (:obj:`str`): Optional. |parse_mode|
caption_entities (Tuple[:class:`telegram.MessageEntity`]): Optional. |captionentitiesattr|
.. versionchanged:: 20.0
@@ -327,9 +342,9 @@ class InputMediaVideo(InputMedia):
width (:obj:`int`): Optional. Video width.
height (:obj:`int`): Optional. Video height.
duration (:obj:`int`): Optional. Video duration in seconds.
supports_streaming (:obj:`bool`): Optional. Pass :obj:`True`, if the uploaded video is
supports_streaming (:obj:`bool`): Optional. :obj:`True`, if the uploaded video is
suitable for streaming.
thumb (:class:`telegram.InputFile`): Optional. Thumbnail of the file to send.
thumb (:class:`telegram.InputFile`): Optional. |thumbdocstringbase|
"""
@@ -380,6 +395,8 @@ class InputMediaVideo(InputMedia):
class InputMediaAudio(InputMedia):
"""Represents an audio file to be treated as music to be sent.
.. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`
Note:
When using a :class:`telegram.Audio` for the :attr:`media` attribute, it will take the
duration, performer and title from that video, unless otherwise specified with the
@@ -406,7 +423,7 @@ class InputMediaAudio(InputMedia):
.. versionchanged:: 20.0
|sequenceclassargs|
duration (:obj:`int`): Duration of the audio in seconds as defined by sender.
duration (:obj:`int`, optional): Duration of the audio in seconds as defined by sender.
performer (:obj:`str`, optional): Performer 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.
@@ -419,19 +436,21 @@ class InputMediaAudio(InputMedia):
Attributes:
type (:obj:`str`): :tg-const:`telegram.constants.InputMediaType.AUDIO`.
media (:obj:`str` | :class:`telegram.InputFile`): Audio file to send.
caption (:obj:`str`): Optional. Caption of the document to be sent.
parse_mode (:obj:`str`): Optional. The parse mode to use for text formatting.
caption (:obj:`str`): Optional. Caption of the audio to be sent,
0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters
after entities parsing.
parse_mode (:obj:`str`): Optional. |parse_mode|
caption_entities (Tuple[:class:`telegram.MessageEntity`]): Optional. |captionentitiesattr|
.. versionchanged:: 20.0
* |tupleclassattrs|
* |alwaystuple|
duration (:obj:`int`): Duration of the audio in seconds.
duration (:obj:`int`): Optional. Duration of the audio in seconds.
performer (:obj:`str`): Optional. Performer 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 (:class:`telegram.InputFile`): Optional. Thumbnail of the file to send.
thumb (:class:`telegram.InputFile`): Optional. |thumbdocstringbase|
"""
@@ -479,6 +498,8 @@ class InputMediaAudio(InputMedia):
class InputMediaDocument(InputMedia):
"""Represents a general file to be sent.
.. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`
Args:
media (:obj:`str` | :term:`file object` | :obj:`bytes` | :class:`pathlib.Path` | \
:class:`telegram.Document`): File to send. |fileinputnopath|
@@ -512,18 +533,20 @@ class InputMediaDocument(InputMedia):
Attributes:
type (:obj:`str`): :tg-const:`telegram.constants.InputMediaType.DOCUMENT`.
media (:obj:`str` | :class:`telegram.InputFile`): File to send.
caption (:obj:`str`): Optional. Caption of the document to be sent.
parse_mode (:obj:`str`): Optional. The parse mode to use for text formatting.
caption (:obj:`str`): Optional. Caption of the document to be sent,
0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters
after entities parsing.
parse_mode (:obj:`str`): Optional. |parse_mode|
caption_entities (Tuple[:class:`telegram.MessageEntity`]): Optional. |captionentitiesattr|
.. versionchanged:: 20.0
* |tupleclassattrs|
* |alwaystuple|
thumb (:class:`telegram.InputFile`): Optional. Thumbnail of the file to send.
thumb (:class:`telegram.InputFile`): Optional. |thumbdocstringbase|
disable_content_type_detection (:obj:`bool`): Optional. Disables automatic server-side
content type detection for files uploaded using multipart/form-data. Always true, if
the document is sent as part of an album.
content type detection for files uploaded using multipart/form-data. Always
:obj:`True`, if the document is sent as part of an album.
"""
+3 -2
View File
@@ -48,10 +48,11 @@ class Location(TelegramObject):
longitude (:obj:`float`): Longitude as defined by sender.
latitude (:obj:`float`): Latitude as defined by sender.
horizontal_accuracy (:obj:`float`): Optional. The radius of uncertainty for the location,
measured in meters.
measured in meters; 0-:tg-const:`telegram.Location.HORIZONTAL_ACCURACY`.
live_period (:obj:`int`): Optional. Time relative to the message sending date, during which
the location can be updated, in seconds. For active live locations only.
heading (:obj:`int`): Optional. The direction in which user is moving, in degrees.
heading (:obj:`int`): Optional. The direction in which user is moving, in degrees;
:tg-const:`telegram.Location.MIN_HEADING`-:tg-const:`telegram.Location.MAX_HEADING`.
For active live locations only.
proximity_alert_radius (:obj:`int`): Optional. Maximum distance for proximity alerts about
approaching another chat member, in meters. For sent live locations only.
+2 -1
View File
@@ -39,7 +39,8 @@ class PhotoSize(_BaseMedium):
file_size (:obj:`int`, optional): File size in bytes.
Attributes:
file_id (:obj:`str`): Identifier for this file.
file_id (:obj:`str`): Identifier for this file, which can be used to download
or reuse the file.
file_unique_id (:obj:`str`): Unique identifier for this file, which
is supposed to be the same over time and for different bots.
Can't be used to download or reuse the file.
+14 -10
View File
@@ -62,10 +62,9 @@ class Sticker(_BaseThumbedMedium):
thumb (:class:`telegram.PhotoSize`, optional): Sticker thumbnail in the ``.WEBP`` or
``.JPG`` format.
emoji (:obj:`str`, optional): Emoji associated with the sticker
set_name (:obj:`str`, optional): Name of the sticker set to which the sticker
belongs.
mask_position (:class:`telegram.MaskPosition`, optional): For mask stickers, the
position where the mask should be placed.
set_name (:obj:`str`, optional): Name of the sticker set to which the sticker belongs.
mask_position (:class:`telegram.MaskPosition`, optional): For mask stickers, the position
where the mask should be placed.
file_size (:obj:`int`, optional): File size in bytes.
premium_animation (:class:`telegram.File`, optional): For premium regular stickers,
@@ -78,7 +77,8 @@ class Sticker(_BaseThumbedMedium):
.. versionadded:: 20.0
Attributes:
file_id (:obj:`str`): Identifier for this file.
file_id (:obj:`str`): Identifier for this file, which can be used to download
or reuse the file.
file_unique_id (:obj:`str`): Unique identifier for this file, which
is supposed to be the same over time and for different bots.
Can't be used to download or reuse the file.
@@ -197,7 +197,7 @@ class StickerSet(TelegramObject):
arguments had to be changed. Use keyword arguments to make sure that the arguments are
passed correctly.
.. versionchanged:: 20.0:
.. versionchanged:: 20.0
The parameter ``contains_masks`` has been removed. Use :paramref:`sticker_type` instead.
Args:
@@ -232,11 +232,13 @@ class StickerSet(TelegramObject):
.. versionchanged:: 20.0
|tupleclassattrs|
sticker_type (:obj:`str`): Type of stickers in the set.
sticker_type (:obj:`str`): Type of stickers in the set, currently one of
:attr:`telegram.Sticker.REGULAR`, :attr:`telegram.Sticker.MASK`,
:attr:`telegram.Sticker.CUSTOM_EMOJI`.
.. versionadded:: 20.0
thumb (:class:`telegram.PhotoSize`): Optional. Sticker set thumbnail in the ``.WEBP``,
``.TGS`` or ``.WEBM`` format.
``.TGS``, or ``.WEBM`` format.
"""
@@ -316,9 +318,11 @@ class MaskPosition(TelegramObject):
point (:obj:`str`): The part of the face relative to which the mask should be placed.
One of :attr:`FOREHEAD`, :attr:`EYES`, :attr:`MOUTH`, or :attr:`CHIN`.
x_shift (:obj:`float`): Shift by X-axis measured in widths of the mask scaled to the face
size, from left to right.
size, from left to right. For example, choosing ``-1.0`` will place mask just to the
left of the default mask position.
y_shift (:obj:`float`): Shift by Y-axis measured in heights of the mask scaled to the face
size, from top to bottom.
size, from top to bottom. For example, ``1.0`` will place the mask just below the
default mask position.
scale (:obj:`float`): Mask scaling coefficient. For example, ``2.0`` means double size.
"""
+5 -2
View File
@@ -55,9 +55,12 @@ class Venue(TelegramObject):
title (:obj:`str`): Name of the venue.
address (:obj:`str`): Address of the venue.
foursquare_id (:obj:`str`): Optional. Foursquare identifier of the venue.
foursquare_type (:obj:`str`): Optional. Foursquare type of the venue.
foursquare_type (:obj:`str`): Optional. Foursquare type of the venue. (For example,
"arts_entertainment/default", "arts_entertainment/aquarium" or "food/icecream".)
google_place_id (:obj:`str`): Optional. Google Places identifier of the venue.
google_place_type (:obj:`str`): Optional. Google Places type of the venue.
google_place_type (:obj:`str`): Optional. Google Places type of the venue. (See
`supported types <https://developers.google.com/maps/documentation/places/web-service\
/supported_types>`_.)
"""
+2 -2
View File
@@ -44,7 +44,8 @@ class Video(_BaseThumbedMedium):
file_size (:obj:`int`, optional): File size in bytes.
Attributes:
file_id (:obj:`str`): Identifier for this file.
file_id (:obj:`str`): Identifier for this file, which can be used to download
or reuse the file.
file_unique_id (:obj:`str`): Unique identifier for this file, which
is supposed to be the same over time and for different bots.
Can't be used to download or reuse the file.
@@ -56,7 +57,6 @@ class Video(_BaseThumbedMedium):
mime_type (:obj:`str`): Optional. MIME type of a file as defined by sender.
file_size (:obj:`int`): Optional. File size in bytes.
"""
__slots__ = ("duration", "file_name", "height", "mime_type", "width")
+4 -2
View File
@@ -42,11 +42,13 @@ class VideoNote(_BaseThumbedMedium):
file_size (:obj:`int`, optional): File size in bytes.
Attributes:
file_id (:obj:`str`): Identifier for this file.
file_id (:obj:`str`): Identifier for this file, which can be used to download
or reuse the file.
file_unique_id (:obj:`str`): Unique identifier for this file, which
is supposed to be the same over time and for different bots.
Can't be used to download or reuse the file.
length (:obj:`int`): Video width and height as defined by sender.
length (:obj:`int`): Video width and height (diameter of the video message) as defined
by sender.
duration (:obj:`int`): Duration of the video in seconds as defined by sender.
thumb (:class:`telegram.PhotoSize`): Optional. Video thumbnail.
file_size (:obj:`int`): Optional. File size in bytes.
+3 -2
View File
@@ -34,12 +34,13 @@ class Voice(_BaseMedium):
file_unique_id (:obj:`str`): Unique identifier for this file, which
is supposed to be the same over time and for different bots.
Can't be used to download or reuse the file.
duration (:obj:`int`, optional): Duration of the audio in seconds as defined by sender.
duration (:obj:`int`): Duration of the audio in seconds as defined by sender.
mime_type (:obj:`str`, optional): MIME type of the file as defined by sender.
file_size (:obj:`int`, optional): File size in bytes.
Attributes:
file_id (:obj:`str`): Identifier for this file.
file_id (:obj:`str`): Identifier for this file, which can be used to download
or reuse the file.
file_unique_id (:obj:`str`): Unique identifier for this file, which
is supposed to be the same over time and for different bots.
Can't be used to download or reuse the file.
+11 -3
View File
@@ -59,9 +59,17 @@ class ForceReply(TelegramObject):
Attributes:
force_reply (:obj:`True`): Shows reply interface to the user, as if they manually selected
the bots message and tapped 'Reply'.
selective (:obj:`bool`): Optional. Force reply from specific users only.
input_field_placeholder (:obj:`str`): Optional. The placeholder shown in the input
field when the reply is active.
selective (:obj:`bool`): Optional. Force reply from specific users only. Targets:
1) Users that are @mentioned in the :attr:`~telegram.Message.text` of the
:class:`telegram.Message` object.
2) If the bot's message is a reply (has ``reply_to_message_id``), sender of the
original message.
input_field_placeholder (:obj:`str`): Optional. The placeholder to be shown in the input
field when the reply is active;
:tg-const:`telegram.ForceReply.MIN_INPUT_FIELD_PLACEHOLDER`-
:tg-const:`telegram.ForceReply.MAX_INPUT_FIELD_PLACEHOLDER`
characters.
.. versionadded:: 13.7
+1
View File
@@ -75,6 +75,7 @@ class Game(TelegramObject):
game message. Can be automatically edited to include current high scores for the game
when the bot calls :meth:`telegram.Bot.set_game_score`, or manually edited
using :meth:`telegram.Bot.edit_message_text`.
0-:tg-const:`telegram.constants.MessageLimit.MAX_TEXT_LENGTH` characters.
text_entities (Tuple[:class:`telegram.MessageEntity`]): Optional. Special entities that
appear in text, such as usernames, URLs, bot commands, etc.
This tuple is empty if the message does not contain text entities.
+23 -15
View File
@@ -95,8 +95,7 @@ class InlineKeyboardButton(TelegramObject):
Tip:
The value entered here will be available in :attr:`telegram.CallbackQuery.data`.
.. seealso:: `Arbitrary callback_data <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Arbitrary-callback_data>`_
.. seealso:: :wiki:`Arbitrary callback_data <Arbitrary-callback_data>`
web_app (:obj:`telegram.WebAppInfo`, optional): Description of the `Web App
<https://core.telegram.org/bots/webapps>`_ that will be launched when the user presses
@@ -110,7 +109,7 @@ class InlineKeyboardButton(TelegramObject):
specified inline query in the input field. Can be empty, in which case just the bot's
username will be inserted. This offers an easy way for users to start using your bot
in inline mode when they are currently in a private chat with it. Especially useful
when combined with switch_pm* actions - in this case the user will be automatically
when combined with ``switch_pm*`` actions - in this case the user will be automatically
returned to the chat they switched from, skipping the chat selection screen.
switch_inline_query_current_chat (:obj:`str`, optional): If set, pressing the button will
insert the bot's username and the specified inline query in the current chat's input
@@ -118,11 +117,11 @@ class InlineKeyboardButton(TelegramObject):
offers a quick way for the user to open your bot in inline mode in the same chat - good
for selecting something from multiple options.
callback_game (:class:`telegram.CallbackGame`, optional): Description of the game that will
be launched when the user presses the button. This type of button must always be
the ``first`` button in the first row.
be launched when the user presses the button. This type of button **must** always be
the **first** button in the first row.
pay (:obj:`bool`, optional): Specify :obj:`True`, to send a Pay button. This type of button
must always be the `first` button in the first row and can only be used in invoice
messages.
**must** always be the **first** button in the first row and can only be used in
invoice messages.
Attributes:
text (:obj:`str`): Label text on the button.
@@ -148,15 +147,24 @@ class InlineKeyboardButton(TelegramObject):
private chats between a user and the bot.
.. versionadded:: 20.0
switch_inline_query (:obj:`str`): Optional. Will prompt the user to select one of their
chats, open that chat and insert the bot's username and the specified inline query in
the input field. Can be empty, in which case just the bot's username will be inserted.
switch_inline_query_current_chat (:obj:`str`): Optional. Will insert the bot's username and
the specified inline query in the current chat's input field. Can be empty, in which
case just the bot's username will be inserted.
switch_inline_query (:obj:`str`): Optional. If set, pressing the button will prompt the
user to select one of their chats, open that chat and insert the bot's username and the
specified inline query in the input field. Can be empty, in which case just the bot's
username will be inserted. This offers an easy way for users to start using your bot
in inline mode when they are currently in a private chat with it. Especially useful
when combined with ``switch_pm*`` actions - in this case the user will be automatically
returned to the chat they switched from, skipping the chat selection screen.
switch_inline_query_current_chat (:obj:`str`): Optional. If set, pressing the button will
insert the bot's username and the specified inline query in the current chat's input
field. Can be empty, in which case only the bot's username will be inserted. This
offers a quick way for the user to open your bot in inline mode in the same chat - good
for selecting something from multiple options.
callback_game (:class:`telegram.CallbackGame`): Optional. Description of the game that will
be launched when the user presses the button.
pay (:obj:`bool`): Optional. Specify :obj:`True`, to send a Pay button.
be launched when the user presses the button. This type of button **must** always be
the **first** button in the first row.
pay (:obj:`bool`): Optional. Specify :obj:`True`, to send a Pay button. This type of button
**must** always be the **first** button in the first row and can only be used in
invoice messages.
"""
+7 -2
View File
@@ -72,11 +72,16 @@ class InlineQuery(TelegramObject):
query (:obj:`str`): Text of the query (up to
:tg-const:`telegram.InlineQuery.MAX_QUERY_LENGTH` characters).
offset (:obj:`str`): Offset of the results to be returned, can be controlled by the bot.
location (:class:`telegram.Location`): Optional. Sender location, only for bots that
request user location.
chat_type (:obj:`str`): Optional. Type of the chat, from which the inline query was sent.
Can be either :tg-const:`telegram.Chat.SENDER` for a private chat with the inline query
sender, :tg-const:`telegram.Chat.PRIVATE`, :tg-const:`telegram.Chat.GROUP`,
:tg-const:`telegram.Chat.SUPERGROUP` or :tg-const:`telegram.Chat.CHANNEL`. The chat
type should be always known for requests sent from official clients and most
third-party clients, unless the request was sent from a secret chat.
.. versionadded:: 13.5
location (:class:`telegram.Location`): Optional. Sender location, only for bots that
request user location.
"""
@@ -37,6 +37,8 @@ class InlineQueryResultAudio(InlineQueryResult):
Alternatively, you can use :attr:`input_message_content` to send a message with the specified
content instead of the audio.
.. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`
Args:
id (:obj:`str`): Unique identifier for this result,
:tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`-
@@ -37,6 +37,8 @@ class InlineQueryResultCachedAudio(InlineQueryResult):
file will be sent by the user. Alternatively, you can use :attr:`input_message_content` to
send a message with the specified content instead of the audio.
.. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`
Args:
id (:obj:`str`): Unique identifier for this result,
:tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`-
@@ -37,6 +37,8 @@ class InlineQueryResultCachedDocument(InlineQueryResult):
by the user with an optional caption. Alternatively, you can use :attr:`input_message_content`
to send a message with the specified content instead of the file.
.. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`
Args:
id (:obj:`str`): Unique identifier for this result,
:tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`-
@@ -38,12 +38,14 @@ class InlineQueryResultCachedGif(InlineQueryResult):
use :attr:`input_message_content` to send a message with specified content instead of
the animation.
.. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`
Args:
id (:obj:`str`): Unique identifier for this result,
:tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`-
:tg-const:`telegram.InlineQueryResult.MAX_ID_LENGTH` Bytes.
gif_file_id (:obj:`str`): A valid file identifier for the GIF file.
title (:obj:`str`, optional): Title for the result.caption (:obj:`str`, optional):
title (:obj:`str`, optional): Title for the result.
caption (:obj:`str`, optional): Caption of the GIF file to be sent,
0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters
after entities parsing.
@@ -38,6 +38,8 @@ class InlineQueryResultCachedMpeg4Gif(InlineQueryResult):
optional caption. Alternatively, you can use :attr:`input_message_content` to send a message
with the specified content instead of the animation.
.. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`
Args:
id (:obj:`str`): Unique identifier for this result,
:tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`-
@@ -38,6 +38,8 @@ class InlineQueryResultCachedPhoto(InlineQueryResult):
:attr:`input_message_content` to send a message with the specified content instead
of the photo.
.. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`
Args:
id (:obj:`str`): Unique identifier for this result,
:tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`-
@@ -35,6 +35,8 @@ class InlineQueryResultCachedSticker(InlineQueryResult):
be sent by the user. Alternatively, you can use :attr:`input_message_content` to send a
message with the specified content instead of the sticker.
.. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`
Args:
id (:obj:`str`): Unique identifier for this result,
:tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`-
@@ -38,6 +38,8 @@ class InlineQueryResultCachedVideo(InlineQueryResult):
:attr:`input_message_content` to send a message with the specified content instead
of the video.
.. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`
Args:
id (:obj:`str`): Unique identifier for this result,
:tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`-
@@ -37,6 +37,8 @@ class InlineQueryResultCachedVoice(InlineQueryResult):
message will be sent by the user. Alternatively, you can use :attr:`input_message_content` to
send a message with the specified content instead of the voice message.
.. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`
Args:
id (:obj:`str`): Unique identifier for this result,
:tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`-
@@ -38,6 +38,8 @@ class InlineQueryResultDocument(InlineQueryResult):
specified content instead of the file. Currently, only .PDF and .ZIP files can be sent
using this method.
.. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`
Args:
id (:obj:`str`): Unique identifier for this result,
:tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`-
+4 -1
View File
@@ -37,6 +37,8 @@ class InlineQueryResultGif(InlineQueryResult):
the user with optional caption. Alternatively, you can use :attr:`input_message_content` to
send a message with the specified content instead of the animation.
.. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`
Args:
id (:obj:`str`): Unique identifier for this result,
:tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`-
@@ -75,7 +77,8 @@ class InlineQueryResultGif(InlineQueryResult):
gif_duration (:obj:`int`): Optional. Duration of the GIF in seconds.
thumb_url (:obj:`str`): URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for
the result.
thumb_mime_type (:obj:`str`): Optional. MIME type of the thumbnail.
thumb_mime_type (:obj:`str`): Optional. MIME type of the thumbnail, must be one of
``'image/jpeg'``, ``'image/gif'``, or ``'video/mp4'``. Defaults to ``'image/jpeg'``.
title (:obj:`str`): Optional. Title for the result.
caption (:obj:`str`): Optional. Caption of the GIF file to be sent,
0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters
+14 -6
View File
@@ -75,13 +75,21 @@ class InlineQueryResultLocation(InlineQueryResult):
longitude (:obj:`float`): Location longitude in degrees.
title (:obj:`str`): Location title.
horizontal_accuracy (:obj:`float`): Optional. The radius of uncertainty for the location,
measured in meters.
live_period (:obj:`int`): Optional. Period in seconds for which the location can be
updated, should be between 60 and 86400.
measured in meters; 0-
:tg-const:`telegram.InlineQueryResultLocation.HORIZONTAL_ACCURACY`.
live_period (:obj:`int`): Optional. Period in seconds for which the location will be
updated, should be between
:tg-const:`telegram.InlineQueryResultLocation.MIN_LIVE_PERIOD` and
:tg-const:`telegram.InlineQueryResultLocation.MAX_LIVE_PERIOD`.
heading (:obj:`int`): Optional. For live locations, a direction in which the user is
moving, in degrees.
proximity_alert_radius (:obj:`int`): Optional. For live locations, a maximum distance for
proximity alerts about approaching another chat member, in meters.
moving, in degrees. Must be between
:tg-const:`telegram.InlineQueryResultLocation.MIN_HEADING` and
:tg-const:`telegram.InlineQueryResultLocation.MAX_HEADING` if specified.
proximity_alert_radius (:obj:`int`): Optional. For live locations, a maximum distance
for proximity alerts about approaching another chat member, in meters. Must be
between :tg-const:`telegram.InlineQueryResultLocation.MIN_PROXIMITY_ALERT_RADIUS`
and :tg-const:`telegram.InlineQueryResultLocation.MAX_PROXIMITY_ALERT_RADIUS`
if specified.
reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached
to the message.
input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the
@@ -38,6 +38,8 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult):
use :attr:`input_message_content` to send a message with the specified content instead of the
animation.
.. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`
Args:
id (:obj:`str`): Unique identifier for this result,
:tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`-
@@ -46,7 +48,8 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult):
mpeg4_width (:obj:`int`, optional): Video width.
mpeg4_height (:obj:`int`, optional): Video height.
mpeg4_duration (:obj:`int`, optional): Video duration in seconds.
thumb_url (:obj:`str`): URL of the static thumbnail (jpeg or gif) for the result.
thumb_url (:obj:`str`): URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for
the result.
thumb_mime_type (:obj:`str`): Optional. MIME type of the thumbnail, must be one of
``'image/jpeg'``, ``'image/gif'``, or ``'video/mp4'``. Defaults to ``'image/jpeg'``.
title (:obj:`str`, optional): Title for the result.
@@ -76,7 +79,8 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult):
mpeg4_duration (:obj:`int`): Optional. Video duration in seconds.
thumb_url (:obj:`str`): URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for
the result.
thumb_mime_type (:obj:`str`): Optional. MIME type of the thumbnail.
thumb_mime_type (:obj:`str`): Optional. MIME type of the thumbnail, must be one of
``'image/jpeg'``, ``'image/gif'``, or ``'video/mp4'``. Defaults to ``'image/jpeg'``.
title (:obj:`str`): Optional. Title for the result.
caption (:obj:`str`): Optional. Caption of the MPEG-4 file to be sent,
0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters
@@ -37,6 +37,8 @@ class InlineQueryResultPhoto(InlineQueryResult):
caption. Alternatively, you can use :attr:`input_message_content` to send a message with the
specified content instead of the photo.
.. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`
Args:
id (:obj:`str`): Unique identifier for this result,
:tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`-
+6 -2
View File
@@ -58,7 +58,7 @@ class InlineQueryResultVenue(InlineQueryResult):
reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): Inline keyboard attached
to the message.
input_message_content (:class:`telegram.InputMessageContent`, optional): Content of the
message to be sent instead of the location.
message to be sent instead of the venue.
thumb_url (:obj:`str`, optional): Url of the thumbnail for the result.
thumb_width (:obj:`int`, optional): Thumbnail width.
thumb_height (:obj:`int`, optional): Thumbnail height.
@@ -74,8 +74,12 @@ class InlineQueryResultVenue(InlineQueryResult):
address (:obj:`str`): Address of the venue.
foursquare_id (:obj:`str`): Optional. Foursquare identifier of the venue if known.
foursquare_type (:obj:`str`): Optional. Foursquare type of the venue, if known.
(For example, "arts_entertainment/default", "arts_entertainment/aquarium" or
"food/icecream".)
google_place_id (:obj:`str`): Optional. Google Places identifier of the venue.
google_place_type (:obj:`str`): Optional. Google Places type of the venue.
google_place_type (:obj:`str`): Optional. Google Places type of the venue. (See
`supported types <https://developers.google.com/maps/documentation/places/web-service\
/supported_types>`_.)
reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached
to the message.
input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the
+9 -7
View File
@@ -42,6 +42,8 @@ class InlineQueryResultVideo(InlineQueryResult):
If an InlineQueryResultVideo message contains an embedded video (e.g., YouTube), you must
replace its content using :attr:`input_message_content`.
.. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`
Args:
id (:obj:`str`): Unique identifier for this result,
:tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`-
@@ -50,7 +52,7 @@ class InlineQueryResultVideo(InlineQueryResult):
mime_type (:obj:`str`): Mime type of the content of video url, "text/html" or "video/mp4".
thumb_url (:obj:`str`): URL of the thumbnail (JPEG only) for the video.
title (:obj:`str`): Title for the result.
caption (:obj:`str`, optional): Caption,
caption (:obj:`str`, optional): Caption of the video to be sent,
0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters after entities
parsing.
parse_mode (:obj:`str`, optional): |parse_mode|
@@ -67,7 +69,7 @@ class InlineQueryResultVideo(InlineQueryResult):
to the message.
input_message_content (:class:`telegram.InputMessageContent`, optional): Content of the
message to be sent instead of the video. This field is required if
InlineQueryResultVideo is used to send an HTML-page as a result
``InlineQueryResultVideo`` is used to send an HTML-page as a result
(e.g., a YouTube video).
Attributes:
@@ -80,10 +82,10 @@ class InlineQueryResultVideo(InlineQueryResult):
thumb_url (:obj:`str`): URL of the thumbnail (JPEG only) for the video.
title (:obj:`str`): Title for the result.
caption (:obj:`str`): Optional. Caption of the video to be sent,
0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters after
entities parsing.
0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters after entities
parsing.
parse_mode (:obj:`str`): Optional. |parse_mode|
caption_entities (Sequence[:class:`telegram.MessageEntity`]): Optional.
caption_entities (Tuple[:class:`telegram.MessageEntity`]): Optional.
|captionentitiesattr|
.. versionchanged:: 20.0
@@ -95,11 +97,11 @@ class InlineQueryResultVideo(InlineQueryResult):
video_height (:obj:`int`): Optional. Video height.
video_duration (:obj:`int`): Optional. Video duration in seconds.
description (:obj:`str`): Optional. Short description of the result.
reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): Inline keyboard attached
reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached
to the message.
input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the
message to be sent instead of the video. This field is required if
InlineQueryResultVideo is used to send an HTML-page as a result
``InlineQueryResultVideo`` is used to send an HTML-page as a result
(e.g., a YouTube video).
"""
@@ -38,6 +38,8 @@ class InlineQueryResultVoice(InlineQueryResult):
:attr:`input_message_content` to send a message with the specified content instead of
the voice message.
.. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`
Args:
id (:obj:`str`): Unique identifier for this result,
:tg-const:`telegram.InlineQueryResult.MIN_ID_LENGTH`-
+17 -6
View File
@@ -115,22 +115,33 @@ class InputInvoiceMessageContent(InputMessageContent):
currency (:obj:`str`): Three-letter ISO 4217 currency code, see more on
`currencies <https://core.telegram.org/bots/payments#supported-currencies>`_
prices (Tuple[:class:`telegram.LabeledPrice`]): Price breakdown, a list of
components.
components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus,
etc.)
.. versionchanged:: 20.0
|tupleclassattrs|
max_tip_amount (:obj:`int`): Optional. The maximum accepted amount for tips in the smallest
units of the currency (integer, not float/double).
max_tip_amount (:obj:`int`): Optional. The maximum accepted amount for tips in the
*smallest* units of the currency (integer, **not** float/double). For example, for a
maximum tip of US$ 1.45 ``max_tip_amount`` is ``145``. See the ``exp`` parameter in
`currencies.json <https://core.telegram.org/bots/payments/currencies.json>`_, it
shows the number of digits past the decimal point for each currency (2 for the majority
of currencies). Defaults to ``0``.
suggested_tip_amounts (Tuple[:obj:`int`]): Optional. An array of suggested
amounts of tip in the smallest units of the currency (integer, not float/double).
amounts of tip in the *smallest* units of the currency (integer, **not** float/double).
At most 4 suggested tip amounts can be specified. The suggested tip amounts must be
positive, passed in a strictly increased order and must not exceed
:attr:`max_tip_amount`.
.. versionchanged:: 20.0
|tupleclassattrs|
provider_data (:obj:`str`): Optional. An object for data about the invoice,
which will be shared with the payment provider.
photo_url (:obj:`str`): Optional. URL of the product photo for the invoice.
which will be shared with the payment provider. A detailed description of the required
fields should be provided by the payment provider.
photo_url (:obj:`str`): Optional. URL of the product photo for the invoice. Can be a photo
of the goods or a marketing image for a service. People like it better when they see
what they are paying for.
photo_size (:obj:`int`): Optional. Photo size.
photo_width (:obj:`int`): Optional. Photo width.
photo_height (:obj:`int`): Optional. Photo height.
@@ -57,13 +57,21 @@ class InputLocationMessageContent(InputMessageContent):
latitude (:obj:`float`): Latitude of the location in degrees.
longitude (:obj:`float`): Longitude of the location in degrees.
horizontal_accuracy (:obj:`float`): Optional. The radius of uncertainty for the location,
measured in meters.
live_period (:obj:`int`): Optional. Period in seconds for which the location can be
updated.
measured in meters; 0-
:tg-const:`telegram.InputLocationMessageContent.HORIZONTAL_ACCURACY`.
live_period (:obj:`int`): Optional. Period in seconds for which the location can be
updated, should be between
:tg-const:`telegram.InputLocationMessageContent.MIN_LIVE_PERIOD` and
:tg-const:`telegram.InputLocationMessageContent.MAX_LIVE_PERIOD`.
heading (:obj:`int`): Optional. For live locations, a direction in which the user is
moving, in degrees.
proximity_alert_radius (:obj:`int`): Optional. For live locations, a maximum distance for
proximity alerts about approaching another chat member, in meters.
moving, in degrees. Must be between
:tg-const:`telegram.InputLocationMessageContent.MIN_HEADING` and
:tg-const:`telegram.InputLocationMessageContent.MAX_HEADING` if specified.
proximity_alert_radius (:obj:`int`): Optional. For live locations, a maximum distance
for proximity alerts about approaching another chat member, in meters. Must be
between :tg-const:`telegram.InputLocationMessageContent.MIN_PROXIMITY_ALERT_RADIUS`
and :tg-const:`telegram.InputLocationMessageContent.MAX_PROXIMITY_ALERT_RADIUS`
if specified.
"""
+2 -1
View File
@@ -52,7 +52,8 @@ class InputTextMessageContent(InputMessageContent):
Attributes:
message_text (:obj:`str`): Text of the message to be sent,
1-:tg-const:`telegram.constants.MessageLimit.MAX_TEXT_LENGTH` characters after entities
:tg-const:`telegram.constants.MessageLimit.MIN_TEXT_LENGTH`-
:tg-const:`telegram.constants.MessageLimit.MAX_TEXT_LENGTH` characters after entities
parsing.
parse_mode (:obj:`str`): Optional. |parse_mode|
entities (Tuple[:class:`telegram.MessageEntity`]): Optional. |captionentitiesattr|
+5 -1
View File
@@ -54,8 +54,12 @@ class InputVenueMessageContent(InputMessageContent):
address (:obj:`str`): Address of the venue.
foursquare_id (:obj:`str`): Optional. Foursquare identifier of the venue, if known.
foursquare_type (:obj:`str`): Optional. Foursquare type of the venue, if known.
(For example, "arts_entertainment/default", "arts_entertainment/aquarium" or
"food/icecream".)
google_place_id (:obj:`str`): Optional. Google Places identifier of the venue.
google_place_type (:obj:`str`): Optional. Google Places type of the venue.
google_place_type (:obj:`str`): Optional. Google Places type of the venue. (See
`supported types <https://developers.google.com/maps/documentation/places/web-service\
/supported_types>`_.)
"""
+13 -6
View File
@@ -68,12 +68,19 @@ class KeyboardButton(TelegramObject):
.. versionadded:: 20.0
Attributes:
text (:obj:`str`): Text of the button.
request_contact (:obj:`bool`): Optional. The user's phone number will be sent.
request_location (:obj:`bool`): Optional. The user's current location will be sent.
request_poll (:class:`KeyboardButtonPollType`): Optional. If the user should create a poll.
web_app (:class:`WebAppInfo`): Optional. If the described Web App will be launched when the
button is pressed.
text (:obj:`str`): Text of the button. If none of the optional fields are used, it will be
sent to the bot as a message when the button is pressed.
request_contact (:obj:`bool`): Optional. If :obj:`True`, the user's phone number will be
sent as a contact when the button is pressed. Available in private chats only.
request_location (:obj:`bool`): Optional. If :obj:`True`, the user's current location will
be sent when the button is pressed. Available in private chats only.
request_poll (:class:`KeyboardButtonPollType`): Optional. If specified, the user will be
asked to create a poll and send it to the bot when the button is pressed. Available in
private chats only.
web_app (:class:`WebAppInfo`): Optional. If specified, the described `Web App
<https://core.telegram.org/bots/webapps>`_ will be launched when the button is pressed.
The Web App will be able to send a :attr:`Message.web_app_data` service message.
Available in private chats only.
.. versionadded:: 20.0
"""
+7 -2
View File
@@ -32,11 +32,16 @@ class KeyboardButtonPollType(TelegramObject):
Examples:
:any:`Poll Bot <examples.pollbot>`
Attributes:
type (:obj:`str`): Optional. If :tg-const:`telegram.Poll.QUIZ` is passed, the user will be
Args:
type (:obj:`str`, optional): If :tg-const:`telegram.Poll.QUIZ` is passed, the user will be
allowed to create only polls in the quiz mode. If :tg-const:`telegram.Poll.REGULAR` is
passed, only regular polls will be allowed. Otherwise, the user will be allowed to
create a poll of any type.
Attributes:
type (:obj:`str`): Optional. If equals :tg-const:`telegram.Poll.QUIZ`, the user will
be allowed to create only polls in the quiz mode. If equals
:tg-const:`telegram.Poll.REGULAR`, only regular polls will be allowed.
Otherwise, the user will be allowed to create a poll of any type.
"""
__slots__ = ("type",)
+15 -3
View File
@@ -44,7 +44,7 @@ class LoginUrl(TelegramObject):
the original URL without information about the user will be opened. The data added is
the same as described in
`Receiving authorization data
<https://core.telegram.org/widgets/login#receiving-authorization-data>`_
<https://core.telegram.org/widgets/login#receiving-authorization-data>`_.
forward_text (:obj:`str`, optional): New text of the button in forwarded messages.
bot_username (:obj:`str`, optional): Username of a bot, which will be used for user
authorization. See
@@ -59,10 +59,22 @@ class LoginUrl(TelegramObject):
for your bot to send messages to the user.
Attributes:
url (:obj:`str`): An HTTPS URL to be opened with user authorization data.
url (:obj:`str`): An HTTPS URL to be opened with user authorization data added to the query
string when the button is pressed. If the user refuses to provide authorization data,
the original URL without information about the user will be opened. The data added is
the same as described in
`Receiving authorization data
<https://core.telegram.org/widgets/login#receiving-authorization-data>`_.
forward_text (:obj:`str`): Optional. New text of the button in forwarded messages.
bot_username (:obj:`str`): Optional. Username of a bot, which will be used for user
authorization.
authorization. See
`Setting up a bot <https://core.telegram.org/widgets/login#setting-up-a-bot>`_
for more details. If not specified, the current
bot's username will be assumed. The url's domain must be the same as the domain linked
with the bot. See
`Linking your domain to the bot
<https://core.telegram.org/widgets/login#linking-your-domain-to-the-bot>`_
for more details.
request_write_access (:obj:`bool`): Optional. Pass :obj:`True` to request the permission
for your bot to send messages to the user.
+4 -2
View File
@@ -133,14 +133,16 @@ class MenuButtonWebApp(MenuButton):
text (:obj:`str`): Text of the button.
web_app (:class:`telegram.WebAppInfo`): Description of the Web App that will be launched
when the user presses the button. The Web App will be able to send an arbitrary
message on behalf of the user using the method :meth:`~telegram.Bot.answerWebAppQuery`.
message on behalf of the user using the method :meth:`~telegram.Bot.answerWebAppQuery`
of :class:`~telegram.Bot`.
Attributes:
type (:obj:`str`): :tg-const:`telegram.constants.MenuButtonType.WEB_APP`.
text (:obj:`str`): Text of the button.
web_app (:class:`telegram.WebAppInfo`): Description of the Web App that will be launched
when the user presses the button. The Web App will be able to send an arbitrary
message on behalf of the user using the method :meth:`~telegram.Bot.answerWebAppQuery`.
message on behalf of the user using the method :meth:`~telegram.Bot.answerWebAppQuery`
of :class:`~telegram.Bot`.
"""
__slots__ = ("text", "web_app")
+18 -3
View File
@@ -237,8 +237,6 @@ class Message(TelegramObject):
of the post author if present.
author_signature (:obj:`str`, optional): Signature of the post author for messages in
channels, or the custom title of an anonymous group administrator.
forward_sender_name (:obj:`str`, optional): Sender's name for messages forwarded from
users who disallow adding a link to their account in forwarded messages.
passport_data (:class:`telegram.PassportData`, optional): Telegram Passport data.
poll (:class:`telegram.Poll`, optional): Message is a native poll,
information about the poll.
@@ -349,33 +347,48 @@ class Message(TelegramObject):
audio (:class:`telegram.Audio`): Optional. Message is an audio file, information
about the file.
.. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`
document (:class:`telegram.Document`): Optional. Message is a general file, information
about the file.
.. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`
animation (:class:`telegram.Animation`): Optional. Message is an animation, information
about the animation. For backward compatibility, when this field is set, the document
field will also be set.
.. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`
game (:class:`telegram.Game`): Optional. Message is a game, information about the game.
photo (Tuple[:class:`telegram.PhotoSize`]): Optional. Message is a photo, available
sizes of the photo. This list is empty if the message does not contain a photo.
.. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`
.. versionchanged:: 20.0
|tupleclassattrs|
sticker (:class:`telegram.Sticker`): Optional. Message is a sticker, information
about the sticker.
.. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`
video (:class:`telegram.Video`): Optional. Message is a video, information about the
video.
.. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`
voice (:class:`telegram.Voice`): Optional. Message is a voice message, information about
the file.
.. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`
video_note (:class:`telegram.VideoNote`): Optional. Message is a video note, information
about the video message.
.. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`
new_chat_members (Tuple[:class:`telegram.User`]): Optional. New members that were added
to the group or supergroup and information about them (the bot itself may be one of
these members). This list is empty if the message does not contain new chat members.
.. versionchanged:: 20.0
|tupleclassattrs|
caption (:obj:`str`): Optional. Caption for the animation, audio, document, photo, video
or voice, 0-:tg-const:`telegram.constants.MessageLimit.CAPTION_LENGTH` characters.
contact (:class:`telegram.Contact`): Optional. Message is a shared contact, information
@@ -841,6 +854,8 @@ class Message(TelegramObject):
Otherwise :obj:`None` is returned.
.. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`
.. versionchanged:: 20.0
:attr:`dice`, :attr:`passport_data` and :attr:`poll` are now also considered to be an
attachment.
+4 -3
View File
@@ -48,7 +48,7 @@ class MessageEntity(TelegramObject):
:attr:`CUSTOM_EMOJI` (for inline custom emoji stickers).
.. versionadded:: 20.0
added inline custom emoji
Added inline custom emoji
offset (:obj:`int`): Offset in UTF-16 code units to the start of the entity.
length (:obj:`int`): Length of the entity in UTF-16 code units.
url (:obj:`str`, optional): For :attr:`TEXT_LINK` only, url that will be opened after
@@ -77,8 +77,9 @@ class MessageEntity(TelegramObject):
length (:obj:`int`): Length of the entity in UTF-16 code units.
url (:obj:`str`): Optional. For :attr:`TEXT_LINK` only, url that will be opened after
user taps on the text.
user (:class:`telegram.User`): Optional. The mentioned user.
language (:obj:`str`): Optional. For :attr:`PRE` only, The programming language of
user (:class:`telegram.User`): Optional. For :attr:`TEXT_MENTION` only, the mentioned
user.
language (:obj:`str`): Optional. For :attr:`PRE` only, the programming language of
the entity text.
custom_emoji_id (:obj:`str`): Optional. For :attr:`CUSTOM_EMOJI` only, unique identifier
of the custom emoji. Use :meth:`telegram.Bot.get_custom_emoji_stickers` to get full
+42
View File
@@ -249,6 +249,28 @@ class SecureData(TelegramObject):
This object represents the credentials that were used to decrypt the encrypted data.
All fields are optional and depend on fields that were requested.
Args:
personal_details (:class:`telegram.SecureValue`, optional): Credentials for encrypted
personal details.
passport (:class:`telegram.SecureValue`, optional): Credentials for encrypted passport.
internal_passport (:class:`telegram.SecureValue`, optional): Credentials for encrypted
internal passport.
driver_license (:class:`telegram.SecureValue`, optional): Credentials for encrypted
driver license.
identity_card (:class:`telegram.SecureValue`, optional): Credentials for encrypted ID card
address (:class:`telegram.SecureValue`, optional): Credentials for encrypted
residential address.
utility_bill (:class:`telegram.SecureValue`, optional): Credentials for encrypted
utility bill.
bank_statement (:class:`telegram.SecureValue`, optional): Credentials for encrypted
bank statement.
rental_agreement (:class:`telegram.SecureValue`, optional): Credentials for encrypted
rental agreement.
passport_registration (:class:`telegram.SecureValue`, optional): Credentials for encrypted
registration from internal passport.
temporary_registration (:class:`telegram.SecureValue`, optional): Credentials for encrypted
temporary registration.
Attributes:
personal_details (:class:`telegram.SecureValue`): Optional. Credentials for encrypted
personal details.
@@ -351,6 +373,26 @@ class SecureValue(TelegramObject):
This object represents the credentials that were used to decrypt the encrypted value.
All fields are optional and depend on the type of field.
Args:
data (:class:`telegram.DataCredentials`, optional): Credentials for encrypted Telegram
Passport data. Available for "personal_details", "passport", "driver_license",
"identity_card", "identity_passport" and "address" types.
front_side (:class:`telegram.FileCredentials`, optional): Credentials for encrypted
document's front side. Available for "passport", "driver_license", "identity_card"
and "internal_passport".
reverse_side (:class:`telegram.FileCredentials`, optional): Credentials for encrypted
document's reverse side. Available for "driver_license" and "identity_card".
selfie (:class:`telegram.FileCredentials`, optional): Credentials for encrypted selfie
of the user with a document. Can be available for "passport", "driver_license",
"identity_card" and "internal_passport".
translation (List[:class:`telegram.FileCredentials`], optional): Credentials for an
encrypted translation of the document. Available for "passport", "driver_license",
"identity_card", "internal_passport", "utility_bill", "bank_statement",
"rental_agreement", "passport_registration" and "temporary_registration".
files (List[:class:`telegram.FileCredentials`], optional): Credentials for encrypted
files. Available for "utility_bill", "bank_statement", "rental_agreement",
"passport_registration" and "temporary_registration" types.
Attributes:
data (:class:`telegram.DataCredentials`): Optional. Credentials for encrypted Telegram
Passport data. Available for "personal_details", "passport", "driver_license",
+28
View File
@@ -26,6 +26,22 @@ class PersonalDetails(TelegramObject):
"""
This object represents personal details.
Args:
first_name (:obj:`str`): First Name.
middle_name (:obj:`str`): Optional. First Name.
last_name (:obj:`str`): Last Name.
birth_date (:obj:`str`): Date of birth in DD.MM.YYYY format.
gender (:obj:`str`): Gender, male or female.
country_code (:obj:`str`): Citizenship (ISO 3166-1 alpha-2 country code).
residence_country_code (:obj:`str`): Country of residence (ISO 3166-1 alpha-2 country
code).
first_name_native (:obj:`str`): First Name in the language of the user's country of
residence.
middle_name_native (:obj:`str`): Optional. Middle Name in the language of the user's
country of residence.
last_name_native (:obj:`str`): Last Name in the language of the user's country of
residence.
Attributes:
first_name (:obj:`str`): First Name.
middle_name (:obj:`str`): Optional. First Name.
@@ -91,6 +107,14 @@ class ResidentialAddress(TelegramObject):
"""
This object represents a residential address.
Args:
street_line1 (:obj:`str`): First line for the address.
street_line2 (:obj:`str`): Optional. Second line for the address.
city (:obj:`str`): City.
state (:obj:`str`): Optional. State.
country_code (:obj:`str`): ISO 3166-1 alpha-2 country code.
post_code (:obj:`str`): Address post code.
Attributes:
street_line1 (:obj:`str`): First line for the address.
street_line2 (:obj:`str`): Optional. Second line for the address.
@@ -136,6 +160,10 @@ class IdDocumentData(TelegramObject):
"""
This object represents the data of an identity document.
Args:
document_no (:obj:`str`): Document number.
expiry_date (:obj:`str`): Optional. Date of expiry, in DD.MM.YYYY format.
Attributes:
document_no (:obj:`str`): Document number.
expiry_date (:obj:`str`): Optional. Date of expiry, in DD.MM.YYYY format.
@@ -35,6 +35,7 @@ class PassportElementError(TelegramObject):
Args:
source (:obj:`str`): Error source.
type (:obj:`str`): The section of the user's Telegram Passport which has the error.
message (:obj:`str`): Error message.
Attributes:
source (:obj:`str`): Error source.
+2 -1
View File
@@ -46,7 +46,8 @@ class PassportFile(TelegramObject):
file_date (:obj:`int`): Unix time when the file was uploaded.
Attributes:
file_id (:obj:`str`): Identifier for this file.
file_id (:obj:`str`): Identifier for this file, which can be used to download
or reuse the file.
file_unique_id (:obj:`str`): Unique identifier for this file, which
is supposed to be the same over time and for different bots.
Can't be used to download or reuse the file.
+8 -2
View File
@@ -48,9 +48,15 @@ class Invoice(TelegramObject):
Attributes:
title (:obj:`str`): Product name.
description (:obj:`str`): Product description.
start_parameter (:obj:`str`): Unique bot deep-linking parameter.
start_parameter (:obj:`str`): Unique bot deep-linking parameter that can be used to
generate this invoice.
currency (:obj:`str`): Three-letter ISO 4217 currency code.
total_amount (:obj:`int`): Total price in the smallest units of the currency.
total_amount (:obj:`int`): Total price in the smallest units of the currency (integer, not
float/double). For example, for a price of US$ 1.45 ``amount`` is ``145``. See the
``exp`` parameter in
`currencies.json <https://core.telegram.org/bots/payments/currencies.json>`_,
it shows the number of digits past the decimal point for each currency
(2 for the majority of currencies).
"""
+6 -1
View File
@@ -42,7 +42,12 @@ class LabeledPrice(TelegramObject):
Attributes:
label (:obj:`str`): Portion label.
amount (:obj:`int`): Price of the product in the smallest units of the currency.
amount (:obj:`int`): Price of the product in the smallest units of the currency (integer,
not float/double). For example, for a price of US$ 1.45 ``amount`` is ``145``.
See the ``exp`` parameter in
`currencies.json <https://core.telegram.org/bots/payments/currencies.json>`_,
it shows the number of digits past the decimal point for each currency
(2 for the majority of currencies).
"""
+6 -1
View File
@@ -58,7 +58,12 @@ class PreCheckoutQuery(TelegramObject):
id (:obj:`str`): Unique query identifier.
from_user (:class:`telegram.User`): User who sent the query.
currency (:obj:`str`): Three-letter ISO 4217 currency code.
total_amount (:obj:`int`): Total price in the smallest units of the currency.
total_amount (:obj:`int`): Total price in the smallest units of the currency (integer, not
float/double). For example, for a price of US$ 1.45 ``amount`` is ``145``.
See the ``exp`` parameter in
`currencies.json <https://core.telegram.org/bots/payments/currencies.json>`_,
it shows the number of digits past the decimal point for each currency
(2 for the majority of currencies).
invoice_payload (:obj:`str`): Bot specified invoice payload.
shipping_option_id (:obj:`str`): Optional. Identifier of the shipping option chosen by the
user.
+6 -1
View File
@@ -52,7 +52,12 @@ class SuccessfulPayment(TelegramObject):
Attributes:
currency (:obj:`str`): Three-letter ISO 4217 currency code.
total_amount (:obj:`int`): Total price in the smallest units of the currency.
total_amount (:obj:`int`): Total price in the smallest units of the currency (integer, not
float/double). For example, for a price of US$ 1.45 ``amount`` is ``145``.
See the ``exp`` parameter in
`currencies.json <https://core.telegram.org/bots/payments/currencies.json>`_,
it shows the number of digits past the decimal point for each currency
(2 for the majority of currencies).
invoice_payload (:obj:`str`): Bot specified invoice payload.
shipping_option_id (:obj:`str`): Optional. Identifier of the shipping option chosen by the
user.
+23 -6
View File
@@ -70,14 +70,31 @@ class ReplyKeyboardMarkup(TelegramObject):
.. versionadded:: 13.7
Attributes:
keyboard (Tuple[Tuple[:class:`telegram.KeyboardButton` | :obj:`str`]]): Array of button
rows.
resize_keyboard (:obj:`bool`): Optional. Requests clients to resize the keyboard.
keyboard (Tuple[Tuple[:class:`telegram.KeyboardButton`]]): Array of button rows,
each represented by an Array of :class:`telegram.KeyboardButton` objects.
resize_keyboard (:obj:`bool`): Optional. Requests clients to resize the keyboard vertically
for optimal fit (e.g., make the keyboard smaller if there are just two rows of
buttons). Defaults to :obj:`False`, in which case the custom keyboard is always of the
same height as the app's standard keyboard.
one_time_keyboard (:obj:`bool`): Optional. Requests clients to hide the keyboard as soon as
it's been used.
it's been used. The keyboard will still be available, but clients will automatically
display the usual letter-keyboard in the chat - the user can press a special button in
the input field to see the custom keyboard again. Defaults to :obj:`False`.
selective (:obj:`bool`): Optional. Show the keyboard to specific users only.
input_field_placeholder (:obj:`str`): Optional. The placeholder shown in the input
field when the reply is active.
Targets:
1) Users that are @mentioned in the :attr:`~telegram.Message.text` of the
:class:`telegram.Message` object.
2) If the bot's message is a reply (has ``reply_to_message_id``), sender of the
original message.
Defaults to :obj:`False`.
input_field_placeholder (:obj:`str`): Optional. The placeholder to be shown in the input
field when the keyboard is active;
:tg-const:`telegram.ReplyKeyboardMarkup.MIN_INPUT_FIELD_PLACEHOLDER`-
:tg-const:`telegram.ReplyKeyboardMarkup.MAX_INPUT_FIELD_PLACEHOLDER`
characters.
.. versionadded:: 13.7
+8 -4
View File
@@ -45,13 +45,17 @@ class ReplyKeyboardRemove(TelegramObject):
for specific users only. Targets:
1) Users that are @mentioned in the text of the :class:`telegram.Message` object.
2) If the bot's message is a reply (has `reply_to_message_id`), sender of the original
message.
2) If the bot's message is a reply (has ``reply_to_message_id``), sender of
the original message.
Attributes:
remove_keyboard (:obj:`True`): Requests clients to remove the custom keyboard.
selective (:obj:`bool`): Optional. Use this parameter if you want to remove the keyboard
for specific users only.
selective (:obj:`bool`): Optional. Remove the keyboard for specific users only.
Targets:
1) Users that are @mentioned in the text of the :class:`telegram.Message` object.
2) If the bot's message is a reply (has ``reply_to_message_id``), sender of
the original message.
"""
+20 -11
View File
@@ -46,8 +46,7 @@ class Update(TelegramObject):
Note:
At most one of the optional parameters can be present in any given update.
.. seealso:: `Your First Bot <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Extensions--Your-first-Bot>`_
.. seealso:: :wiki:`Your First Bot <Extensions--Your-first-Bot>`
Args:
update_id (:obj:`int`): The update's unique identifier. Update identifiers start from a
@@ -98,23 +97,33 @@ class Update(TelegramObject):
.. versionadded:: 13.8
Attributes:
update_id (:obj:`int`): The update's unique identifier.
message (:class:`telegram.Message`): Optional. New incoming message.
edited_message (:class:`telegram.Message`): Optional. New version of a message.
channel_post (:class:`telegram.Message`): Optional. New incoming channel post.
edited_channel_post (:class:`telegram.Message`): Optional. New version of a channel post.
update_id (:obj:`int`): The update's unique identifier. Update identifiers start from a
certain positive number and increase sequentially. This ID becomes especially handy if
you're using Webhooks, since it allows you to ignore repeated updates or to restore the
correct update sequence, should they get out of order. If there are no new updates for
at least a week, then identifier of the next update will be chosen randomly instead of
sequentially.
message (:class:`telegram.Message`): Optional. New incoming message of any kind - text,
photo, sticker, etc.
edited_message (:class:`telegram.Message`): Optional. New version of a message that is
known to the bot and was edited.
channel_post (:class:`telegram.Message`): Optional. New incoming channel post of any kind
- text, photo, sticker, etc.
edited_channel_post (:class:`telegram.Message`): Optional. New version of a channel post
that is known to the bot and was edited.
inline_query (:class:`telegram.InlineQuery`): Optional. New incoming inline query.
chosen_inline_result (:class:`telegram.ChosenInlineResult`): Optional. The result of an
inline query that was chosen by a user.
inline query that was chosen by a user and sent to their chat partner.
callback_query (:class:`telegram.CallbackQuery`): Optional. New incoming callback query.
Examples:
:any:`Arbitrary Callback Data Bot <examples.arbitrarycallbackdatabot>`
shipping_query (:class:`telegram.ShippingQuery`): Optional. New incoming shipping query.
Only for invoices with flexible price.
pre_checkout_query (:class:`telegram.PreCheckoutQuery`): Optional. New incoming
pre-checkout query.
poll (:class:`telegram.Poll`): Optional. New poll state. Bots receive only updates
about stopped polls and polls, which are sent by the bot.
pre-checkout query. Contains full information about checkout.
poll (:class:`telegram.Poll`): Optional. New poll state. Bots receive only updates about
stopped polls and polls, which are sent by the bot.
poll_answer (:class:`telegram.PollAnswer`): Optional. A user changed their answer
in a non-anonymous poll. Bots receive new votes only in polls that were sent
by the bot itself.
+3 -3
View File
@@ -70,9 +70,9 @@ class User(TelegramObject):
Args:
id (:obj:`int`): Unique identifier for this user or bot.
is_bot (:obj:`bool`): :obj:`True`, if this user is a bot.
first_name (:obj:`str`): User's or bots first name.
last_name (:obj:`str`, optional): User's or bots last name.
username (:obj:`str`, optional): User's or bots username.
first_name (:obj:`str`): User's or bot's first name.
last_name (:obj:`str`, optional): User's or bot's last name.
username (:obj:`str`, optional): User's or bot's username.
language_code (:obj:`str`, optional): IETF language tag of the user's language.
can_join_groups (:obj:`str`, optional): :obj:`True`, if the bot can be invited to groups.
Returned only in :attr:`telegram.Bot.get_me` requests.
+2 -2
View File
@@ -43,8 +43,8 @@ class UserProfilePhotos(TelegramObject):
Attributes:
total_count (:obj:`int`): Total number of profile pictures.
photos (Tuple[Tuple[:class:`telegram.PhotoSize`]]): Requested profile pictures (in up
to 4 sizes each).
photos (Tuple[Tuple[:class:`telegram.PhotoSize`]]): Requested profile pictures (in up to 4
sizes each).
.. versionchanged:: 20.0
|tupleclassattrs|
+3 -5
View File
@@ -59,8 +59,7 @@ class TelegramError(Exception):
"""
Base class for Telegram errors.
.. seealso:: `Exceptions, Warnings and Logging <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Exceptions%2C-Warnings-and-Logging>`_
.. seealso:: :wiki:`Exceptions, Warnings and Logging <Exceptions%2C-Warnings-and-Logging>`
"""
__slots__ = ("message",)
@@ -149,9 +148,8 @@ class ChatMigrated(TelegramError):
"""
Raised when the requested group chat migrated to supergroup and has a new chat id.
.. seealso:: `Storing Bot, User and Chat Related Data <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Storing-bot%2C-user-and-\
chat-related-data>`_,
.. seealso::
:wiki:`Storing Bot, User and Chat Related Data <Storing-bot%2C-user-and-chat-related-data>`
Args:
new_chat_id (:obj:`int`): The new chat id of the group.
+1 -2
View File
@@ -90,8 +90,7 @@ class AIORateLimiter(BaseRateLimiter[int]):
welcome you to implement your own subclass of :class:`~telegram.ext.BaseRateLimiter`.
Feel free to check out the source code of this class for inspiration.
.. seealso:: `Avoiding Flood Limits <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Avoiding-flood-limits>`_
.. seealso:: :wiki:`Avoiding Flood Limits <Avoiding-flood-limits>`
.. versionadded:: 20.0
+10 -19
View File
@@ -136,10 +136,8 @@ class Application(Generic[BT, CCT, UD, CD, BD, JQ], AbstractAsyncContextManager)
Examples:
:any:`Echo Bot <examples.echobot>`
.. seealso:: `Your First Bot <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Extensions--Your-first-Bot>`_,
`Architecture Overview <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Architecture>`_
.. seealso:: :wiki:`Your First Bot <Extensions--Your-first-Bot>`,
:wiki:`Architecture Overview <Architecture>`
.. versionchanged:: 20.0
@@ -338,8 +336,7 @@ class Application(Generic[BT, CCT, UD, CD, BD, JQ], AbstractAsyncContextManager)
""":obj:`int`: The number of concurrent updates that will be processed in parallel. A
value of ``0`` indicates updates are *not* being processed concurrently.
.. seealso:: `Concurrency <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Concurrency>`_
.. seealso:: :wiki:`Concurrency`
"""
return self._concurrent_updates
@@ -349,8 +346,7 @@ class Application(Generic[BT, CCT, UD, CD, BD, JQ], AbstractAsyncContextManager)
:class:`telegram.ext.JobQueue`: The :class:`JobQueue` used by the
:class:`telegram.ext.Application`.
.. seealso:: `Job Queue <https://github.com/python-telegram-bot/
python-telegram-bot/wiki/Extensions-%E2%80%93-JobQueue>`_
.. seealso:: :wiki:`Job Queue <Extensions-%E2%80%93-JobQueue>`
"""
if self._job_queue is None:
warn(
@@ -763,8 +759,7 @@ class Application(Generic[BT, CCT, UD, CD, BD, JQ], AbstractAsyncContextManager)
.. seealso::
:meth:`initialize`, :meth:`start`, :meth:`stop`, :meth:`shutdown`
:meth:`telegram.ext.Updater.start_webhook`, :meth:`telegram.ext.Updater.stop`,
:meth:`run_polling`,
`Webhooks <https://github.com/python-telegram-bot/python-telegram-bot/wiki/Webhooks>`_
:meth:`run_polling`, :wiki:`Webhooks`
Args:
listen (:obj:`str`, optional): IP-Address to listen on. Defaults to
@@ -909,8 +904,7 @@ class Application(Generic[BT, CCT, UD, CD, BD, JQ], AbstractAsyncContextManager)
* If the application is currently running, tasks created by this method will be
awaited with :meth:`stop`.
.. seealso:: `Concurrency <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Concurrency>`_
.. seealso:: :wiki:`Concurrency`
Args:
coroutine (:term:`coroutine function`): The coroutine to run as task.
@@ -1028,8 +1022,7 @@ class Application(Generic[BT, CCT, UD, CD, BD, JQ], AbstractAsyncContextManager)
"""Processes a single update and marks the update to be updated by the persistence later.
Exceptions raised by handler callbacks will be processed by :meth:`process_update`.
.. seealso:: `Concurrency <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Concurrency>`_
.. seealso:: :wiki:`Concurrency`
.. versionchanged:: 20.0
Persistence is now updated in an interval set by
@@ -1270,9 +1263,8 @@ class Application(Generic[BT, CCT, UD, CD, BD, JQ], AbstractAsyncContextManager)
to the asynchronous nature of these features. Please make sure that your program can
avoid or handle such situations.
.. seealso:: `Storing Bot, User and Chat Related Data <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Storing-bot%2C-user-and-\
chat-related-data>`_,
.. seealso:: :wiki:`Storing Bot, User and Chat Related Data\
<Storing-bot%2C-user-and-chat-related-data>`
Args:
message (:class:`telegram.Message`, optional): A message with either
@@ -1495,8 +1487,7 @@ class Application(Generic[BT, CCT, UD, CD, BD, JQ], AbstractAsyncContextManager)
Examples:
:any:`Errorhandler Bot <examples.errorhandlerbot>`
.. seealso:: `Exceptions, Warnings and Logging <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Exceptions%2C-Warnings-and-Logging>`_
.. seealso:: :wiki:`Exceptions, Warnings and Logging <Exceptions%2C-Warnings-and-Logging>`
Args:
callback (:term:`coroutine function`): The callback function for this error handler.
+26 -25
View File
@@ -112,10 +112,8 @@ class ApplicationBuilder(Generic[BT, CCT, UD, CD, BD, JQ]):
* Unless a custom :class:`telegram.Bot` instance is set via :meth:`bot`, :meth:`build` will
use :class:`telegram.ext.ExtBot` for the bot.
.. seealso:: `Your First Bot <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Extensions--Your-first-Bot>`_,
`Builder Pattern for Application <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Builder-Pattern>`_
.. seealso:: :wiki:`Your First Bot <Extensions--Your-first-Bot>`,
:wiki:`Builder Pattern <Builder-Pattern>`
.. _`builder pattern`: https://en.wikipedia.org/wiki/Builder_pattern
"""
@@ -359,9 +357,8 @@ class ApplicationBuilder(Generic[BT, CCT, UD, CD, BD, JQ]):
"""Sets the base URL for :attr:`telegram.ext.Application.bot`. If not called,
will default to ``'https://api.telegram.org/bot'``.
.. seealso:: :paramref:`telegram.Bot.base_url`, `Local Bot API Server <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Local-Bot-API-Server>`_,
:meth:`base_file_url`
.. seealso:: :paramref:`telegram.Bot.base_url`,
:wiki:`Local Bot API Server <Local-Bot-API-Server>`, :meth:`base_file_url`
Args:
base_url (:obj:`str`): The URL.
@@ -378,9 +375,8 @@ class ApplicationBuilder(Generic[BT, CCT, UD, CD, BD, JQ]):
"""Sets the base file URL for :attr:`telegram.ext.Application.bot`. If not
called, will default to ``'https://api.telegram.org/file/bot'``.
.. seealso:: :paramref:`telegram.Bot.base_file_url`, `Local Bot API Server <https://\
github.com/python-telegram-bot/python-telegram-bot/wiki/Local-Bot-API-Server>`_,
:meth:`base_url`
.. seealso:: :paramref:`telegram.Bot.base_file_url`,
:wiki:`Local Bot API Server <Local-Bot-API-Server>`, :meth:`base_url`
Args:
base_file_url (:obj:`str`): The URL.
@@ -673,8 +669,10 @@ class ApplicationBuilder(Generic[BT, CCT, UD, CD, BD, JQ]):
"""Sets the private key and corresponding password for decryption of telegram passport data
for :attr:`telegram.ext.Application.bot`.
.. seealso:: :any:`examples.passportbot`, `Telegram Passports
<https://github.com/python-telegram-bot/python-telegram-bot/wiki/Telegram-Passport>`_
Examples:
:any:`Passport Bot <examples.passportbot>`
.. seealso:: :wiki:`Telegram Passports <Telegram-Passport>`
Args:
private_key (:obj:`bytes` | :obj:`str` | :obj:`pathlib.Path`): The private key or the
@@ -704,8 +702,7 @@ class ApplicationBuilder(Generic[BT, CCT, UD, CD, BD, JQ]):
"""Sets the :class:`telegram.ext.Defaults` instance for
:attr:`telegram.ext.Application.bot`.
.. seealso:: `Adding Defaults <https://github.com/python-telegram-bot/python-telegram-bot\
/wiki/Adding-defaults-to-your-bot>`_
.. seealso:: :wiki:`Adding Defaults to Your Bot <Adding-defaults-to-your-bot>`
Args:
defaults (:class:`telegram.ext.Defaults`): The defaults instance.
@@ -734,9 +731,10 @@ class ApplicationBuilder(Generic[BT, CCT, UD, CD, BD, JQ]):
pip install python-telegram-bot[callback-data]
.. seealso:: `Arbitrary callback_data <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Arbitrary-callback_data>`_,
:any:`examples.arbitrarycallbackdatabot`
Examples:
:any:`Arbitrary callback_data Bot <examples.arbitrarycallbackdatabot>`
.. seealso:: :wiki:`Arbitrary callback_data <Arbitrary-callback_data>`
Args:
arbitrary_callback_data (:obj:`bool` | :obj:`int`): If :obj:`True` is passed, the
@@ -756,8 +754,7 @@ class ApplicationBuilder(Generic[BT, CCT, UD, CD, BD, JQ]):
:attr:`telegram.ext.Application.bot`.
If not called, will default to :obj:`False`.
.. seealso:: `Local Bot API Server <https://github.com/python-telegram-bot/\
python-telegram-bot/wiki/Local-Bot-API-Server>`_,
.. seealso:: :wiki:`Local Bot API Server <Local-Bot-API-Server>`
Args:
local_mode (:obj:`bool`): Whether the bot should run in local mode.
@@ -842,8 +839,10 @@ class ApplicationBuilder(Generic[BT, CCT, UD, CD, BD, JQ]):
:attr:`telegram.ext.Application.job_queue`. If not called, a job queue will be
instantiated if the requirements of :class:`telegram.ext.JobQueue` are installed.
.. seealso:: `JobQueue <https://github.com/python-telegram-bot/python-telegram-bot/wiki\
/Extensions-%E2%80%93-JobQueue>`_, :any:`examples.timerbot`
Examples:
:any:`Timer Bot <examples.timerbot>`
.. seealso:: :wiki:`Job Queue <Extensions-%E2%80%93-JobQueue>`
Note:
* :meth:`telegram.ext.JobQueue.set_application` will be called automatically by
@@ -878,9 +877,10 @@ class ApplicationBuilder(Generic[BT, CCT, UD, CD, BD, JQ]):
:func:`copy.deepcopy`. This is due to the data being deep copied before handing it over
to the persistence in order to avoid race conditions.
.. seealso:: `Making your bot persistent <https://github.com/python-telegram-bot\
/python-telegram-bot/wiki/Making-your-bot-persistent>`_,
:any:`examples.persistentconversationbot`
Examples:
:any:`Persistent Conversation Bot <examples.persistentconversationbot>`
.. seealso:: :wiki:`Making Your Bot Persistent <Making-your-bot-persistent>`
Warning:
If a :class:`telegram.ext.ContextTypes` instance is set via :meth:`context_types`,
@@ -902,7 +902,8 @@ class ApplicationBuilder(Generic[BT, CCT, UD, CD, BD, JQ]):
"""Sets a :class:`telegram.ext.ContextTypes` instance for
:attr:`telegram.ext.Application.context_types`.
.. seealso:: :any:`examples.contexttypesbot`
Examples:
:any:`Context Types Bot <examples.contexttypesbot>`
Args:
context_types (:class:`telegram.ext.ContextTypes`): The context types.
+2 -4
View File
@@ -111,10 +111,8 @@ class BasePersistence(Generic[UD, CD, BD], ABC):
type of the argument of :meth:`refresh_bot_data` and the return value of
:meth:`get_bot_data`.
.. seealso:: `Architecture Overview <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Architecture>`_,
`Making Your Bot Persistent <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Making-your-bot-persistent>`_
.. seealso:: :wiki:`Architecture Overview <Architecture>`,
:wiki:`Making Your Bot Persistent <Making-your-bot-persistent>`
.. versionchanged:: 20.0
+2 -4
View File
@@ -37,10 +37,8 @@ class BaseRateLimiter(ABC, Generic[RLARGS]):
Hint:
Requests to :meth:`~telegram.Bot.get_updates` are never rate limited.
.. seealso:: `Architecture Overview <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Architecture>`_,
`Avoiding Flood Limits <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Avoiding-flood-limits>`_
.. seealso:: :wiki:`Architecture Overview <Architecture>`,
:wiki:`Avoiding Flood Limits <Avoiding-flood-limits>`
.. versionadded:: 20.0
"""
+11 -18
View File
@@ -72,8 +72,7 @@ class CallbackContext(Generic[BT, UD, CD, BD]):
* :any:`Custom Webhook Bot <examples.customwebhookbot>`
.. seealso:: :attr:`telegram.ext.ContextTypes.DEFAULT_TYPE`,
`Job Queue <https://github.com/python-telegram-bot/
python-telegram-bot/wiki/Extensions-%E2%80%93-JobQueue>`_
:wiki:`Job Queue <Extensions-%E2%80%93-JobQueue>`
Args:
application (:class:`telegram.ext.Application`): The application associated with this
@@ -146,9 +145,8 @@ class CallbackContext(Generic[BT, UD, CD, BD]):
""":obj:`ContextTypes.bot_data`: Optional. An object that can be used to keep any data in.
For each update it will be the same :attr:`ContextTypes.bot_data`. Defaults to :obj:`dict`.
.. seealso:: `Storing Bot, User and Chat Related Data <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Storing-bot%2C-user-and-\
chat-related-data>`_,
.. seealso:: :wiki:`Storing Bot, User and Chat Related Data\
<Storing-bot%2C-user-and-chat-related-data>`
"""
return self.application.bot_data
@@ -166,13 +164,11 @@ class CallbackContext(Generic[BT, UD, CD, BD]):
Warning:
When a group chat migrates to a supergroup, its chat id will change and the
``chat_data`` needs to be transferred. For details see our `wiki page
<https://github.com/python-telegram-bot/python-telegram-bot/wiki/
Storing-bot,-user-and-chat-related-data#chat-migration>`_.
``chat_data`` needs to be transferred. For details see our
:wiki:`wiki page <Storing-bot,-user-and-chat-related-data#chat-migration>`.
.. seealso:: `Storing Bot, User and Chat Related Data <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Storing-bot%2C-user-and-\
chat-related-data>`_,
.. seealso:: :wiki:`Storing Bot, User and Chat Related Data\
<Storing-bot%2C-user-and-chat-related-data>`
.. versionchanged:: 20.0
The chat data is now also present in error handlers if the error is caused by a job.
@@ -193,9 +189,8 @@ class CallbackContext(Generic[BT, UD, CD, BD]):
For each update from the same user it will be the same :obj:`ContextTypes.user_data`.
Defaults to :obj:`dict`.
.. seealso:: `Storing Bot, User and Chat Related Data <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Storing-bot%2C-user-and\
-chat-related-data>`_,
.. seealso:: :wiki:`Storing Bot, User and Chat Related Data\
<Storing-bot%2C-user-and-chat-related-data>`
.. versionchanged:: 20.0
The user data is now also present in error handlers if the error is caused by a job.
@@ -244,8 +239,7 @@ class CallbackContext(Generic[BT, UD, CD, BD]):
Will *not* raise exceptions in case the data is not found in the cache.
*Will* raise :exc:`KeyError` in case the callback query can not be found in the cache.
.. seealso:: `Arbitrary callback_data <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Arbitrary-callback_data>`_
.. seealso:: :wiki:`Arbitrary callback_data <Arbitrary-callback_data>`
Args:
callback_query (:class:`telegram.CallbackQuery`): The callback query.
@@ -387,8 +381,7 @@ class CallbackContext(Generic[BT, UD, CD, BD]):
:class:`telegram.ext.JobQueue`: The :class:`JobQueue` used by the
:class:`telegram.ext.Application`.
.. seealso:: `Job Queue <https://github.com/python-telegram-bot/
python-telegram-bot/wiki/Extensions-%E2%80%93-JobQueue>`_
.. seealso:: :wiki:`Job Queue <Extensions-%E2%80%93-JobQueue>`
"""
if self._application._job_queue is None: # pylint: disable=protected-access
warn(
+3 -6
View File
@@ -47,8 +47,7 @@ class InvalidCallbackData(TelegramError):
Examples:
:any:`Arbitrary Callback Data Bot <examples.arbitrarycallbackdatabot>`
.. seealso:: `Arbitrary callback_data <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Arbitrary-callback_data>`_
.. seealso:: :wiki:`Arbitrary callback_data <Arbitrary-callback_data>`
.. versionadded:: 13.6
@@ -118,10 +117,8 @@ class CallbackDataCache:
:any:`Arbitrary Callback Data Bot <examples.arbitrarycallbackdatabot>`
.. seealso:: :attr:`telegram.ext.ExtBot.callback_data_cache`,
`Architecture Overview <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Architecture>`_,
`Arbitrary callback_data <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Arbitrary-callback_data>`_
:wiki:`Architecture Overview <Architecture>`,
:wiki:`Arbitrary callback_data <Arbitrary-callback_data>`
.. versionadded:: 13.6
+2 -4
View File
@@ -81,8 +81,7 @@ class CallbackQueryHandler(BaseHandler[Update, CCT]):
If :attr:`telegram.CallbackQuery.data` is :obj:`None`, the
:class:`telegram.CallbackQuery` update will not be handled.
.. seealso:: `Arbitrary callback_data <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Arbitrary-callback_data>`_
.. seealso:: :wiki:`Arbitrary callback_data <Arbitrary-callback_data>`
.. versionchanged:: 13.6
Added support for arbitrary callback data.
@@ -90,8 +89,7 @@ class CallbackQueryHandler(BaseHandler[Update, CCT]):
be awaited before processing the next handler in
:meth:`telegram.ext.Application.process_update`. Defaults to :obj:`True`.
.. seealso:: `Concurrency <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Concurrency>`_
.. seealso:: :wiki:`Concurrency`
Attributes:
callback (:term:`coroutine function`): The callback function for this handler.
+1 -2
View File
@@ -66,8 +66,7 @@ class ChatJoinRequestHandler(BaseHandler[Update, CCT]):
be awaited before processing the next handler in
:meth:`telegram.ext.Application.process_update`. Defaults to :obj:`True`.
.. seealso:: `Concurrency <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Concurrency>`_
.. seealso:: :wiki:`Concurrency`
Attributes:
callback (:term:`coroutine function`): The callback function for this handler.
+1 -2
View File
@@ -57,8 +57,7 @@ class ChatMemberHandler(BaseHandler[Update, CCT]):
be awaited before processing the next handler in
:meth:`telegram.ext.Application.process_update`. Defaults to :obj:`True`.
.. seealso:: `Concurrency <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Concurrency>`_
.. seealso:: :wiki:`Concurrency`
Attributes:
callback (:term:`coroutine function`): The callback function for this handler.
+1 -2
View File
@@ -53,8 +53,7 @@ class ChosenInlineResultHandler(BaseHandler[Update, CCT]):
be awaited before processing the next handler in
:meth:`telegram.ext.Application.process_update`. Defaults to :obj:`True`.
.. seealso:: `Concurrency <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Concurrency>`_
.. seealso:: :wiki:`Concurrency`
pattern (:obj:`str` | :func:`re.Pattern <re.compile>`, optional): Regex pattern. If not
:obj:`None`, :func:`re.match`
is used on :attr:`telegram.ChosenInlineResult.result_id` to determine if an update
+1 -2
View File
@@ -87,8 +87,7 @@ class CommandHandler(BaseHandler[Update, CCT]):
be awaited before processing the next handler in
:meth:`telegram.ext.Application.process_update`. Defaults to :obj:`True`.
.. seealso:: `Concurrency <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Concurrency>`_
.. seealso:: :wiki:`Concurrency`
Raises:
:exc:`ValueError`: When the command is too long or has illegal chars.
+2 -4
View File
@@ -36,10 +36,8 @@ class ContextTypes(Generic[CCT, UD, CD, BD]):
Examples:
:any:`ContextTypes Bot <examples.contexttypesbot>`
.. seealso:: `Architecture Overview <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Architecture>`_,
`Storing Bot, User and Chat Related Data <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Storing-bot%2C-user-and-chat-related-data>`_
.. seealso:: :wiki:`Architecture Overview <Architecture>`,
:wiki:`Storing Bot, User and Chat Related Data <Storing-bot%2C-user-and-chat-related-data>`
.. versionadded:: 13.6
+1 -2
View File
@@ -250,8 +250,7 @@ class ConversationHandler(BaseHandler[Update, CCT]):
2. the value passed to this parameter (if any)
3. :attr:`telegram.ext.Defaults.block` (if defaults are used)
.. seealso:: `Concurrency <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Concurrency>`_
.. seealso:: :wiki:`Concurrency`
.. versionchanged:: 20.0
No longer overrides the handlers settings. Resolution order was changed.
+2 -4
View File
@@ -26,10 +26,8 @@ from telegram._utils.datetime import UTC
class Defaults:
"""Convenience Class to gather all parameters with a (user defined) default value
.. seealso:: `Architecture Overview <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Architecture>`_,
`Adding Defaults to Your Bot <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Adding-defaults-to-your-bot>`_
.. seealso:: :wiki:`Architecture Overview <Architecture>`,
:wiki:`Adding Defaults to Your Bot <Adding-defaults-to-your-bot>`
.. versionchanged:: 20.0
Removed the argument and attribute ``timeout``. Specify default timeout behavior for the
+1 -2
View File
@@ -43,8 +43,7 @@ class DictPersistence(BasePersistence):
* This implementation of :class:`BasePersistence` does not handle data that cannot be
serialized by :func:`json.dumps`.
.. seealso:: `Making Your Bot Persistent <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Making-your-bot-persistent>`_
.. seealso:: :wiki:`Making Your Bot Persistent <Making-your-bot-persistent>`
.. versionchanged:: 20.0
The parameters and attributes ``store_*_data`` were replaced by :attr:`store_data`.
+2 -4
View File
@@ -123,8 +123,7 @@ class ExtBot(Bot, Generic[RLARGS]):
Examples:
:any:`Arbitrary Callback Data Bot <examples.arbitrarycallbackdatabot>`
.. seealso:: `Arbitrary callback_data <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Arbitrary-callback_data>`_
.. seealso:: :wiki:`Arbitrary callback_data <Arbitrary-callback_data>`
.. versionadded:: 13.6
@@ -141,8 +140,7 @@ class ExtBot(Bot, Generic[RLARGS]):
Pass an integer to specify the maximum number of objects cached in memory.
Defaults to :obj:`False`.
.. seealso:: `Arbitrary callback_data <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Arbitrary-callback_data>`_
.. seealso:: :wiki:`Arbitrary callback_data <Arbitrary-callback_data>`
rate_limiter (:class:`telegram.ext.BaseRateLimiter`, optional): A rate limiter to use for
limiting the number of requests made by the bot per time interval.
+2 -4
View File
@@ -54,8 +54,7 @@ class BaseHandler(Generic[UT, CCT], ABC):
also used for the mentioned method arguments. That way, a type checker can check whether
this handler fits the definition of the :class:`~Application`.
.. seealso:: `Types of Handlers <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Types-of-Handlers>`_
.. seealso:: :wiki:`Types of Handlers <Types-of-Handlers>`
.. versionchanged:: 20.0
@@ -75,8 +74,7 @@ class BaseHandler(Generic[UT, CCT], ABC):
be awaited before processing the next handler in
:meth:`telegram.ext.Application.process_update`. Defaults to :obj:`True`.
.. seealso:: `Concurrency <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Concurrency>`_
.. seealso:: :wiki:`Concurrency`
Attributes:
callback (:term:`coroutine function`): The callback function for this handler.
+1 -2
View File
@@ -66,8 +66,7 @@ class InlineQueryHandler(BaseHandler[Update, CCT]):
be awaited before processing the next handler in
:meth:`telegram.ext.Application.process_update`. Defaults to :obj:`True`.
.. seealso:: `Concurrency <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Concurrency>`_
.. seealso:: :wiki:`Concurrency`
chat_types (List[:obj:`str`], optional): List of allowed chat types. If passed, will only
handle inline queries with the appropriate :attr:`telegram.InlineQuery.chat_type`.
+3 -6
View File
@@ -58,10 +58,8 @@ class JobQueue:
.. seealso:: :attr:`telegram.ext.Application.job_queue`,
:attr:`telegram.ext.CallbackContext.job_queue`,
`Architecture Overview <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Architecture>`_,
`Job Queue <https://github.com/python-telegram-bot/
python-telegram-bot/wiki/Extensions-%E2%80%93-JobQueue>`_
:wiki:`Architecture Overview <Architecture>`,
:wiki:`Job Queue <Extensions-%E2%80%93-JobQueue>`
.. versionchanged:: 20.0
To use this class, PTB must be installed via
@@ -643,8 +641,7 @@ class Job:
This class should not be instantiated manually.
Use the methods of :class:`telegram.ext.JobQueue` to schedule jobs.
.. seealso:: `Job Queue <https://github.com/python-telegram-bot/
python-telegram-bot/wiki/Extensions-%E2%80%93-JobQueue>`_
.. seealso:: :wiki:`Job Queue <Extensions-%E2%80%93-JobQueue>`
.. versionchanged:: 20.0
+2 -4
View File
@@ -47,8 +47,7 @@ class MessageHandler(BaseHandler[Update, CCT]):
operators (& for and, | for or, ~ for not). Passing :obj:`None` is a shortcut
to passing :class:`telegram.ext.filters.ALL`.
.. seealso:: `Advanced Filters <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Extensions--Advanced-Filters>`_
.. seealso:: :wiki:`Advanced Filters <Extensions--Advanced-Filters>`
callback (:term:`coroutine function`): The callback function for this handler. Will be
called when :meth:`check_update` has determined that an update should be processed by
this handler. Callback signature::
@@ -61,8 +60,7 @@ class MessageHandler(BaseHandler[Update, CCT]):
be awaited before processing the next handler in
:meth:`telegram.ext.Application.process_update`. Defaults to :obj:`True`.
.. seealso:: `Concurrency <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Concurrency>`_
.. seealso:: :wiki:`Concurrency`
Attributes:
filters (:class:`telegram.ext.filters.BaseFilter`): Only allow updates with these Filters.
+1 -2
View File
@@ -136,8 +136,7 @@ class PicklePersistence(BasePersistence[UD, CD, BD]):
Examples:
:any:`Persistent Conversation Bot <examples.persistentconversationbot>`
.. seealso:: `Making Your Bot Persistent <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Making-your-bot-persistent>`_
.. seealso:: :wiki:`Making Your Bot Persistent <Making-your-bot-persistent>`
.. versionchanged:: 20.0
+1 -2
View File
@@ -48,8 +48,7 @@ class PollAnswerHandler(BaseHandler[Update, CCT]):
be awaited before processing the next handler in
:meth:`telegram.ext.Application.process_update`. Defaults to :obj:`True`.
.. seealso:: `Concurrency <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Concurrency>`_
.. seealso:: :wiki:`Concurrency`
Attributes:
callback (:term:`coroutine function`): The callback function for this handler.
+1 -2
View File
@@ -48,8 +48,7 @@ class PollHandler(BaseHandler[Update, CCT]):
be awaited before processing the next handler in
:meth:`telegram.ext.Application.process_update`. Defaults to :obj:`True`.
.. seealso:: `Concurrency <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Concurrency>`_
.. seealso:: :wiki:`Concurrency`
Attributes:
callback (:term:`coroutine function`): The callback function for this handler.
+1 -2
View File
@@ -47,8 +47,7 @@ class PreCheckoutQueryHandler(BaseHandler[Update, CCT]):
be awaited before processing the next handler in
:meth:`telegram.ext.Application.process_update`. Defaults to :obj:`True`.
.. seealso:: `Concurrency <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Concurrency>`_
.. seealso:: :wiki:`Concurrency`
Attributes:
callback (:term:`coroutine function`): The callback function for this handler.
+1 -2
View File
@@ -105,8 +105,7 @@ class PrefixHandler(BaseHandler[Update, CCT]):
be awaited before processing the next handler in
:meth:`telegram.ext.Application.process_update`. Defaults to :obj:`True`.
.. seealso:: `Concurrency <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Concurrency>`_
.. seealso:: :wiki:`Concurrency`
Attributes:
commands (FrozenSet[:obj:`str`]): The commands that this handler will listen for, i.e. the
+1 -2
View File
@@ -47,8 +47,7 @@ class ShippingQueryHandler(BaseHandler[Update, CCT]):
be awaited before processing the next handler in
:meth:`telegram.ext.Application.process_update`. Defaults to :obj:`True`.
.. seealso:: `Concurrency <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Concurrency>`_
.. seealso:: :wiki:`Concurrency`
Attributes:
callback (:term:`coroutine function`): The callback function for this handler.
+1 -2
View File
@@ -57,8 +57,7 @@ class StringCommandHandler(BaseHandler[str, CCT]):
be awaited before processing the next handler in
:meth:`telegram.ext.Application.process_update`. Defaults to :obj:`True`.
.. seealso:: `Concurrency <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Concurrency>`_
.. seealso:: :wiki:`Concurrency`
Attributes:
command (:obj:`str`): The command this handler should listen for.

Some files were not shown because too many files have changed in this diff Show More