From c9cbfda6e42def1189674d1ee321fecd42741765 Mon Sep 17 00:00:00 2001 From: Dmitry Kolomatskiy <58207913+lemontree210@users.noreply.github.com> Date: Sat, 17 Dec 2022 17:12:11 +0300 Subject: [PATCH 1/3] replace https links to wiki with extlinks --- telegram/_bot.py | 12 ++++---- telegram/_inline/inlinekeyboardbutton.py | 3 +- telegram/_update.py | 3 +- telegram/error.py | 8 ++---- telegram/ext/_aioratelimiter.py | 3 +- telegram/ext/_application.py | 29 +++++++------------- telegram/ext/_applicationbuilder.py | 32 ++++++++-------------- telegram/ext/_basepersistence.py | 6 ++-- telegram/ext/_baseratelimiter.py | 6 ++-- telegram/ext/_callbackcontext.py | 29 ++++++++------------ telegram/ext/_callbackdatacache.py | 9 ++---- telegram/ext/_callbackqueryhandler.py | 6 ++-- telegram/ext/_chatjoinrequesthandler.py | 3 +- telegram/ext/_chatmemberhandler.py | 3 +- telegram/ext/_choseninlineresulthandler.py | 3 +- telegram/ext/_commandhandler.py | 3 +- telegram/ext/_contexttypes.py | 6 ++-- telegram/ext/_conversationhandler.py | 3 +- telegram/ext/_defaults.py | 6 ++-- telegram/ext/_dictpersistence.py | 3 +- telegram/ext/_extbot.py | 6 ++-- telegram/ext/_handler.py | 6 ++-- telegram/ext/_inlinequeryhandler.py | 3 +- telegram/ext/_jobqueue.py | 9 ++---- telegram/ext/_messagehandler.py | 6 ++-- telegram/ext/_picklepersistence.py | 3 +- telegram/ext/_pollanswerhandler.py | 3 +- telegram/ext/_pollhandler.py | 3 +- telegram/ext/_precheckoutqueryhandler.py | 3 +- telegram/ext/_prefixhandler.py | 3 +- telegram/ext/_shippingqueryhandler.py | 3 +- telegram/ext/_stringcommandhandler.py | 3 +- telegram/ext/_stringregexhandler.py | 3 +- telegram/ext/_typehandler.py | 3 +- telegram/ext/_updater.py | 9 ++---- telegram/ext/filters.py | 6 ++-- telegram/request/_baserequest.py | 6 ++-- telegram/warnings.py | 3 +- 38 files changed, 90 insertions(+), 167 deletions(-) diff --git a/telegram/_bot.py b/telegram/_bot.py index 040d29285a6..46b30996737 100644 --- a/telegram/_bot.py +++ b/telegram/_bot.py @@ -149,10 +149,8 @@ class Bot(TelegramObject, AbstractAsyncContextManager): .. seealso:: :attr:`telegram.ext.Application.bot`, :attr:`telegram.ext.CallbackContext.bot`, :attr:`telegram.ext.Updater.bot`, - `Your First Bot `_, - `Builder Pattern `_ + :wiki:`Your First Bot `, + :wiki:`Builder Pattern ` .. versionadded:: 13.2 Objects of this class are comparable in terms of equality. Two objects of this class are @@ -3568,9 +3566,9 @@ async def set_webhook( 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 `_ for details. |uploadinputnopath| + certificate in use can be checked. See our :wiki:`self-signed guide\ + ` 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 diff --git a/telegram/_inline/inlinekeyboardbutton.py b/telegram/_inline/inlinekeyboardbutton.py index 34afb1e0ca3..d18b99a218c 100644 --- a/telegram/_inline/inlinekeyboardbutton.py +++ b/telegram/_inline/inlinekeyboardbutton.py @@ -95,8 +95,7 @@ class InlineKeyboardButton(TelegramObject): Tip: The value entered here will be available in :attr:`telegram.CallbackQuery.data`. - .. seealso:: `Arbitrary callback_data `_ + .. seealso:: :wiki:`Arbitrary callback_data ` web_app (:obj:`telegram.WebAppInfo`, optional): Description of the `Web App `_ that will be launched when the user presses diff --git a/telegram/_update.py b/telegram/_update.py index 55355bce2a7..b1160696737 100644 --- a/telegram/_update.py +++ b/telegram/_update.py @@ -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 `_ + .. seealso:: :wiki:`Your First Bot ` Args: update_id (:obj:`int`): The update's unique identifier. Update identifiers start from a diff --git a/telegram/error.py b/telegram/error.py index 7e92bfaa90a..cfa9fe388bf 100644 --- a/telegram/error.py +++ b/telegram/error.py @@ -59,8 +59,7 @@ class TelegramError(Exception): """ Base class for Telegram errors. - .. seealso:: `Exceptions, Warnings and Logging `_ + .. seealso:: :wiki:`Exceptions, 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 `_, + .. seealso:: + :wiki:`Storing Bot, User and Chat Related Data ` Args: new_chat_id (:obj:`int`): The new chat id of the group. diff --git a/telegram/ext/_aioratelimiter.py b/telegram/ext/_aioratelimiter.py index 300e8fabdd7..dae7de30275 100644 --- a/telegram/ext/_aioratelimiter.py +++ b/telegram/ext/_aioratelimiter.py @@ -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 `_ + .. seealso:: :wiki:`Avoiding Flood Limits ` .. versionadded:: 20.0 diff --git a/telegram/ext/_application.py b/telegram/ext/_application.py index f14c6af5d16..a879959bba8 100644 --- a/telegram/ext/_application.py +++ b/telegram/ext/_application.py @@ -136,10 +136,8 @@ class Application(Generic[BT, CCT, UD, CD, BD, JQ], AbstractAsyncContextManager) Examples: :any:`Echo Bot ` - .. seealso:: `Your First Bot `_, - `Architecture Overview `_ + .. seealso:: :wiki:`Your First Bot `, + :wiki:`Architecture Overview ` .. versionchanged:: 20.0 @@ -338,8 +336,7 @@ def concurrent_updates(self) -> int: """: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 `_ + .. seealso:: :wiki:`Concurrency` """ return self._concurrent_updates @@ -349,8 +346,7 @@ def job_queue(self) -> Optional["JobQueue"]: :class:`telegram.ext.JobQueue`: The :class:`JobQueue` used by the :class:`telegram.ext.Application`. - .. seealso:: `Job Queue `_ + .. seealso:: :wiki:`Job Queue ` """ if self._job_queue is None: warn( @@ -763,8 +759,7 @@ def run_webhook( .. seealso:: :meth:`initialize`, :meth:`start`, :meth:`stop`, :meth:`shutdown` :meth:`telegram.ext.Updater.start_webhook`, :meth:`telegram.ext.Updater.stop`, - :meth:`run_polling`, - `Webhooks `_ + :meth:`run_polling`, :wiki:`Webhooks` Args: listen (:obj:`str`, optional): IP-Address to listen on. Defaults to @@ -909,8 +904,7 @@ def create_task(self, coroutine: Coroutine, update: object = None) -> asyncio.Ta * If the application is currently running, tasks created by this method will be awaited with :meth:`stop`. - .. seealso:: `Concurrency `_ + .. seealso:: :wiki:`Concurrency` Args: coroutine (:term:`coroutine function`): The coroutine to run as task. @@ -1028,8 +1022,7 @@ async def process_update(self, update: object) -> None: """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 `_ + .. seealso:: :wiki:`Concurrency` .. versionchanged:: 20.0 Persistence is now updated in an interval set by @@ -1270,9 +1263,8 @@ def migrate_chat_data( 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 `_, + .. seealso:: :wiki:`Storing Bot, User and Chat Related Data\ + ` Args: message (:class:`telegram.Message`, optional): A message with either @@ -1495,8 +1487,7 @@ def add_error_handler( Examples: :any:`Errorhandler Bot ` - .. seealso:: `Exceptions, Warnings and Logging `_ + .. seealso:: :wiki:`Exceptions, Warnings and Logging ` Args: callback (:term:`coroutine function`): The callback function for this error handler. diff --git a/telegram/ext/_applicationbuilder.py b/telegram/ext/_applicationbuilder.py index 1f464e79fef..e7502c69bfb 100644 --- a/telegram/ext/_applicationbuilder.py +++ b/telegram/ext/_applicationbuilder.py @@ -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 `_, - `Builder Pattern for Application `_ + .. seealso:: :wiki:`Your First Bot `, + :wiki:`Builder Pattern ` .. _`builder pattern`: https://en.wikipedia.org/wiki/Builder_pattern """ @@ -359,9 +357,8 @@ def base_url(self: BuilderType, base_url: str) -> BuilderType: """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 `_, - :meth:`base_file_url` + .. seealso:: :paramref:`telegram.Bot.base_url`, + :wiki:`Local Bot API Server `, :meth:`base_file_url` Args: base_url (:obj:`str`): The URL. @@ -378,9 +375,8 @@ def base_file_url(self: BuilderType, base_file_url: str) -> BuilderType: """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 `_, - :meth:`base_url` + .. seealso:: :paramref:`telegram.Bot.base_file_url`, + :wiki:`Local Bot API Server `, :meth:`base_url` Args: base_file_url (:obj:`str`): The URL. @@ -673,8 +669,8 @@ def private_key( """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 - `_ + .. seealso:: :any:`Passport Bot Example `, + :wiki:`Telegram Passports ` Args: private_key (:obj:`bytes` | :obj:`str` | :obj:`pathlib.Path`): The private key or the @@ -704,8 +700,7 @@ def defaults(self: BuilderType, defaults: "Defaults") -> BuilderType: """Sets the :class:`telegram.ext.Defaults` instance for :attr:`telegram.ext.Application.bot`. - .. seealso:: `Adding Defaults `_ + .. seealso:: :wiki:`Adding Defaults to Your Bot ` Args: defaults (:class:`telegram.ext.Defaults`): The defaults instance. @@ -734,8 +729,7 @@ def arbitrary_callback_data( pip install python-telegram-bot[callback-data] - .. seealso:: `Arbitrary callback_data `_, + .. seealso:: :wiki:`Arbitrary callback_data `, :any:`examples.arbitrarycallbackdatabot` Args: @@ -756,8 +750,7 @@ def local_mode(self: BuilderType, local_mode: bool) -> BuilderType: :attr:`telegram.ext.Application.bot`. If not called, will default to :obj:`False`. - .. seealso:: `Local Bot API Server `_, + .. seealso:: :wiki:`Local Bot API Server ` Args: local_mode (:obj:`bool`): Whether the bot should run in local mode. @@ -878,8 +871,7 @@ def persistence(self: BuilderType, persistence: "BasePersistence") -> BuilderTyp :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 `_, + .. seealso:: :wiki:`Making Your Bot Persistent `, :any:`examples.persistentconversationbot` Warning: diff --git a/telegram/ext/_basepersistence.py b/telegram/ext/_basepersistence.py index 69bdd4d31c9..fa3e455f919 100644 --- a/telegram/ext/_basepersistence.py +++ b/telegram/ext/_basepersistence.py @@ -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 `_, - `Making Your Bot Persistent `_ + .. seealso:: :wiki:`Architecture Overview `, + :wiki:`Making Your Bot Persistent ` .. versionchanged:: 20.0 diff --git a/telegram/ext/_baseratelimiter.py b/telegram/ext/_baseratelimiter.py index 4726d8e336d..aa43fae4a44 100644 --- a/telegram/ext/_baseratelimiter.py +++ b/telegram/ext/_baseratelimiter.py @@ -37,10 +37,8 @@ class BaseRateLimiter(ABC, Generic[RLARGS]): Hint: Requests to :meth:`~telegram.Bot.get_updates` are never rate limited. - .. seealso:: `Architecture Overview `_, - `Avoiding Flood Limits `_ + .. seealso:: :wiki:`Architecture Overview `, + :wiki:`Avoiding Flood Limits ` .. versionadded:: 20.0 """ diff --git a/telegram/ext/_callbackcontext.py b/telegram/ext/_callbackcontext.py index eaa99f03197..a226c6a2560 100644 --- a/telegram/ext/_callbackcontext.py +++ b/telegram/ext/_callbackcontext.py @@ -72,8 +72,7 @@ class CallbackContext(Generic[BT, UD, CD, BD]): * :any:`Custom Webhook Bot ` .. seealso:: :attr:`telegram.ext.ContextTypes.DEFAULT_TYPE`, - `Job Queue `_ + :wiki:`Job Queue ` Args: application (:class:`telegram.ext.Application`): The application associated with this @@ -146,9 +145,8 @@ def bot_data(self) -> 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 `_, + .. seealso:: :wiki:`Storing Bot, User and Chat Related Data\ + ` """ return self.application.bot_data @@ -166,13 +164,11 @@ def chat_data(self) -> Optional[CD]: 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 - `_. + ``chat_data`` needs to be transferred. For details see our + :wiki:`wiki page `. - .. seealso:: `Storing Bot, User and Chat Related Data `_, + .. seealso:: :wiki:`Storing Bot, 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 @@ def user_data(self) -> Optional[UD]: 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 `_, + .. seealso:: :wiki:`Storing Bot, 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 @@ def drop_callback_data(self, callback_query: CallbackQuery) -> None: 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 `_ + .. seealso:: :wiki:`Arbitrary callback_data ` Args: callback_query (:class:`telegram.CallbackQuery`): The callback query. @@ -387,8 +381,7 @@ def job_queue(self) -> Optional["JobQueue"]: :class:`telegram.ext.JobQueue`: The :class:`JobQueue` used by the :class:`telegram.ext.Application`. - .. seealso:: `Job Queue `_ + .. seealso:: :wiki:`Job Queue ` """ if self._application._job_queue is None: # pylint: disable=protected-access warn( diff --git a/telegram/ext/_callbackdatacache.py b/telegram/ext/_callbackdatacache.py index c62d4db6255..6a2a39ae3e9 100644 --- a/telegram/ext/_callbackdatacache.py +++ b/telegram/ext/_callbackdatacache.py @@ -47,8 +47,7 @@ class InvalidCallbackData(TelegramError): Examples: :any:`Arbitrary Callback Data Bot ` - .. seealso:: `Arbitrary callback_data `_ + .. seealso:: :wiki:`Arbitrary callback_data ` .. versionadded:: 13.6 @@ -118,10 +117,8 @@ class CallbackDataCache: :any:`Arbitrary Callback Data Bot ` .. seealso:: :attr:`telegram.ext.ExtBot.callback_data_cache`, - `Architecture Overview `_, - `Arbitrary callback_data `_ + :wiki:`Architecture Overview `, + :wiki:`Arbitrary callback_data ` .. versionadded:: 13.6 diff --git a/telegram/ext/_callbackqueryhandler.py b/telegram/ext/_callbackqueryhandler.py index c2590f14d63..db79499917f 100644 --- a/telegram/ext/_callbackqueryhandler.py +++ b/telegram/ext/_callbackqueryhandler.py @@ -81,8 +81,7 @@ async def callback(update: Update, context: CallbackContext) If :attr:`telegram.CallbackQuery.data` is :obj:`None`, the :class:`telegram.CallbackQuery` update will not be handled. - .. seealso:: `Arbitrary callback_data `_ + .. seealso:: :wiki:`Arbitrary callback_data ` .. versionchanged:: 13.6 Added support for arbitrary callback data. @@ -90,8 +89,7 @@ async def callback(update: Update, context: CallbackContext) be awaited before processing the next handler in :meth:`telegram.ext.Application.process_update`. Defaults to :obj:`True`. - .. seealso:: `Concurrency `_ + .. seealso:: :wiki:`Concurrency` Attributes: callback (:term:`coroutine function`): The callback function for this handler. diff --git a/telegram/ext/_chatjoinrequesthandler.py b/telegram/ext/_chatjoinrequesthandler.py index d8b26d1a18d..690cf4f25ed 100644 --- a/telegram/ext/_chatjoinrequesthandler.py +++ b/telegram/ext/_chatjoinrequesthandler.py @@ -66,8 +66,7 @@ async def callback(update: Update, context: CallbackContext) be awaited before processing the next handler in :meth:`telegram.ext.Application.process_update`. Defaults to :obj:`True`. - .. seealso:: `Concurrency `_ + .. seealso:: :wiki:`Concurrency` Attributes: callback (:term:`coroutine function`): The callback function for this handler. diff --git a/telegram/ext/_chatmemberhandler.py b/telegram/ext/_chatmemberhandler.py index a746568cca4..f48d2f26829 100644 --- a/telegram/ext/_chatmemberhandler.py +++ b/telegram/ext/_chatmemberhandler.py @@ -57,8 +57,7 @@ async def callback(update: Update, context: CallbackContext) be awaited before processing the next handler in :meth:`telegram.ext.Application.process_update`. Defaults to :obj:`True`. - .. seealso:: `Concurrency `_ + .. seealso:: :wiki:`Concurrency` Attributes: callback (:term:`coroutine function`): The callback function for this handler. diff --git a/telegram/ext/_choseninlineresulthandler.py b/telegram/ext/_choseninlineresulthandler.py index ff0000ce73e..7cc948527f8 100644 --- a/telegram/ext/_choseninlineresulthandler.py +++ b/telegram/ext/_choseninlineresulthandler.py @@ -53,8 +53,7 @@ async def callback(update: Update, context: CallbackContext) be awaited before processing the next handler in :meth:`telegram.ext.Application.process_update`. Defaults to :obj:`True`. - .. seealso:: `Concurrency `_ + .. seealso:: :wiki:`Concurrency` pattern (:obj:`str` | :func:`re.Pattern `, optional): Regex pattern. If not :obj:`None`, :func:`re.match` is used on :attr:`telegram.ChosenInlineResult.result_id` to determine if an update diff --git a/telegram/ext/_commandhandler.py b/telegram/ext/_commandhandler.py index 86b67badc4b..22e189a3f63 100644 --- a/telegram/ext/_commandhandler.py +++ b/telegram/ext/_commandhandler.py @@ -87,8 +87,7 @@ async def callback(update: Update, context: CallbackContext) be awaited before processing the next handler in :meth:`telegram.ext.Application.process_update`. Defaults to :obj:`True`. - .. seealso:: `Concurrency `_ + .. seealso:: :wiki:`Concurrency` Raises: :exc:`ValueError`: When the command is too long or has illegal chars. diff --git a/telegram/ext/_contexttypes.py b/telegram/ext/_contexttypes.py index 30b8430b19b..98607fa3fbe 100644 --- a/telegram/ext/_contexttypes.py +++ b/telegram/ext/_contexttypes.py @@ -36,10 +36,8 @@ class ContextTypes(Generic[CCT, UD, CD, BD]): Examples: :any:`ContextTypes Bot ` - .. seealso:: `Architecture Overview `_, - `Storing Bot, User and Chat Related Data `_ + .. seealso:: :wiki:`Architecture Overview `, + :wiki:`Storing Bot, User and Chat Related Data ` .. versionadded:: 13.6 diff --git a/telegram/ext/_conversationhandler.py b/telegram/ext/_conversationhandler.py index c972551f356..505f85158c7 100644 --- a/telegram/ext/_conversationhandler.py +++ b/telegram/ext/_conversationhandler.py @@ -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 `_ + .. seealso:: :wiki:`Concurrency` .. versionchanged:: 20.0 No longer overrides the handlers settings. Resolution order was changed. diff --git a/telegram/ext/_defaults.py b/telegram/ext/_defaults.py index 5c127154a5a..7fc5f7115f8 100644 --- a/telegram/ext/_defaults.py +++ b/telegram/ext/_defaults.py @@ -26,10 +26,8 @@ class Defaults: """Convenience Class to gather all parameters with a (user defined) default value - .. seealso:: `Architecture Overview `_, - `Adding Defaults to Your Bot `_ + .. seealso:: :wiki:`Architecture Overview `, + :wiki:`Adding Defaults to Your Bot ` .. versionchanged:: 20.0 Removed the argument and attribute ``timeout``. Specify default timeout behavior for the diff --git a/telegram/ext/_dictpersistence.py b/telegram/ext/_dictpersistence.py index c02b49ec27e..eef58a77375 100644 --- a/telegram/ext/_dictpersistence.py +++ b/telegram/ext/_dictpersistence.py @@ -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 `_ + .. seealso:: :wiki:`Making Your Bot Persistent ` .. versionchanged:: 20.0 The parameters and attributes ``store_*_data`` were replaced by :attr:`store_data`. diff --git a/telegram/ext/_extbot.py b/telegram/ext/_extbot.py index 358e023e45c..c875cbf297b 100644 --- a/telegram/ext/_extbot.py +++ b/telegram/ext/_extbot.py @@ -123,8 +123,7 @@ class ExtBot(Bot, Generic[RLARGS]): Examples: :any:`Arbitrary Callback Data Bot ` - .. seealso:: `Arbitrary callback_data `_ + .. seealso:: :wiki:`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 `_ + .. seealso:: :wiki:`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. diff --git a/telegram/ext/_handler.py b/telegram/ext/_handler.py index fc98c616c97..6b59a37abf5 100644 --- a/telegram/ext/_handler.py +++ b/telegram/ext/_handler.py @@ -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 `_ + .. seealso:: :wiki:`Types of Handlers ` .. versionchanged:: 20.0 @@ -75,8 +74,7 @@ async def callback(update: Update, context: CallbackContext) be awaited before processing the next handler in :meth:`telegram.ext.Application.process_update`. Defaults to :obj:`True`. - .. seealso:: `Concurrency `_ + .. seealso:: :wiki:`Concurrency` Attributes: callback (:term:`coroutine function`): The callback function for this handler. diff --git a/telegram/ext/_inlinequeryhandler.py b/telegram/ext/_inlinequeryhandler.py index ae451e70983..2cc0ce07ed9 100644 --- a/telegram/ext/_inlinequeryhandler.py +++ b/telegram/ext/_inlinequeryhandler.py @@ -66,8 +66,7 @@ async def callback(update: Update, context: CallbackContext) be awaited before processing the next handler in :meth:`telegram.ext.Application.process_update`. Defaults to :obj:`True`. - .. seealso:: `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`. diff --git a/telegram/ext/_jobqueue.py b/telegram/ext/_jobqueue.py index e646b3429e8..8da92242e65 100644 --- a/telegram/ext/_jobqueue.py +++ b/telegram/ext/_jobqueue.py @@ -58,10 +58,8 @@ class JobQueue: .. seealso:: :attr:`telegram.ext.Application.job_queue`, :attr:`telegram.ext.CallbackContext.job_queue`, - `Architecture Overview `_, - `Job Queue `_ + :wiki:`Architecture Overview `, + :wiki:`Job Queue ` .. 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 `_ + .. seealso:: :wiki:`Job Queue ` .. versionchanged:: 20.0 diff --git a/telegram/ext/_messagehandler.py b/telegram/ext/_messagehandler.py index 0a0f365d3dd..60dfea42b1d 100644 --- a/telegram/ext/_messagehandler.py +++ b/telegram/ext/_messagehandler.py @@ -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 `_ + .. seealso:: :wiki:`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 @@ async def callback(update: Update, context: CallbackContext) be awaited before processing the next handler in :meth:`telegram.ext.Application.process_update`. Defaults to :obj:`True`. - .. seealso:: `Concurrency `_ + .. seealso:: :wiki:`Concurrency` Attributes: filters (:class:`telegram.ext.filters.BaseFilter`): Only allow updates with these Filters. diff --git a/telegram/ext/_picklepersistence.py b/telegram/ext/_picklepersistence.py index 42eb3241123..452d98630de 100644 --- a/telegram/ext/_picklepersistence.py +++ b/telegram/ext/_picklepersistence.py @@ -136,8 +136,7 @@ class PicklePersistence(BasePersistence[UD, CD, BD]): Examples: :any:`Persistent Conversation Bot ` - .. seealso:: `Making Your Bot Persistent `_ + .. seealso:: :wiki:`Making Your Bot Persistent ` .. versionchanged:: 20.0 diff --git a/telegram/ext/_pollanswerhandler.py b/telegram/ext/_pollanswerhandler.py index faa4733ea39..f258c86a58f 100644 --- a/telegram/ext/_pollanswerhandler.py +++ b/telegram/ext/_pollanswerhandler.py @@ -48,8 +48,7 @@ async def callback(update: Update, context: CallbackContext) be awaited before processing the next handler in :meth:`telegram.ext.Application.process_update`. Defaults to :obj:`True`. - .. seealso:: `Concurrency `_ + .. seealso:: :wiki:`Concurrency` Attributes: callback (:term:`coroutine function`): The callback function for this handler. diff --git a/telegram/ext/_pollhandler.py b/telegram/ext/_pollhandler.py index 67d7b92adfe..79c94058d22 100644 --- a/telegram/ext/_pollhandler.py +++ b/telegram/ext/_pollhandler.py @@ -48,8 +48,7 @@ async def callback(update: Update, context: CallbackContext) be awaited before processing the next handler in :meth:`telegram.ext.Application.process_update`. Defaults to :obj:`True`. - .. seealso:: `Concurrency `_ + .. seealso:: :wiki:`Concurrency` Attributes: callback (:term:`coroutine function`): The callback function for this handler. diff --git a/telegram/ext/_precheckoutqueryhandler.py b/telegram/ext/_precheckoutqueryhandler.py index d02cf50da13..3cadaaee695 100644 --- a/telegram/ext/_precheckoutqueryhandler.py +++ b/telegram/ext/_precheckoutqueryhandler.py @@ -47,8 +47,7 @@ async def callback(update: Update, context: CallbackContext) be awaited before processing the next handler in :meth:`telegram.ext.Application.process_update`. Defaults to :obj:`True`. - .. seealso:: `Concurrency `_ + .. seealso:: :wiki:`Concurrency` Attributes: callback (:term:`coroutine function`): The callback function for this handler. diff --git a/telegram/ext/_prefixhandler.py b/telegram/ext/_prefixhandler.py index 67c619bbdfb..16803aca581 100644 --- a/telegram/ext/_prefixhandler.py +++ b/telegram/ext/_prefixhandler.py @@ -105,8 +105,7 @@ async def callback(update: Update, context: CallbackContext) be awaited before processing the next handler in :meth:`telegram.ext.Application.process_update`. Defaults to :obj:`True`. - .. seealso:: `Concurrency `_ + .. seealso:: :wiki:`Concurrency` Attributes: commands (FrozenSet[:obj:`str`]): The commands that this handler will listen for, i.e. the diff --git a/telegram/ext/_shippingqueryhandler.py b/telegram/ext/_shippingqueryhandler.py index 5a78a8147f3..e14149a20f6 100644 --- a/telegram/ext/_shippingqueryhandler.py +++ b/telegram/ext/_shippingqueryhandler.py @@ -47,8 +47,7 @@ async def callback(update: Update, context: CallbackContext) be awaited before processing the next handler in :meth:`telegram.ext.Application.process_update`. Defaults to :obj:`True`. - .. seealso:: `Concurrency `_ + .. seealso:: :wiki:`Concurrency` Attributes: callback (:term:`coroutine function`): The callback function for this handler. diff --git a/telegram/ext/_stringcommandhandler.py b/telegram/ext/_stringcommandhandler.py index 7dc0f53e346..4a7a6fd1b07 100644 --- a/telegram/ext/_stringcommandhandler.py +++ b/telegram/ext/_stringcommandhandler.py @@ -57,8 +57,7 @@ async def callback(update: Update, context: CallbackContext) be awaited before processing the next handler in :meth:`telegram.ext.Application.process_update`. Defaults to :obj:`True`. - .. seealso:: `Concurrency `_ + .. seealso:: :wiki:`Concurrency` Attributes: command (:obj:`str`): The command this handler should listen for. diff --git a/telegram/ext/_stringregexhandler.py b/telegram/ext/_stringregexhandler.py index 0a6f0db7168..cdf0b453507 100644 --- a/telegram/ext/_stringregexhandler.py +++ b/telegram/ext/_stringregexhandler.py @@ -60,8 +60,7 @@ async def callback(update: Update, context: CallbackContext) be awaited before processing the next handler in :meth:`telegram.ext.Application.process_update`. Defaults to :obj:`True`. - .. seealso:: `Concurrency `_ + .. seealso:: :wiki:`Concurrency` Attributes: pattern (:obj:`str` | :func:`re.Pattern `): The regex pattern. diff --git a/telegram/ext/_typehandler.py b/telegram/ext/_typehandler.py index 2984e00e3e7..811437865fa 100644 --- a/telegram/ext/_typehandler.py +++ b/telegram/ext/_typehandler.py @@ -53,8 +53,7 @@ async def callback(update: Update, context: CallbackContext) be awaited before processing the next handler in :meth:`telegram.ext.Application.process_update`. Defaults to :obj:`True`. - .. seealso:: `Concurrency `_ + .. seealso:: :wiki:`Concurrency` Attributes: type (:external:class:`type`): The :external:class:`type` of updates this handler should diff --git a/telegram/ext/_updater.py b/telegram/ext/_updater.py index 907ea1f3695..524e7e47c76 100644 --- a/telegram/ext/_updater.py +++ b/telegram/ext/_updater.py @@ -65,10 +65,8 @@ class Updater(AbstractAsyncContextManager): finally: await updater.shutdown() - .. seealso:: `Architecture Overview `_, - `Builder Pattern `_ + .. seealso:: :wiki:`Architecture Overview `, + :wiki:`Builder Pattern ` .. versionchanged:: 20.0 @@ -397,8 +395,7 @@ async def start_webhook( pip install python-telegram-bot[webhooks] - .. seealso:: `Webhooks `_ + .. seealso:: :wiki:`Webhooks` .. versionchanged:: 13.4 :meth:`start_webhook` now *always* calls :meth:`telegram.Bot.set_webhook`, so pass diff --git a/telegram/ext/filters.py b/telegram/ext/filters.py index cdd4cf62ccc..305c35eda14 100644 --- a/telegram/ext/filters.py +++ b/telegram/ext/filters.py @@ -232,8 +232,7 @@ class MessageFilter(BaseFilter): Please see :class:`BaseFilter` for details on how to create custom filters. - .. seealso:: `Advanced Filters `_ + .. seealso:: :wiki:`Advanced Filters ` Attributes: name (:obj:`str`): Name for this filter. Defaults to the type of filter. @@ -1545,8 +1544,7 @@ class Regex(MessageFilter): With a :attr:`telegram.Message.text` of `x`, will only ever return the matches for the first filter, since the second one is never evaluated. - .. seealso:: `Types of Handlers `_ + .. seealso:: :wiki:`Types of Handlers ` Args: pattern (:obj:`str` | :func:`re.Pattern `): The regex pattern. diff --git a/telegram/request/_baserequest.py b/telegram/request/_baserequest.py index d4df2cfb3a0..96c61f20d19 100644 --- a/telegram/request/_baserequest.py +++ b/telegram/request/_baserequest.py @@ -73,10 +73,8 @@ class BaseRequest( To use a custom library for this, you can override :meth:`parse_json_payload` and implement custom logic to encode the keys of :attr:`telegram.request.RequestData.parameters`. - .. seealso:: `Architecture Overview `_, - `Builder Pattern `_ + .. seealso:: :wiki:`Architecture Overview `, + :wiki:`Builder Pattern ` .. versionadded:: 20.0 """ diff --git a/telegram/warnings.py b/telegram/warnings.py index dee3ff4c2d5..b1426eabfce 100644 --- a/telegram/warnings.py +++ b/telegram/warnings.py @@ -28,8 +28,7 @@ class PTBUserWarning(UserWarning): """ Custom user warning class used for warnings in this library. - .. seealso:: `Exceptions, Warnings and Logging `_ + .. seealso:: :wiki:`Exceptions, Warnings and Logging ` .. versionadded:: 20.0 """ From 8ae896dae2992e28954a55087427906d2de35741 Mon Sep 17 00:00:00 2001 From: Dmitry Kolomatskiy <58207913+lemontree210@users.noreply.github.com> Date: Sat, 17 Dec 2022 17:22:24 +0300 Subject: [PATCH 2/3] fix: add 2 more :wiki: links --- telegram/_dice.py | 4 ++-- telegram/ext/_applicationbuilder.py | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/telegram/_dice.py b/telegram/_dice.py index 74086f6829f..40381f2e837 100644 --- a/telegram/_dice.py +++ b/telegram/_dice.py @@ -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 `_. + can be found in our + :wiki:`wiki `. However, this behaviour is undocumented and might be changed by Telegram. .. diff --git a/telegram/ext/_applicationbuilder.py b/telegram/ext/_applicationbuilder.py index e7502c69bfb..903f922efa7 100644 --- a/telegram/ext/_applicationbuilder.py +++ b/telegram/ext/_applicationbuilder.py @@ -835,8 +835,7 @@ def job_queue( :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 `_, :any:`examples.timerbot` + .. seealso:: :wiki:`Job Queue `, :any:`examples.timerbot` Note: * :meth:`telegram.ext.JobQueue.set_application` will be called automatically by From 4b66367f6bf92efa7edfbb9c221e894628199700 Mon Sep 17 00:00:00 2001 From: Dmitry Kolomatskiy <58207913+lemontree210@users.noreply.github.com> Date: Sat, 17 Dec 2022 17:32:13 +0300 Subject: [PATCH 3/3] move examples I missed before to `Examples:` block only indent changed for link to ChatMemberBot --- telegram/_chatmember.py | 2 +- telegram/ext/_applicationbuilder.py | 26 ++++++++++++++++++-------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/telegram/_chatmember.py b/telegram/_chatmember.py index 678e682b7a3..8e80ecc8cc4 100644 --- a/telegram/_chatmember.py +++ b/telegram/_chatmember.py @@ -45,7 +45,7 @@ class ChatMember(TelegramObject): considered equal, if their :attr:`user` and :attr:`status` are equal. Examples: - :any:`Chat Member Bot ` + :any:`Chat Member Bot ` .. versionchanged:: 20.0 diff --git a/telegram/ext/_applicationbuilder.py b/telegram/ext/_applicationbuilder.py index 903f922efa7..b3b270e5af1 100644 --- a/telegram/ext/_applicationbuilder.py +++ b/telegram/ext/_applicationbuilder.py @@ -669,8 +669,10 @@ def private_key( """Sets the private key and corresponding password for decryption of telegram passport data for :attr:`telegram.ext.Application.bot`. - .. seealso:: :any:`Passport Bot Example `, - :wiki:`Telegram Passports ` + Examples: + :any:`Passport Bot ` + + .. seealso:: :wiki:`Telegram Passports ` Args: private_key (:obj:`bytes` | :obj:`str` | :obj:`pathlib.Path`): The private key or the @@ -729,8 +731,10 @@ def arbitrary_callback_data( pip install python-telegram-bot[callback-data] - .. seealso:: :wiki:`Arbitrary callback_data `, - :any:`examples.arbitrarycallbackdatabot` + Examples: + :any:`Arbitrary callback_data Bot ` + + .. seealso:: :wiki:`Arbitrary callback_data ` Args: arbitrary_callback_data (:obj:`bool` | :obj:`int`): If :obj:`True` is passed, the @@ -835,7 +839,10 @@ def job_queue( :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:: :wiki:`Job Queue `, :any:`examples.timerbot` + Examples: + :any:`Timer Bot ` + + .. seealso:: :wiki:`Job Queue ` Note: * :meth:`telegram.ext.JobQueue.set_application` will be called automatically by @@ -870,8 +877,10 @@ def persistence(self: BuilderType, persistence: "BasePersistence") -> BuilderTyp :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:: :wiki:`Making Your Bot Persistent `, - :any:`examples.persistentconversationbot` + Examples: + :any:`Persistent Conversation Bot ` + + .. seealso:: :wiki:`Making Your Bot Persistent ` Warning: If a :class:`telegram.ext.ContextTypes` instance is set via :meth:`context_types`, @@ -893,7 +902,8 @@ def context_types( """Sets a :class:`telegram.ext.ContextTypes` instance for :attr:`telegram.ext.Application.context_types`. - .. seealso:: :any:`examples.contexttypesbot` + Examples: + :any:`Context Types Bot ` Args: context_types (:class:`telegram.ext.ContextTypes`): The context types.