Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add references to wiki #3306

Merged
merged 21 commits into from
Oct 31, 2022
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
82674a2
feat(docs) add `..seealso::` links to "Your First Bot" in wiki
lemontree210 Oct 23, 2022
b5a1117
feat(docs) add links to "Architecture" and pages mentioned there
lemontree210 Oct 24, 2022
c4ccdc1
feat(docs) add links to "Builder Pattern" wiki page
lemontree210 Oct 24, 2022
256772a
feat(docs) add links to "Types of Handlers" wiki page
lemontree210 Oct 24, 2022
e028199
fix(docs) make link text to Builder Battern unique
lemontree210 Oct 24, 2022
441e318
fix(docs) add link to Exceptions/Warnings/Logging wiki page
lemontree210 Oct 24, 2022
cfc3d94
feat/fix(docs) add links to Concurrency wiki, fix link to Architecture
lemontree210 Oct 24, 2022
f61088b
feat(docs) add links to Notable Features wiki: "Filters" .. "Job Queue"
lemontree210 Oct 25, 2022
eee0292
fix(docs) add `Updater.stop` to `run_polling` to resolve conflict
lemontree210 Oct 25, 2022
cd9268b
Merge branch 'doc-fixes' into docs-references-to-examples-and-wiki-3110
lemontree210 Oct 25, 2022
3594c99
feat(docs) add links to "Arbitrary `callback_data`" wiki page
lemontree210 Oct 25, 2022
8354b4b
feat(docs) add links to "Avoiding Flood limits" wiki page
lemontree210 Oct 25, 2022
e810a0c
feat(docs) add links to "Webhooks" wiki page
lemontree210 Oct 25, 2022
87aa42e
Merge remote-tracking branch 'origin/docs-references-to-examples-and-…
lemontree210 Oct 25, 2022
c3e86b9
feat(docs) fix links to "Arbitrary `callback_data`" wiki page
lemontree210 Oct 25, 2022
82cbe69
feat(docs) add links to echobot, timerbot and 2 conversationbots
lemontree210 Oct 25, 2022
0b7ba85
fix(docs) fix all remarks except adding Concurrency to all handlers
lemontree210 Oct 25, 2022
32a2a89
feat(docs) add link to Concurrency wiki to all handlers
lemontree210 Oct 26, 2022
5c1a86b
feat(docs) add links to examples
lemontree210 Oct 26, 2022
c5bac06
address comments: remove links to examples
lemontree210 Oct 26, 2022
c8a13eb
fix(docs) address comments
lemontree210 Oct 27, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions telegram/_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,12 @@ class Bot(TelegramObject, AbstractAsyncContextManager):

.. seealso:: :attr:`telegram.ext.Application.bot`,
:attr:`telegram.ext.CallbackContext.bot`,
:attr:`telegram.ext.Updater.bot`
:attr:`telegram.ext.Updater.bot`,
`Builder Pattern <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Builder-Pattern>`_,
`Making Your Bot Persistent <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Making-your-bot-persistent>`_
lemontree210 marked this conversation as resolved.
Show resolved Hide resolved


.. versionadded:: 13.2
Objects of this class are comparable in terms of equality. Two objects of this class are
Expand Down Expand Up @@ -2620,7 +2625,8 @@ async def answer_inline_query(
:paramref:`telegram.InlineQuery.answer.auto_pagination` set to :obj:`True`, which will
take care of passing the correct value.

.. seealso:: :attr:`telegram.InlineQuery.answer`
.. seealso:: :attr:`telegram.InlineQuery.answer`, `Your First Bot <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Extensions-–-Your-first-Bot>`_
lemontree210 marked this conversation as resolved.
Show resolved Hide resolved

Args:
inline_query_id (:obj:`str`): Unique identifier for the answered query.
Expand Down
3 changes: 3 additions & 0 deletions telegram/_inline/inlinekeyboardbutton.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ 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>`_

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
the button. The Web App will be able to send an arbitrary message on behalf of the user
Expand Down
7 changes: 7 additions & 0 deletions telegram/_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ class Message(TelegramObject):
from_user (:class:`telegram.User`, optional): Sender of the message; empty for messages
sent to channels. For backward compatibility, this will contain a fake sender user in
non-channel chats, if the message was sent on behalf of a chat.

.. seealso:: :any:`Conversationbot Example <examples.conversationbot>`
lemontree210 marked this conversation as resolved.
Show resolved Hide resolved
sender_chat (:class:`telegram.Chat`, optional): Sender of the message, sent on behalf of a
chat. For example, the channel itself for channel posts, the supergroup itself for
messages from anonymous group administrators, the linked channel for messages
Expand Down Expand Up @@ -252,6 +254,8 @@ class Message(TelegramObject):
from_user (:class:`telegram.User`): Optional. Sender of the message; empty for messages
sent to channels. For backward compatibility, this will contain a fake sender user in
non-channel chats, if the message was sent on behalf of a chat.

.. seealso:: :any:`Conversationbot Example <examples.conversationbot>`
sender_chat (:class:`telegram.Chat`): Optional. Sender of the message, sent on behalf of a
chat. For example, the channel itself for channel posts, the supergroup itself for
messages from anonymous group administrators, the linked channel for messages
Expand Down Expand Up @@ -817,6 +821,9 @@ async def reply_text(

For the documentation of the arguments, please see :meth:`telegram.Bot.send_message`.

.. seealso:: :any:`Conversationbot Example <examples.conversationbot>`,
:any:`Conversationbot Example 2 <examples.conversationbot2>`

Keyword Args:
quote (:obj:`bool`, optional): If set to :obj:`True`, the message is sent as an actual
reply to this message. If ``reply_to_message_id`` is passed, this parameter will be
Expand Down
3 changes: 3 additions & 0 deletions telegram/_replykeyboardmarkup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ class ReplyKeyboardMarkup(TelegramObject):
A user requests to change the bot's language, bot replies to the request with a keyboard
to select the new language. Other users in the group don't see the keyboard.

.. seealso:: :any:`Conversationbot Example <examples.conversationbot>`,
:any:`Conversationbot Example 2 <examples.conversationbot2>`

Args:
keyboard (List[List[:obj:`str` | :class:`telegram.KeyboardButton`]]): Array of button rows,
each represented by an Array of :class:`telegram.KeyboardButton` objects.
Expand Down
3 changes: 3 additions & 0 deletions telegram/_replykeyboardremove.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ class ReplyKeyboardRemove(TelegramObject):
User will not be able to summon this keyboard; if you want to hide the keyboard from
sight but keep it accessible, use :attr:`telegram.ReplyKeyboardMarkup.one_time_keyboard`.

.. seealso:: :any:`Conversationbot Example <examples.conversationbot>`,
:any:`Conversationbot Example 2 <examples.conversationbot2>`

Args:
selective (:obj:`bool`, optional): Use this parameter if you want to remove the keyboard
for specific users only. Targets:
Expand Down
3 changes: 3 additions & 0 deletions telegram/_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ 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>`_

Args:
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
Expand Down
11 changes: 10 additions & 1 deletion telegram/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@ def _lstrip_str(in_s: str, lstr: str) -> str:


class TelegramError(Exception):
"""Base class for Telegram errors."""
"""
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>`_
"""

__slots__ = ("message",)

Expand Down Expand Up @@ -137,6 +142,10 @@ 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>`_,

Args:
new_chat_id (:obj:`int`): The new chat id of the group.

Expand Down
3 changes: 3 additions & 0 deletions telegram/ext/_aioratelimiter.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ 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>`_

.. versionadded:: 20.0

Args:
Expand Down
40 changes: 37 additions & 3 deletions telegram/ext/_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ class Application(Generic[BT, CCT, UD, CD, BD, JQ], AbstractAsyncContextManager)
finally:
await application.shutdown()

.. seealso:: `Your First Bot <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Extensions-–-Your-first-Bot>`_,
:any:`Echobot Example <examples.echobot>`

.. versionchanged:: 20.0

* Initialization is now done through the :class:`telegram.ext.ApplicationBuilder`.
Expand Down Expand Up @@ -323,6 +327,9 @@ def running(self) -> bool:
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 <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Concurrency>`_
"""
return self._concurrent_updates

Expand Down Expand Up @@ -597,7 +604,10 @@ def run_polling(
.. seealso::
:meth:`initialize`, :meth:`start`, :meth:`stop`, :meth:`shutdown`
:meth:`telegram.ext.Updater.start_polling`, :meth:`telegram.ext.Updater.stop`,
:meth:`run_webhook`
:meth:`run_webhook`,
`Your First Bot <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Extensions-–-Your-first-Bot>`_,
:any:`Echobot Example <examples.echobot>`
lemontree210 marked this conversation as resolved.
Show resolved Hide resolved

Args:
poll_interval (:obj:`float`, optional): Time to wait between polling updates from
Expand Down Expand Up @@ -713,7 +723,8 @@ 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`
:meth:`run_polling`,
`Webhooks <https://github.com/python-telegram-bot/python-telegram-bot/wiki/Webhooks>`_

Args:
listen (:obj:`str`, optional): IP-Address to listen on. Defaults to
Expand Down Expand Up @@ -858,6 +869,9 @@ 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 <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Concurrency>`_

Args:
coroutine (:term:`coroutine function`): The coroutine to run as task.
update (:obj:`object`, optional): If set, will be passed to :meth:`process_error`
Expand Down Expand Up @@ -974,6 +988,9 @@ 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 <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Concurrency>`_

.. versionchanged:: 20.0
Persistence is now updated in an interval set by
:attr:`telegram.ext.BasePersistence.update_interval`.
Expand Down Expand Up @@ -1058,6 +1075,17 @@ def add_handler(self, handler: BaseHandler[Any, CCT], group: int = DEFAULT_GROUP
might lead to race conditions and undesired behavior. In particular, current
conversation states may be overridden by the loaded data.

.. seealso:: `Your First Bot <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Extensions-–-Your-first-Bot>`_,
lemontree210 marked this conversation as resolved.
Show resolved Hide resolved
`Architecture Overview <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Architecture>`_,
`Builder Pattern <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Builder-Pattern>`_,
`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>`_,
:any:`Echobot Example <examples.echobot>`

lemontree210 marked this conversation as resolved.
Show resolved Hide resolved
Args:
handler (:class:`telegram.ext.BaseHandler`): A BaseHandler instance.
group (:obj:`int`, optional): The group identifier. Default is ``0``.
Expand Down Expand Up @@ -1213,6 +1241,10 @@ 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 <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Storing-bot%2C-user-and-\
chat-related-data>`_,

Args:
message (:class:`telegram.Message`, optional): A message with either
:attr:`~telegram.Message.migrate_from_chat_id` or
Expand Down Expand Up @@ -1429,7 +1461,9 @@ def add_error_handler(
Note:
Attempts to add the same callback multiple times will be ignored.

.. seealso:: :any:`Errorhandler Example <examples.errorhandlerbot>`
.. seealso:: :any:`Errorhandler Example <examples.errorhandlerbot>`,
`Exceptions, Warnings and Logging <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Exceptions%2C-Warnings-and-Logging>`_

Args:
callback (:term:`coroutine function`): The callback function for this error handler.
Expand Down
9 changes: 7 additions & 2 deletions telegram/ext/_applicationbuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ 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>`_

.. _`builder pattern`: https://en.wikipedia.org/wiki/Builder_pattern
"""

Expand Down Expand Up @@ -714,8 +719,8 @@ def arbitrary_callback_data(
cached in memory. If not called, only strings can be used as callback data and no data will
be stored in memory.

.. seealso:: `Arbitrary callback_data <https://github.com/python-telegram-bot\
/python-telegram-bot/wiki/Arbitrary-callback_data>`_,
.. seealso:: `Arbitrary callback_data <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Arbitrary-callback_data>`_,
:any:`examples.arbitrarycallbackdatabot`

Args:
Expand Down
5 changes: 5 additions & 0 deletions telegram/ext/_basepersistence.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ 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>`_

.. versionchanged:: 20.0

* The parameters and attributes ``store_*_data`` were replaced by :attr:`store_data`.
Expand Down
5 changes: 5 additions & 0 deletions telegram/ext/_baseratelimiter.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ 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>`_

.. versionadded:: 20.0
"""

Expand Down
26 changes: 25 additions & 1 deletion telegram/ext/_callbackcontext.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ class CallbackContext(Generic[BT, UD, CD, BD]):
3. The type of :attr:`chat_data` (if :attr:`chat_data` is not :obj:`None`).
4. The type of :attr:`bot_data` (if :attr:`bot_data` is not :obj:`None`).

.. seealso:: :attr:`telegram.ext.ContextTypes.DEFAULT_TYPE`
.. seealso:: :attr:`telegram.ext.ContextTypes.DEFAULT_TYPE`,
`Your First Bot <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Extensions-–-Your-first-Bot>`_,
`Job Queue <https://github.com/python-telegram-bot/
python-telegram-bot/wiki/Extensions-%E2%80%93-JobQueue>`_

Args:
application (:class:`telegram.ext.Application`): The application associated with this
Expand All @@ -91,6 +95,9 @@ class CallbackContext(Generic[BT, UD, CD, BD]):
is handled by :class:`telegram.ext.CommandHandler`, :class:`telegram.ext.PrefixHandler`
or :class:`telegram.ext.StringCommandHandler`. It contains a list of the words in the
text after the command, using any whitespace string as a delimiter.

.. seealso:: `Your First Bot <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Extensions-–-Your-first-Bot>`_
lemontree210 marked this conversation as resolved.
Show resolved Hide resolved
error (:exc:`Exception`): Optional. The error that was raised. Only present when passed
to an error handler registered with :attr:`telegram.ext.Application.add_error_handler`.
job (:class:`telegram.ext.Job`): Optional. The job which originated this callback.
Expand Down Expand Up @@ -138,6 +145,10 @@ def application(self) -> "Application[BT, CCT, UD, CD, BD, Any]":
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 <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Storing-bot%2C-user-and-\
chat-related-data>`_,
"""
return self.application.bot_data

Expand All @@ -159,6 +170,10 @@ def chat_data(self) -> Optional[CD]:
<https://github.com/python-telegram-bot/python-telegram-bot/wiki/
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>`_,

.. versionchanged:: 20.0
The chat data is now also present in error handlers if the error is caused by a job.
"""
Expand All @@ -178,6 +193,10 @@ 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 <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/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.
"""
Expand Down Expand Up @@ -225,6 +244,9 @@ 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 <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Arbitrary-callback_data>`_

Args:
callback_query (:class:`telegram.CallbackQuery`): The callback query.

Expand Down Expand Up @@ -365,6 +387,8 @@ def job_queue(self) -> Optional["JobQueue"]:
: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>`_
"""
return self._application.job_queue

Expand Down
9 changes: 7 additions & 2 deletions telegram/ext/_callbackdatacache.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ class InvalidCallbackData(TelegramError):
"""
Raised when the received callback data has been tempered with or deleted from cache.

.. seealso:: `Arbitrary callback_data <https://github.com/\
python-telegram-bot/python-telegram-bot/wiki/Arbitrary-callback_data>`_

.. versionadded:: 13.6

Args:
Expand Down Expand Up @@ -95,8 +98,10 @@ class CallbackDataCache:
If necessary, will drop the least recently used items.

.. seealso:: :attr:`telegram.ext.ExtBot.callback_data_cache`,
`Arbitrary callback_data <https://github.com/python-telegram-bot/
python-telegram-bot/wiki/Arbitrary-callback_data>`_,
`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>`_,
`Arbitrary Callback Data Example <examples.arbitrarycallbackdatabot.html>`_

.. versionadded:: 13.6
Expand Down