mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-12-22 22:45:09 +01:00
Co-authored-by: Harshil <37377066+harshil21@users.noreply.github.com> Co-authored-by: Dmitry K <58207913+lemontree210@users.noreply.github.com> Co-authored-by: Trim21 <trim21.me@gmail.com> Co-authored-by: aelkheir <90580077+aelkheir@users.noreply.github.com>
This commit is contained in:
parent
644d76b592
commit
40ab8aadca
27 changed files with 83 additions and 41 deletions
1
.github/CONTRIBUTING.rst
vendored
1
.github/CONTRIBUTING.rst
vendored
|
@ -167,6 +167,7 @@ Feel free to copy (parts of) the checklist to the PR description to remind you o
|
||||||
**If the PR contains API changes (otherwise, you can ignore this passage)**
|
**If the PR contains API changes (otherwise, you can ignore this passage)**
|
||||||
|
|
||||||
- Checked the Bot API specific sections of the `Stability Policy <https://docs.python-telegram-bot.org/stability_policy.html>`_
|
- Checked the Bot API specific sections of the `Stability Policy <https://docs.python-telegram-bot.org/stability_policy.html>`_
|
||||||
|
- Created a PR to remove functionality deprecated in the previous Bot API release (`see here <https://docs.python-telegram-bot.org/en/stable/stability_policy.html#case-2>`_)
|
||||||
|
|
||||||
- New classes:
|
- New classes:
|
||||||
|
|
||||||
|
|
2
.github/pull_request_template.md
vendored
2
.github/pull_request_template.md
vendored
|
@ -1,6 +1,6 @@
|
||||||
<!--
|
<!--
|
||||||
Hey! You're PRing? Cool!
|
Hey! You're PRing? Cool!
|
||||||
Please be sure to check out our contribution guide (https://github.com/python-telegram-bot/python-telegram-bot/blob/master/.github/CONTRIBUTING.rst).
|
Please be sure to check out our contribution guide (https://github.com/python-telegram-bot/python-telegram-bot/blob/master/.github/CONTRIBUTING.rst).
|
||||||
Especially, please have a look at the check list for PRs (https://github.com/python-telegram-bot/python-telegram-bot/blob/master/.github/CONTRIBUTING.rst#checklist-for-prs). Feel free to copy (parts of) the checklist to the PR description to remind you or the maintainers of open points or if you have questions on anything.
|
Especially, please have a look at the check list for PRs (https://github.com/python-telegram-bot/python-telegram-bot/blob/master/.github/CONTRIBUTING.rst#check-list-for-prs). Feel free to copy (parts of) the checklist to the PR description to remind you or the maintainers of open points or if you have questions on anything.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ Contributors
|
||||||
|
|
||||||
The following wonderful people contributed directly or indirectly to this project:
|
The following wonderful people contributed directly or indirectly to this project:
|
||||||
|
|
||||||
|
- `Abdelrahman <https://github.com/aelkheir>`_
|
||||||
- `Abshar <https://github.com/abxhr>`_
|
- `Abshar <https://github.com/abxhr>`_
|
||||||
- `Alateas <https://github.com/alateas>`_
|
- `Alateas <https://github.com/alateas>`_
|
||||||
- `Ales Dokshanin <https://github.com/alesdokshanin>`_
|
- `Ales Dokshanin <https://github.com/alesdokshanin>`_
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
:target: https://www.gnu.org/licenses/lgpl-3.0.html
|
:target: https://www.gnu.org/licenses/lgpl-3.0.html
|
||||||
:alt: LGPLv3 License
|
:alt: LGPLv3 License
|
||||||
|
|
||||||
.. image:: https://github.com/python-telegram-bot/python-telegram-bot/workflows/GitHub%20Actions/badge.svg
|
.. image:: https://github.com/python-telegram-bot/python-telegram-bot/workflows/Unit%20Tests/badge.svg
|
||||||
:target: https://github.com/python-telegram-bot/python-telegram-bot/
|
:target: https://github.com/python-telegram-bot/python-telegram-bot/
|
||||||
:alt: Github Actions workflow
|
:alt: Github Actions workflow
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
:target: https://www.gnu.org/licenses/lgpl-3.0.html
|
:target: https://www.gnu.org/licenses/lgpl-3.0.html
|
||||||
:alt: LGPLv3 License
|
:alt: LGPLv3 License
|
||||||
|
|
||||||
.. image:: https://github.com/python-telegram-bot/python-telegram-bot/workflows/GitHub%20Actions/badge.svg
|
.. image:: https://github.com/python-telegram-bot/python-telegram-bot/workflows/Unit%20Tests/badge.svg
|
||||||
:target: https://github.com/python-telegram-bot/python-telegram-bot/
|
:target: https://github.com/python-telegram-bot/python-telegram-bot/
|
||||||
:alt: Github Actions workflow
|
:alt: Github Actions workflow
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ keyword_args = [
|
||||||
]
|
]
|
||||||
write_timeout_sub = [":attr:`~telegram.request.BaseRequest.DEFAULT_NONE`", "``20``"]
|
write_timeout_sub = [":attr:`~telegram.request.BaseRequest.DEFAULT_NONE`", "``20``"]
|
||||||
read_timeout_sub = [
|
read_timeout_sub = [
|
||||||
":attr:`~telegram.request.BaseRequest.DEFAULT_NONE`.",
|
":attr:`~telegram.request.BaseRequest.DEFAULT_NONE`",
|
||||||
"``2``. :paramref:`timeout` will be added to this value",
|
"``2``. :paramref:`timeout` will be added to this value",
|
||||||
]
|
]
|
||||||
read_timeout_type = [":obj:`float` | :obj:`None`", ":obj:`float`"]
|
read_timeout_type = [":obj:`float` | :obj:`None`", ":obj:`float`"]
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
sphinx==7.2.5
|
sphinx==7.2.5
|
||||||
sphinx-pypi-upload
|
sphinx-pypi-upload
|
||||||
furo==2023.8.19
|
furo==2023.8.19
|
||||||
git+https://github.com/harshil21/furo-sphinx-search@01efc7be422d7dc02390aab9be68d6f5ce1a5618#egg=furo-sphinx-search
|
git+https://github.com/harshil21/furo-sphinx-search@v0.2.0.1
|
||||||
sphinx-paramlinks==0.6.0
|
sphinx-paramlinks==0.6.0
|
||||||
sphinxcontrib-mermaid==0.9.2
|
sphinxcontrib-mermaid==0.9.2
|
||||||
sphinx-copybutton==0.5.2
|
sphinx-copybutton==0.5.2
|
||||||
|
|
|
@ -23,7 +23,7 @@ author = "Leandro Toledo"
|
||||||
# The short X.Y version.
|
# The short X.Y version.
|
||||||
version = "20.4" # telegram.__version__[:3]
|
version = "20.4" # telegram.__version__[:3]
|
||||||
# The full version, including alpha/beta/rc tags.
|
# The full version, including alpha/beta/rc tags.
|
||||||
release = "20.3" # telegram.__version__
|
release = "20.4" # telegram.__version__
|
||||||
|
|
||||||
# If your documentation needs a minimal Sphinx version, state it here.
|
# If your documentation needs a minimal Sphinx version, state it here.
|
||||||
needs_sphinx = "6.1.3"
|
needs_sphinx = "6.1.3"
|
||||||
|
|
|
@ -57,3 +57,5 @@
|
||||||
.. |captionentitiesattr| replace:: Tuple of special entities that appear in the caption, which can be specified instead of ``parse_mode``.
|
.. |captionentitiesattr| replace:: Tuple of special entities that appear in the caption, which can be specified instead of ``parse_mode``.
|
||||||
|
|
||||||
.. |datetime_localization| replace:: The default timezone of the bot is used for localization, which is UTC unless :attr:`telegram.ext.Defaults.tzinfo` is used.
|
.. |datetime_localization| replace:: The default timezone of the bot is used for localization, which is UTC unless :attr:`telegram.ext.Defaults.tzinfo` is used.
|
||||||
|
|
||||||
|
.. |post_methods_note| replace:: If you implement custom logic that implies that you will **not** be using :class:`~telegram.ext.Application`'s methods :meth:`~telegram.ext.Application.run_polling` or :meth:`~telegram.ext.Application.run_webhook` to run your application (like it's done in `Custom Webhook Bot Example <https://docs.python-telegram-bot.org/en/stable/examples.customwebhookbot.html>`__), the callback you set in this method **will not be called automatically**. So instead of setting a callback with this method, you have to explicitly ``await`` the function that you want to run at this stage of your application's life (in the `example mentioned above <https://docs.python-telegram-bot.org/en/stable/examples.customwebhookbot.html>`__, that would be in ``async with application`` context manager).
|
||||||
|
|
|
@ -40,11 +40,13 @@ class MessageEntity(TelegramObject):
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
type (:obj:`str`): Type of the entity. Can be :attr:`MENTION` (@username),
|
type (:obj:`str`): Type of the entity. Can be :attr:`MENTION` (@username),
|
||||||
:attr:`HASHTAG`, :attr:`BOT_COMMAND`,
|
:attr:`HASHTAG` (#hashtag), :attr:`CASHTAG` ($USD), :attr:`BOT_COMMAND`
|
||||||
:attr:`URL`, :attr:`EMAIL`, :attr:`PHONE_NUMBER`, :attr:`BOLD` (bold text),
|
(/start@jobs_bot), :attr:`URL` (https://telegram.org),
|
||||||
:attr:`ITALIC` (italic text), :attr:`STRIKETHROUGH`, :attr:`SPOILER` (spoiler message),
|
:attr:`EMAIL` (do-not-reply@telegram.org), :attr:`PHONE_NUMBER` (+1-212-555-0123),
|
||||||
:attr:`CODE` (monowidth string), :attr:`PRE` (monowidth block), :attr:`TEXT_LINK` (for
|
:attr:`BOLD` (**bold text**), :attr:`ITALIC` (*italic text*), :attr:`UNDERLINE`
|
||||||
clickable text URLs), :attr:`TEXT_MENTION` (for users without usernames),
|
(underlined text), :attr:`STRIKETHROUGH`, :attr:`SPOILER` (spoiler message),
|
||||||
|
:attr:`CODE` (monowidth string), :attr:`PRE` (monowidth block), :attr:`TEXT_LINK`
|
||||||
|
(for clickable text URLs), :attr:`TEXT_MENTION` (for users without usernames),
|
||||||
:attr:`CUSTOM_EMOJI` (for inline custom emoji stickers).
|
:attr:`CUSTOM_EMOJI` (for inline custom emoji stickers).
|
||||||
|
|
||||||
.. versionadded:: 20.0
|
.. versionadded:: 20.0
|
||||||
|
@ -64,11 +66,13 @@ class MessageEntity(TelegramObject):
|
||||||
.. versionadded:: 20.0
|
.. versionadded:: 20.0
|
||||||
Attributes:
|
Attributes:
|
||||||
type (:obj:`str`): Type of the entity. Can be :attr:`MENTION` (@username),
|
type (:obj:`str`): Type of the entity. Can be :attr:`MENTION` (@username),
|
||||||
:attr:`HASHTAG`, :attr:`BOT_COMMAND`,
|
:attr:`HASHTAG` (#hashtag), :attr:`CASHTAG` ($USD), :attr:`BOT_COMMAND`
|
||||||
:attr:`URL`, :attr:`EMAIL`, :attr:`PHONE_NUMBER`, :attr:`BOLD` (bold text),
|
(/start@jobs_bot), :attr:`URL` (https://telegram.org),
|
||||||
:attr:`ITALIC` (italic text), :attr:`STRIKETHROUGH`, :attr:`SPOILER` (spoiler message),
|
:attr:`EMAIL` (do-not-reply@telegram.org), :attr:`PHONE_NUMBER` (+1-212-555-0123),
|
||||||
:attr:`CODE` (monowidth string), :attr:`PRE` (monowidth block), :attr:`TEXT_LINK` (for
|
:attr:`BOLD` (**bold text**), :attr:`ITALIC` (*italic text*), :attr:`UNDERLINE`
|
||||||
clickable text URLs), :attr:`TEXT_MENTION` (for users without usernames),
|
(underlined text), :attr:`STRIKETHROUGH`, :attr:`SPOILER` (spoiler message),
|
||||||
|
:attr:`CODE` (monowidth string), :attr:`PRE` (monowidth block), :attr:`TEXT_LINK`
|
||||||
|
(for clickable text URLs), :attr:`TEXT_MENTION` (for users without usernames),
|
||||||
:attr:`CUSTOM_EMOJI` (for inline custom emoji stickers).
|
:attr:`CUSTOM_EMOJI` (for inline custom emoji stickers).
|
||||||
|
|
||||||
.. versionadded:: 20.0
|
.. versionadded:: 20.0
|
||||||
|
|
|
@ -127,6 +127,9 @@ class NetworkError(TelegramError):
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
:any:`Raw API Bot <examples.rawapibot>`
|
:any:`Raw API Bot <examples.rawapibot>`
|
||||||
|
|
||||||
|
.. seealso::
|
||||||
|
:wiki:`Handling network errors <Handling-network-errors>`
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__slots__ = ()
|
__slots__ = ()
|
||||||
|
@ -141,6 +144,9 @@ class BadRequest(NetworkError):
|
||||||
class TimedOut(NetworkError):
|
class TimedOut(NetworkError):
|
||||||
"""Raised when a request took too long to finish.
|
"""Raised when a request took too long to finish.
|
||||||
|
|
||||||
|
.. seealso::
|
||||||
|
:wiki:`Handling network errors <Handling-network-errors>`
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
message (:obj:`str`, optional): Any additional information about the exception.
|
message (:obj:`str`, optional): Any additional information about the exception.
|
||||||
|
|
||||||
|
|
|
@ -693,7 +693,7 @@ class Application(Generic[BT, CCT, UD, CD, BD, JQ], AsyncContextManager["Applica
|
||||||
On unix, the app will also shut down on receiving the signals specified by
|
On unix, the app will also shut down on receiving the signals specified by
|
||||||
:paramref:`stop_signals`.
|
:paramref:`stop_signals`.
|
||||||
|
|
||||||
The order of execution by `run_polling` is roughly as follows:
|
The order of execution by :meth:`run_polling` is roughly as follows:
|
||||||
|
|
||||||
- :meth:`initialize`
|
- :meth:`initialize`
|
||||||
- :meth:`post_init`
|
- :meth:`post_init`
|
||||||
|
@ -708,11 +708,6 @@ class Application(Generic[BT, CCT, UD, CD, BD, JQ], AsyncContextManager["Applica
|
||||||
|
|
||||||
.. include:: inclusions/application_run_tip.rst
|
.. include:: inclusions/application_run_tip.rst
|
||||||
|
|
||||||
.. seealso::
|
|
||||||
:meth:`initialize`, :meth:`start`, :meth:`stop`, :meth:`shutdown`
|
|
||||||
:meth:`telegram.ext.Updater.start_polling`, :meth:`telegram.ext.Updater.stop`,
|
|
||||||
:meth:`run_webhook`
|
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
poll_interval (:obj:`float`, optional): Time to wait between polling updates from
|
poll_interval (:obj:`float`, optional): Time to wait between polling updates from
|
||||||
Telegram in seconds. Default is ``0.0``.
|
Telegram in seconds. Default is ``0.0``.
|
||||||
|
@ -816,7 +811,7 @@ class Application(Generic[BT, CCT, UD, CD, BD, JQ], AsyncContextManager["Applica
|
||||||
``https://listen:port/url_path``. Also calls :meth:`telegram.Bot.set_webhook` as
|
``https://listen:port/url_path``. Also calls :meth:`telegram.Bot.set_webhook` as
|
||||||
required.
|
required.
|
||||||
|
|
||||||
The order of execution by `run_webhook` is roughly as follows:
|
The order of execution by :meth:`run_webhook` is roughly as follows:
|
||||||
|
|
||||||
- :meth:`initialize`
|
- :meth:`initialize`
|
||||||
- :meth:`post_init`
|
- :meth:`post_init`
|
||||||
|
@ -840,9 +835,7 @@ class Application(Generic[BT, CCT, UD, CD, BD, JQ], AsyncContextManager["Applica
|
||||||
.. include:: inclusions/application_run_tip.rst
|
.. include:: inclusions/application_run_tip.rst
|
||||||
|
|
||||||
.. seealso::
|
.. seealso::
|
||||||
:meth:`initialize`, :meth:`start`, :meth:`stop`, :meth:`shutdown`
|
:wiki:`Webhooks`
|
||||||
:meth:`telegram.ext.Updater.start_webhook`, :meth:`telegram.ext.Updater.stop`,
|
|
||||||
:meth:`run_polling`, :wiki:`Webhooks`
|
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
listen (:obj:`str`, optional): IP-Address to listen on. Defaults to
|
listen (:obj:`str`, optional): IP-Address to listen on. Defaults to
|
||||||
|
|
|
@ -473,6 +473,8 @@ class ApplicationBuilder(Generic[BT, CCT, UD, CD, BD, JQ]):
|
||||||
|
|
||||||
.. include:: inclusions/pool_size_tip.rst
|
.. include:: inclusions/pool_size_tip.rst
|
||||||
|
|
||||||
|
.. seealso:: :meth:`get_updates_connection_pool_size`
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
connection_pool_size (:obj:`int`): The size of the connection pool.
|
connection_pool_size (:obj:`int`): The size of the connection pool.
|
||||||
|
|
||||||
|
@ -487,6 +489,9 @@ class ApplicationBuilder(Generic[BT, CCT, UD, CD, BD, JQ]):
|
||||||
"""Sets the proxy for the :paramref:`~telegram.request.HTTPXRequest.proxy_url`
|
"""Sets the proxy for the :paramref:`~telegram.request.HTTPXRequest.proxy_url`
|
||||||
parameter of :attr:`telegram.Bot.request`. Defaults to :obj:`None`.
|
parameter of :attr:`telegram.Bot.request`. Defaults to :obj:`None`.
|
||||||
|
|
||||||
|
|
||||||
|
.. seealso:: :meth:`get_updates_proxy_url`
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
proxy_url (:obj:`str`): The URL to the proxy server. See
|
proxy_url (:obj:`str`): The URL to the proxy server. See
|
||||||
:paramref:`telegram.request.HTTPXRequest.proxy_url` for more information.
|
:paramref:`telegram.request.HTTPXRequest.proxy_url` for more information.
|
||||||
|
@ -503,6 +508,8 @@ class ApplicationBuilder(Generic[BT, CCT, UD, CD, BD, JQ]):
|
||||||
:paramref:`~telegram.request.HTTPXRequest.connect_timeout` parameter of
|
:paramref:`~telegram.request.HTTPXRequest.connect_timeout` parameter of
|
||||||
:attr:`telegram.Bot.request`. Defaults to ``5.0``.
|
:attr:`telegram.Bot.request`. Defaults to ``5.0``.
|
||||||
|
|
||||||
|
.. seealso:: :meth:`get_updates_connect_timeout`
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
connect_timeout (:obj:`float`): See
|
connect_timeout (:obj:`float`): See
|
||||||
:paramref:`telegram.request.HTTPXRequest.connect_timeout` for more information.
|
:paramref:`telegram.request.HTTPXRequest.connect_timeout` for more information.
|
||||||
|
@ -519,6 +526,8 @@ class ApplicationBuilder(Generic[BT, CCT, UD, CD, BD, JQ]):
|
||||||
:paramref:`~telegram.request.HTTPXRequest.read_timeout` parameter of
|
:paramref:`~telegram.request.HTTPXRequest.read_timeout` parameter of
|
||||||
:attr:`telegram.Bot.request`. Defaults to ``5.0``.
|
:attr:`telegram.Bot.request`. Defaults to ``5.0``.
|
||||||
|
|
||||||
|
.. seealso:: :meth:`get_updates_read_timeout`
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
read_timeout (:obj:`float`): See
|
read_timeout (:obj:`float`): See
|
||||||
:paramref:`telegram.request.HTTPXRequest.read_timeout` for more information.
|
:paramref:`telegram.request.HTTPXRequest.read_timeout` for more information.
|
||||||
|
@ -535,6 +544,8 @@ class ApplicationBuilder(Generic[BT, CCT, UD, CD, BD, JQ]):
|
||||||
:paramref:`~telegram.request.HTTPXRequest.write_timeout` parameter of
|
:paramref:`~telegram.request.HTTPXRequest.write_timeout` parameter of
|
||||||
:attr:`telegram.Bot.request`. Defaults to ``5.0``.
|
:attr:`telegram.Bot.request`. Defaults to ``5.0``.
|
||||||
|
|
||||||
|
.. seealso:: :meth:`get_updates_write_timeout`
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
write_timeout (:obj:`float`): See
|
write_timeout (:obj:`float`): See
|
||||||
:paramref:`telegram.request.HTTPXRequest.write_timeout` for more information.
|
:paramref:`telegram.request.HTTPXRequest.write_timeout` for more information.
|
||||||
|
@ -553,6 +564,8 @@ class ApplicationBuilder(Generic[BT, CCT, UD, CD, BD, JQ]):
|
||||||
|
|
||||||
.. include:: inclusions/pool_size_tip.rst
|
.. include:: inclusions/pool_size_tip.rst
|
||||||
|
|
||||||
|
.. seealso:: :meth:`get_updates_pool_timeout`
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
pool_timeout (:obj:`float`): See
|
pool_timeout (:obj:`float`): See
|
||||||
:paramref:`telegram.request.HTTPXRequest.pool_timeout` for more information.
|
:paramref:`telegram.request.HTTPXRequest.pool_timeout` for more information.
|
||||||
|
@ -629,6 +642,8 @@ class ApplicationBuilder(Generic[BT, CCT, UD, CD, BD, JQ]):
|
||||||
:paramref:`telegram.request.HTTPXRequest.connection_pool_size` parameter which is used
|
:paramref:`telegram.request.HTTPXRequest.connection_pool_size` parameter which is used
|
||||||
for the :meth:`telegram.Bot.get_updates` request. Defaults to ``1``.
|
for the :meth:`telegram.Bot.get_updates` request. Defaults to ``1``.
|
||||||
|
|
||||||
|
.. seealso:: :meth:`connection_pool_size`
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
get_updates_connection_pool_size (:obj:`int`): The size of the connection pool.
|
get_updates_connection_pool_size (:obj:`int`): The size of the connection pool.
|
||||||
|
|
||||||
|
@ -643,6 +658,9 @@ class ApplicationBuilder(Generic[BT, CCT, UD, CD, BD, JQ]):
|
||||||
"""Sets the proxy for the :paramref:`telegram.request.HTTPXRequest.proxy_url`
|
"""Sets the proxy for the :paramref:`telegram.request.HTTPXRequest.proxy_url`
|
||||||
parameter which is used for :meth:`telegram.Bot.get_updates`. Defaults to :obj:`None`.
|
parameter which is used for :meth:`telegram.Bot.get_updates`. Defaults to :obj:`None`.
|
||||||
|
|
||||||
|
|
||||||
|
.. seealso:: :meth:`proxy_url`
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
get_updates_proxy_url (:obj:`str`): The URL to the proxy server. See
|
get_updates_proxy_url (:obj:`str`): The URL to the proxy server. See
|
||||||
:paramref:`telegram.request.HTTPXRequest.proxy_url` for more information.
|
:paramref:`telegram.request.HTTPXRequest.proxy_url` for more information.
|
||||||
|
@ -661,6 +679,8 @@ class ApplicationBuilder(Generic[BT, CCT, UD, CD, BD, JQ]):
|
||||||
:paramref:`telegram.request.HTTPXRequest.connect_timeout` parameter which is used for
|
:paramref:`telegram.request.HTTPXRequest.connect_timeout` parameter which is used for
|
||||||
the :meth:`telegram.Bot.get_updates` request. Defaults to ``5.0``.
|
the :meth:`telegram.Bot.get_updates` request. Defaults to ``5.0``.
|
||||||
|
|
||||||
|
.. seealso:: :meth:`connect_timeout`
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
get_updates_connect_timeout (:obj:`float`): See
|
get_updates_connect_timeout (:obj:`float`): See
|
||||||
:paramref:`telegram.request.HTTPXRequest.connect_timeout` for more information.
|
:paramref:`telegram.request.HTTPXRequest.connect_timeout` for more information.
|
||||||
|
@ -679,6 +699,8 @@ class ApplicationBuilder(Generic[BT, CCT, UD, CD, BD, JQ]):
|
||||||
:paramref:`telegram.request.HTTPXRequest.read_timeout` parameter which is used for the
|
:paramref:`telegram.request.HTTPXRequest.read_timeout` parameter which is used for the
|
||||||
:meth:`telegram.Bot.get_updates` request. Defaults to ``5.0``.
|
:meth:`telegram.Bot.get_updates` request. Defaults to ``5.0``.
|
||||||
|
|
||||||
|
.. seealso:: :meth:`read_timeout`
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
get_updates_read_timeout (:obj:`float`): See
|
get_updates_read_timeout (:obj:`float`): See
|
||||||
:paramref:`telegram.request.HTTPXRequest.read_timeout` for more information.
|
:paramref:`telegram.request.HTTPXRequest.read_timeout` for more information.
|
||||||
|
@ -697,6 +719,8 @@ class ApplicationBuilder(Generic[BT, CCT, UD, CD, BD, JQ]):
|
||||||
:paramref:`telegram.request.HTTPXRequest.write_timeout` parameter which is used for
|
:paramref:`telegram.request.HTTPXRequest.write_timeout` parameter which is used for
|
||||||
the :meth:`telegram.Bot.get_updates` request. Defaults to ``5.0``.
|
the :meth:`telegram.Bot.get_updates` request. Defaults to ``5.0``.
|
||||||
|
|
||||||
|
.. seealso:: :meth:`write_timeout`
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
get_updates_write_timeout (:obj:`float`): See
|
get_updates_write_timeout (:obj:`float`): See
|
||||||
:paramref:`telegram.request.HTTPXRequest.write_timeout` for more information.
|
:paramref:`telegram.request.HTTPXRequest.write_timeout` for more information.
|
||||||
|
@ -715,6 +739,8 @@ class ApplicationBuilder(Generic[BT, CCT, UD, CD, BD, JQ]):
|
||||||
:paramref:`~telegram.request.HTTPXRequest.pool_timeout` parameter which is used for the
|
:paramref:`~telegram.request.HTTPXRequest.pool_timeout` parameter which is used for the
|
||||||
:meth:`telegram.Bot.get_updates` request. Defaults to ``1.0``.
|
:meth:`telegram.Bot.get_updates` request. Defaults to ``1.0``.
|
||||||
|
|
||||||
|
.. seealso:: :meth:`pool_timeout`
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
get_updates_pool_timeout (:obj:`float`): See
|
get_updates_pool_timeout (:obj:`float`): See
|
||||||
:paramref:`telegram.request.HTTPXRequest.pool_timeout` for more information.
|
:paramref:`telegram.request.HTTPXRequest.pool_timeout` for more information.
|
||||||
|
@ -1099,6 +1125,9 @@ class ApplicationBuilder(Generic[BT, CCT, UD, CD, BD, JQ]):
|
||||||
|
|
||||||
application = Application.builder().token("TOKEN").post_init(post_init).build()
|
application = Application.builder().token("TOKEN").post_init(post_init).build()
|
||||||
|
|
||||||
|
Note:
|
||||||
|
|post_methods_note|
|
||||||
|
|
||||||
.. seealso:: :meth:`post_stop`, :meth:`post_shutdown`
|
.. seealso:: :meth:`post_stop`, :meth:`post_shutdown`
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
@ -1137,6 +1166,9 @@ class ApplicationBuilder(Generic[BT, CCT, UD, CD, BD, JQ]):
|
||||||
.post_shutdown(post_shutdown)
|
.post_shutdown(post_shutdown)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
|
Note:
|
||||||
|
|post_methods_note|
|
||||||
|
|
||||||
.. seealso:: :meth:`post_init`, :meth:`post_stop`
|
.. seealso:: :meth:`post_init`, :meth:`post_stop`
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
@ -1177,6 +1209,9 @@ class ApplicationBuilder(Generic[BT, CCT, UD, CD, BD, JQ]):
|
||||||
.post_stop(post_stop)
|
.post_stop(post_stop)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
|
Note:
|
||||||
|
|post_methods_note|
|
||||||
|
|
||||||
.. seealso:: :meth:`post_init`, :meth:`post_shutdown`
|
.. seealso:: :meth:`post_init`, :meth:`post_shutdown`
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
|
|
@ -34,7 +34,7 @@ RT = TypeVar("RT")
|
||||||
|
|
||||||
|
|
||||||
class CallbackQueryHandler(BaseHandler[Update, CCT]):
|
class CallbackQueryHandler(BaseHandler[Update, CCT]):
|
||||||
"""BaseHandler class to handle Telegram
|
"""Handler class to handle Telegram
|
||||||
:attr:`callback queries <telegram.Update.callback_query>`. Optionally based on a regex.
|
:attr:`callback queries <telegram.Update.callback_query>`. Optionally based on a regex.
|
||||||
|
|
||||||
Read the documentation of the :mod:`re` module for more information.
|
Read the documentation of the :mod:`re` module for more information.
|
||||||
|
|
|
@ -28,7 +28,7 @@ from telegram.ext._utils.types import CCT, HandlerCallback
|
||||||
|
|
||||||
|
|
||||||
class ChatJoinRequestHandler(BaseHandler[Update, CCT]):
|
class ChatJoinRequestHandler(BaseHandler[Update, CCT]):
|
||||||
"""BaseHandler class to handle Telegram updates that contain
|
"""Handler class to handle Telegram updates that contain
|
||||||
:attr:`telegram.Update.chat_join_request`.
|
:attr:`telegram.Update.chat_join_request`.
|
||||||
|
|
||||||
Note:
|
Note:
|
||||||
|
|
|
@ -29,7 +29,7 @@ RT = TypeVar("RT")
|
||||||
|
|
||||||
|
|
||||||
class ChatMemberHandler(BaseHandler[Update, CCT]):
|
class ChatMemberHandler(BaseHandler[Update, CCT]):
|
||||||
"""BaseHandler class to handle Telegram updates that contain a chat member update.
|
"""Handler class to handle Telegram updates that contain a chat member update.
|
||||||
|
|
||||||
Warning:
|
Warning:
|
||||||
When setting :paramref:`block` to :obj:`False`, you cannot rely on adding custom
|
When setting :paramref:`block` to :obj:`False`, you cannot rely on adding custom
|
||||||
|
|
|
@ -33,7 +33,7 @@ if TYPE_CHECKING:
|
||||||
|
|
||||||
|
|
||||||
class ChosenInlineResultHandler(BaseHandler[Update, CCT]):
|
class ChosenInlineResultHandler(BaseHandler[Update, CCT]):
|
||||||
"""BaseHandler class to handle Telegram updates that contain
|
"""Handler class to handle Telegram updates that contain
|
||||||
:attr:`telegram.Update.chosen_inline_result`.
|
:attr:`telegram.Update.chosen_inline_result`.
|
||||||
|
|
||||||
Warning:
|
Warning:
|
||||||
|
|
|
@ -34,7 +34,7 @@ RT = TypeVar("RT")
|
||||||
|
|
||||||
|
|
||||||
class CommandHandler(BaseHandler[Update, CCT]):
|
class CommandHandler(BaseHandler[Update, CCT]):
|
||||||
"""BaseHandler class to handle Telegram commands.
|
"""Handler class to handle Telegram commands.
|
||||||
|
|
||||||
Commands are Telegram messages that start with ``/``, optionally followed by an ``@`` and the
|
Commands are Telegram messages that start with ``/``, optionally followed by an ``@`` and the
|
||||||
bot's name and/or some additional text. The handler will add a :obj:`list` to the
|
bot's name and/or some additional text. The handler will add a :obj:`list` to the
|
||||||
|
@ -104,7 +104,7 @@ class CommandHandler(BaseHandler[Update, CCT]):
|
||||||
commands (FrozenSet[:obj:`str`]): The set of commands this handler should listen for.
|
commands (FrozenSet[:obj:`str`]): The set of commands this handler should listen for.
|
||||||
callback (:term:`coroutine function`): The callback function for this handler.
|
callback (:term:`coroutine function`): The callback function for this handler.
|
||||||
filters (:class:`telegram.ext.filters.BaseFilter`): Optional. Only allow updates with these
|
filters (:class:`telegram.ext.filters.BaseFilter`): Optional. Only allow updates with these
|
||||||
Filters.
|
filters.
|
||||||
block (:obj:`bool`): Determines whether the return value of the callback should be
|
block (:obj:`bool`): Determines whether the return value of the callback should be
|
||||||
awaited before processing the next handler in
|
awaited before processing the next handler in
|
||||||
:meth:`telegram.ext.Application.process_update`.
|
:meth:`telegram.ext.Application.process_update`.
|
||||||
|
|
|
@ -33,7 +33,7 @@ RT = TypeVar("RT")
|
||||||
|
|
||||||
|
|
||||||
class MessageHandler(BaseHandler[Update, CCT]):
|
class MessageHandler(BaseHandler[Update, CCT]):
|
||||||
"""BaseHandler class to handle Telegram messages. They might contain text, media or status
|
"""Handler class to handle Telegram messages. They might contain text, media or status
|
||||||
updates.
|
updates.
|
||||||
|
|
||||||
Warning:
|
Warning:
|
||||||
|
|
|
@ -25,7 +25,7 @@ from telegram.ext._utils.types import CCT
|
||||||
|
|
||||||
|
|
||||||
class PollAnswerHandler(BaseHandler[Update, CCT]):
|
class PollAnswerHandler(BaseHandler[Update, CCT]):
|
||||||
"""BaseHandler class to handle Telegram updates that contain a
|
"""Handler class to handle Telegram updates that contain a
|
||||||
:attr:`poll answer <telegram.Update.poll_answer>`.
|
:attr:`poll answer <telegram.Update.poll_answer>`.
|
||||||
|
|
||||||
Warning:
|
Warning:
|
||||||
|
|
|
@ -25,7 +25,7 @@ from telegram.ext._utils.types import CCT
|
||||||
|
|
||||||
|
|
||||||
class PollHandler(BaseHandler[Update, CCT]):
|
class PollHandler(BaseHandler[Update, CCT]):
|
||||||
"""BaseHandler class to handle Telegram updates that contain a
|
"""Handler class to handle Telegram updates that contain a
|
||||||
:attr:`poll <telegram.Update.poll>`.
|
:attr:`poll <telegram.Update.poll>`.
|
||||||
|
|
||||||
Warning:
|
Warning:
|
||||||
|
|
|
@ -25,7 +25,7 @@ from telegram.ext._utils.types import CCT
|
||||||
|
|
||||||
|
|
||||||
class PreCheckoutQueryHandler(BaseHandler[Update, CCT]):
|
class PreCheckoutQueryHandler(BaseHandler[Update, CCT]):
|
||||||
"""BaseHandler class to handle Telegram :attr:`telegram.Update.pre_checkout_query`.
|
"""Handler class to handle Telegram :attr:`telegram.Update.pre_checkout_query`.
|
||||||
|
|
||||||
Warning:
|
Warning:
|
||||||
When setting :paramref:`block` to :obj:`False`, you cannot rely on adding custom
|
When setting :paramref:`block` to :obj:`False`, you cannot rely on adding custom
|
||||||
|
|
|
@ -34,7 +34,7 @@ RT = TypeVar("RT")
|
||||||
|
|
||||||
|
|
||||||
class PrefixHandler(BaseHandler[Update, CCT]):
|
class PrefixHandler(BaseHandler[Update, CCT]):
|
||||||
"""BaseHandler class to handle custom prefix commands.
|
"""Handler class to handle custom prefix commands.
|
||||||
|
|
||||||
This is an intermediate handler between :class:`MessageHandler` and :class:`CommandHandler`.
|
This is an intermediate handler between :class:`MessageHandler` and :class:`CommandHandler`.
|
||||||
It supports configurable commands with the same options as :class:`CommandHandler`. It will
|
It supports configurable commands with the same options as :class:`CommandHandler`. It will
|
||||||
|
|
|
@ -25,7 +25,7 @@ from telegram.ext._utils.types import CCT
|
||||||
|
|
||||||
|
|
||||||
class ShippingQueryHandler(BaseHandler[Update, CCT]):
|
class ShippingQueryHandler(BaseHandler[Update, CCT]):
|
||||||
"""BaseHandler class to handle Telegram :attr:`telegram.Update.shipping_query`.
|
"""Handler class to handle Telegram :attr:`telegram.Update.shipping_query`.
|
||||||
|
|
||||||
Warning:
|
Warning:
|
||||||
When setting :paramref:`block` to :obj:`False`, you cannot rely on adding custom
|
When setting :paramref:`block` to :obj:`False`, you cannot rely on adding custom
|
||||||
|
|
|
@ -30,7 +30,7 @@ if TYPE_CHECKING:
|
||||||
|
|
||||||
|
|
||||||
class StringCommandHandler(BaseHandler[str, CCT]):
|
class StringCommandHandler(BaseHandler[str, CCT]):
|
||||||
"""BaseHandler class to handle string commands. Commands are string updates that start with
|
"""Handler class to handle string commands. Commands are string updates that start with
|
||||||
``/``. The handler will add a :obj:`list` to the
|
``/``. The handler will add a :obj:`list` to the
|
||||||
:class:`CallbackContext` named :attr:`CallbackContext.args`. It will contain a list of strings,
|
:class:`CallbackContext` named :attr:`CallbackContext.args`. It will contain a list of strings,
|
||||||
which is the text following the command split on single whitespace characters.
|
which is the text following the command split on single whitespace characters.
|
||||||
|
|
|
@ -33,7 +33,7 @@ RT = TypeVar("RT")
|
||||||
|
|
||||||
|
|
||||||
class StringRegexHandler(BaseHandler[str, CCT]):
|
class StringRegexHandler(BaseHandler[str, CCT]):
|
||||||
"""BaseHandler class to handle string updates based on a regex which checks the update content.
|
"""Handler class to handle string updates based on a regex which checks the update content.
|
||||||
|
|
||||||
Read the documentation of the :mod:`re` module for more information. The :func:`re.match`
|
Read the documentation of the :mod:`re` module for more information. The :func:`re.match`
|
||||||
function is used to determine if an update should be handled by this handler.
|
function is used to determine if an update should be handled by this handler.
|
||||||
|
|
|
@ -30,7 +30,7 @@ UT = TypeVar("UT")
|
||||||
|
|
||||||
|
|
||||||
class TypeHandler(BaseHandler[UT, CCT]):
|
class TypeHandler(BaseHandler[UT, CCT]):
|
||||||
"""BaseHandler class to handle updates of custom types.
|
"""Handler class to handle updates of custom types.
|
||||||
|
|
||||||
Warning:
|
Warning:
|
||||||
When setting :paramref:`block` to :obj:`False`, you cannot rely on adding custom
|
When setting :paramref:`block` to :obj:`False`, you cannot rely on adding custom
|
||||||
|
|
Loading…
Reference in a new issue