From 0c4180c74b6f8600435f75abe6909be3295f4803 Mon Sep 17 00:00:00 2001 From: Bibo-Joshi <22366557+Bibo-Joshi@users.noreply.github.com> Date: Sun, 7 May 2023 14:51:22 +0200 Subject: [PATCH] Documentation Improvements (#3628, #3636, #3694) Co-authored-by: Yossi Rafelson Co-authored-by: Aditya Co-authored-by: ibragimovgeorge <103066850+ibragimovgeorge@users.noreply.github.com> --- README.rst | 4 ++-- README_RAW.rst | 4 ++-- telegram/_bot.py | 2 +- telegram/ext/_applicationbuilder.py | 5 +++-- telegram/ext/_jobqueue.py | 12 ++++++++++++ telegram/ext/filters.py | 4 ++-- 6 files changed, 22 insertions(+), 9 deletions(-) diff --git a/README.rst b/README.rst index 1ddad4bfd..86d776ed5 100644 --- a/README.rst +++ b/README.rst @@ -46,8 +46,8 @@ :target: https://app.codacy.com/gh/python-telegram-bot/python-telegram-bot/dashboard :alt: Code quality: Codacy -.. image:: https://deepsource.io/gh/python-telegram-bot/python-telegram-bot.svg/?label=active+issues - :target: https://deepsource.io/gh/python-telegram-bot/python-telegram-bot/?ref=repository-badge +.. image:: https://app.deepsource.com/gh/python-telegram-bot/python-telegram-bot.svg/?label=active+issues + :target: https://app.deepsource.com/gh/python-telegram-bot/python-telegram-bot/?ref=repository-badge :alt: Code quality: DeepSource .. image:: https://results.pre-commit.ci/badge/github/python-telegram-bot/python-telegram-bot/master.svg diff --git a/README_RAW.rst b/README_RAW.rst index b8425e478..1b71791ed 100644 --- a/README_RAW.rst +++ b/README_RAW.rst @@ -46,8 +46,8 @@ :target: https://app.codacy.com/gh/python-telegram-bot/python-telegram-bot/dashboard :alt: Code quality: Codacy -.. image:: https://deepsource.io/gh/python-telegram-bot/python-telegram-bot.svg/?label=active+issues - :target: https://deepsource.io/gh/python-telegram-bot/python-telegram-bot/?ref=repository-badge +.. image:: https://app.deepsource.com/gh/python-telegram-bot/python-telegram-bot.svg/?label=active+issues + :target: https://app.deepsource.com/gh/python-telegram-bot/python-telegram-bot/?ref=repository-badge :alt: Code quality: DeepSource .. image:: https://results.pre-commit.ci/badge/github/python-telegram-bot/python-telegram-bot/master.svg diff --git a/telegram/_bot.py b/telegram/_bot.py index 6cfb63672..02b41620d 100644 --- a/telegram/_bot.py +++ b/telegram/_bot.py @@ -3616,7 +3616,7 @@ class Bot(TelegramObject, AsyncContextManager["Bot"]): returned. An update is considered confirmed as soon as this method is called with an offset higher than its :attr:`telegram.Update.update_id`. The negative offset can be specified to retrieve updates starting from -offset update from the end of - the updates queue. All previous updates will forgotten. + the updates queue. All previous updates will be forgotten. limit (:obj:`int`, optional): Limits the number of updates to be retrieved. Values between :tg-const:`telegram.constants.PollingLimit.MIN_LIMIT`- :tg-const:`telegram.constants.PollingLimit.MAX_LIMIT` are accepted. diff --git a/telegram/ext/_applicationbuilder.py b/telegram/ext/_applicationbuilder.py index 909e55a72..f4688a09f 100644 --- a/telegram/ext/_applicationbuilder.py +++ b/telegram/ext/_applicationbuilder.py @@ -570,12 +570,13 @@ class ApplicationBuilder(Generic[BT, CCT, UD, CD, BD, JQ]): Note: Users have observed stability issues with HTTP/2, which happen due to how the `h2 - library handles ` cancellations of + library handles `_ cancellations of keepalive connections. See `#3556 `_ for a discussion. If you want to use HTTP/2, you must install PTB with the optional requirement ``http2``, i.e. + .. code-block:: bash pip install python-telegram-bot[http2] @@ -728,7 +729,7 @@ class ApplicationBuilder(Generic[BT, CCT, UD, CD, BD, JQ]): Note: Users have observed stability issues with HTTP/2, which happen due to how the `h2 - library handles ` cancellations of + library handles `_ cancellations of keepalive connections. See `#3556 `_ for a discussion. diff --git a/telegram/ext/_jobqueue.py b/telegram/ext/_jobqueue.py index 7e45374d1..74ea0196c 100644 --- a/telegram/ext/_jobqueue.py +++ b/telegram/ext/_jobqueue.py @@ -291,6 +291,18 @@ class JobQueue(Generic[CCT]): :attr:`telegram.ext.Defaults.tzinfo` is used. Defaults to :paramref:`interval` + + Note: + Setting :paramref:`first` to ``0``, ``datetime.datetime.now()`` or another + value that indicates that the job should run immediately will not work due + to how the APScheduler library works. If you want to run a job immediately, + we recommend to use an approach along the lines of:: + + job = context.job_queue.run_repeating(callback, interval=5) + await job.run(context.application) + + .. seealso:: :meth:`telegram.ext.Job.run` + last (:obj:`int` | :obj:`float` | :obj:`datetime.timedelta` | \ :obj:`datetime.datetime` | :obj:`datetime.time`, optional): Latest possible time for the job to run. This parameter will be interpreted diff --git a/telegram/ext/filters.py b/telegram/ext/filters.py index ba6db52ee..5a49c84c8 100644 --- a/telegram/ext/filters.py +++ b/telegram/ext/filters.py @@ -141,7 +141,7 @@ class BaseFilter: Also works with more than two filters:: - filters.TEXT & (filters.Entity(URL) | filters.Entity(TEXT_LINK)) + filters.TEXT & (filters.Entity("url") | filters.Entity("text_link")) filters.TEXT & (~ filters.FORWARDED) Note: @@ -514,7 +514,7 @@ class Caption(MessageFilter): allow those whose caption is appearing in the given list. Examples: - ``MessageHandler(filters.Caption(['PTB rocks!', 'PTB'], callback_method_2)`` + ``MessageHandler(filters.Caption(['PTB rocks!', 'PTB']), callback_method_2)`` .. seealso:: :attr:`telegram.ext.filters.CAPTION`