mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2025-01-03 09:49:21 +01:00
Doc Fixes (#2359)
* Improve some badges for PTB-Raw * doc fix for add_error_handler * Some rendering * Doc fixes for filters.py * render '@' as code Co-authored-by: Harshil <ilovebhagwan@gmail.com>
This commit is contained in:
parent
2a4a0d0ccd
commit
552298595c
4 changed files with 36 additions and 32 deletions
|
@ -13,11 +13,11 @@ We have a vibrant community of developers helping each other in our `Telegram gr
|
||||||
*Stay tuned for library updates and new releases on our* `Telegram Channel <https://telegram.me/pythontelegrambotchannel>`_.
|
*Stay tuned for library updates and new releases on our* `Telegram Channel <https://telegram.me/pythontelegrambotchannel>`_.
|
||||||
|
|
||||||
.. image:: https://img.shields.io/pypi/v/python-telegram-bot-raw.svg
|
.. image:: https://img.shields.io/pypi/v/python-telegram-bot-raw.svg
|
||||||
:target: https://pypi.org/project/python-telegram-bot/
|
:target: https://pypi.org/project/python-telegram-bot-raw/
|
||||||
:alt: PyPi Package Version
|
:alt: PyPi Package Version
|
||||||
|
|
||||||
.. image:: https://img.shields.io/pypi/pyversions/python-telegram-bot-raw.svg
|
.. image:: https://img.shields.io/pypi/pyversions/python-telegram-bot-raw.svg
|
||||||
:target: https://pypi.org/project/python-telegram-bot/
|
:target: https://pypi.org/project/python-telegram-bot-raw/
|
||||||
:alt: Supported Python versions
|
:alt: Supported Python versions
|
||||||
|
|
||||||
.. image:: https://img.shields.io/badge/Bot%20API-5.0-blue?logo=telegram
|
.. image:: https://img.shields.io/badge/Bot%20API-5.0-blue?logo=telegram
|
||||||
|
@ -25,10 +25,10 @@ We have a vibrant community of developers helping each other in our `Telegram gr
|
||||||
:alt: Supported Bot API versions
|
:alt: Supported Bot API versions
|
||||||
|
|
||||||
.. image:: https://img.shields.io/pypi/dm/python-telegram-bot-raw
|
.. image:: https://img.shields.io/pypi/dm/python-telegram-bot-raw
|
||||||
:target: https://pypistats.org/packages/python-telegram-bot
|
:target: https://pypistats.org/packages/python-telegram-bot-raw
|
||||||
:alt: PyPi Package Monthly Download
|
:alt: PyPi Package Monthly Download
|
||||||
|
|
||||||
.. image:: https://img.shields.io/badge/docs-latest-af1a97.svg
|
.. image:: https://readthedocs.org/projects/python-telegram-bot/badge/?version=stable
|
||||||
:target: https://python-telegram-bot.readthedocs.io/
|
:target: https://python-telegram-bot.readthedocs.io/
|
||||||
:alt: Documentation Status
|
:alt: Documentation Status
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ def run_async(
|
||||||
|
|
||||||
class DispatcherHandlerStop(Exception):
|
class DispatcherHandlerStop(Exception):
|
||||||
"""
|
"""
|
||||||
Raise this in handler to prevent execution any other handler (even in different group).
|
Raise this in handler to prevent execution of any other handler (even in different group).
|
||||||
|
|
||||||
In order to use this exception in a :class:`telegram.ext.ConversationHandler`, pass the
|
In order to use this exception in a :class:`telegram.ext.ConversationHandler`, pass the
|
||||||
optional ``state`` parameter instead of returning the next state:
|
optional ``state`` parameter instead of returning the next state:
|
||||||
|
@ -619,7 +619,7 @@ class Dispatcher:
|
||||||
callback (:obj:`callable`): The callback function for this error handler. Will be
|
callback (:obj:`callable`): The callback function for this error handler. Will be
|
||||||
called when an error is raised. Callback signature for context based API:
|
called when an error is raised. Callback signature for context based API:
|
||||||
|
|
||||||
``def callback(update: Update, context: CallbackContext)``
|
``def callback(update: object, context: CallbackContext)``
|
||||||
|
|
||||||
The error that happened will be present in context.error.
|
The error that happened will be present in context.error.
|
||||||
run_async (:obj:`bool`, optional): Whether this handlers callback should be run
|
run_async (:obj:`bool`, optional): Whether this handlers callback should be run
|
||||||
|
|
|
@ -91,7 +91,7 @@ class BaseFilter(ABC):
|
||||||
|
|
||||||
|
|
||||||
If you want to create your own filters create a class inheriting from either
|
If you want to create your own filters create a class inheriting from either
|
||||||
:class:`MessageFilter` or :class:`UpdateFilter` and implement a :meth:``filter`` method that
|
:class:`MessageFilter` or :class:`UpdateFilter` and implement a :meth:`filter` method that
|
||||||
returns a boolean: :obj:`True` if the message should be
|
returns a boolean: :obj:`True` if the message should be
|
||||||
handled, :obj:`False` otherwise.
|
handled, :obj:`False` otherwise.
|
||||||
Note that the filters work only as class instances, not
|
Note that the filters work only as class instances, not
|
||||||
|
@ -148,7 +148,8 @@ class MessageFilter(BaseFilter, ABC):
|
||||||
"""Base class for all Message Filters. In contrast to :class:`UpdateFilter`, the object passed
|
"""Base class for all Message Filters. In contrast to :class:`UpdateFilter`, the object passed
|
||||||
to :meth:`filter` is ``update.effective_message``.
|
to :meth:`filter` is ``update.effective_message``.
|
||||||
|
|
||||||
Please see :class:`telegram.ext.BaseFilter` for details on how to create custom filters.
|
Please see :class:`telegram.ext.filters.BaseFilter` for details on how to create custom
|
||||||
|
filters.
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
name (:obj:`str`): Name for this filter. Defaults to the type of filter.
|
name (:obj:`str`): Name for this filter. Defaults to the type of filter.
|
||||||
|
@ -176,11 +177,12 @@ class MessageFilter(BaseFilter, ABC):
|
||||||
|
|
||||||
|
|
||||||
class UpdateFilter(BaseFilter, ABC):
|
class UpdateFilter(BaseFilter, ABC):
|
||||||
"""Base class for all Update Filters. In contrast to :class:`UpdateFilter`, the object
|
"""Base class for all Update Filters. In contrast to :class:`MessageFilter`, the object
|
||||||
passed to :meth:`filter` is ``update``, which allows to create filters like
|
passed to :meth:`filter` is ``update``, which allows to create filters like
|
||||||
:attr:`Filters.update.edited_message`.
|
:attr:`Filters.update.edited_message`.
|
||||||
|
|
||||||
Please see :class:`telegram.ext.BaseFilter` for details on how to create custom filters.
|
Please see :class:`telegram.ext.filters.BaseFilter` for details on how to create custom
|
||||||
|
filters.
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
name (:obj:`str`): Name for this filter. Defaults to the type of filter.
|
name (:obj:`str`): Name for this filter. Defaults to the type of filter.
|
||||||
|
@ -316,7 +318,7 @@ class MergedFilter(UpdateFilter):
|
||||||
|
|
||||||
class XORFilter(UpdateFilter):
|
class XORFilter(UpdateFilter):
|
||||||
"""Convenience filter acting as wrapper for :class:`MergedFilter` representing the an XOR gate
|
"""Convenience filter acting as wrapper for :class:`MergedFilter` representing the an XOR gate
|
||||||
for two filters
|
for two filters.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
base_filter: Filter 1 of the merged filter.
|
base_filter: Filter 1 of the merged filter.
|
||||||
|
@ -1413,7 +1415,8 @@ officedocument.wordprocessingml.document")``.
|
||||||
user_id(:class:`telegram.utils.types.SLT[int]`, optional):
|
user_id(:class:`telegram.utils.types.SLT[int]`, optional):
|
||||||
Which user ID(s) to allow through.
|
Which user ID(s) to allow through.
|
||||||
username(:class:`telegram.utils.types.SLT[str]`, optional):
|
username(:class:`telegram.utils.types.SLT[str]`, optional):
|
||||||
Which username(s) to allow through. Leading '@'s in usernames will be discarded.
|
Which username(s) to allow through. Leading ``'@'`` s in usernames will be
|
||||||
|
discarded.
|
||||||
allow_empty(:obj:`bool`, optional): Whether updates should be processed, if no user
|
allow_empty(:obj:`bool`, optional): Whether updates should be processed, if no user
|
||||||
is specified in :attr:`user_ids` and :attr:`usernames`. Defaults to :obj:`False`
|
is specified in :attr:`user_ids` and :attr:`usernames`. Defaults to :obj:`False`
|
||||||
|
|
||||||
|
@ -1422,8 +1425,8 @@ officedocument.wordprocessingml.document")``.
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
user_ids(set(:obj:`int`), optional): Which user ID(s) to allow through.
|
user_ids(set(:obj:`int`), optional): Which user ID(s) to allow through.
|
||||||
usernames(set(:obj:`str`), optional): Which username(s) (without leading '@') to allow
|
usernames(set(:obj:`str`), optional): Which username(s) (without leading ``'@'``) to
|
||||||
through.
|
allow through.
|
||||||
allow_empty(:obj:`bool`, optional): Whether updates should be processed, if no user
|
allow_empty(:obj:`bool`, optional): Whether updates should be processed, if no user
|
||||||
is specified in :attr:`user_ids` and :attr:`usernames`.
|
is specified in :attr:`user_ids` and :attr:`usernames`.
|
||||||
|
|
||||||
|
@ -1456,7 +1459,7 @@ officedocument.wordprocessingml.document")``.
|
||||||
Args:
|
Args:
|
||||||
username(:class:`telegram.utils.types.SLT[str]`, optional):
|
username(:class:`telegram.utils.types.SLT[str]`, optional):
|
||||||
Which username(s) to allow through.
|
Which username(s) to allow through.
|
||||||
Leading '@'s in usernames will be discarded.
|
Leading ``'@'`` s in usernames will be discarded.
|
||||||
"""
|
"""
|
||||||
return super().add_usernames(username)
|
return super().add_usernames(username)
|
||||||
|
|
||||||
|
@ -1477,7 +1480,7 @@ officedocument.wordprocessingml.document")``.
|
||||||
Args:
|
Args:
|
||||||
username(:class:`telegram.utils.types.SLT[str]`, optional):
|
username(:class:`telegram.utils.types.SLT[str]`, optional):
|
||||||
Which username(s) to disallow through.
|
Which username(s) to disallow through.
|
||||||
Leading '@'s in usernames will be discarded.
|
Leading ``'@'`` s in usernames will be discarded.
|
||||||
"""
|
"""
|
||||||
return super().remove_usernames(username)
|
return super().remove_usernames(username)
|
||||||
|
|
||||||
|
@ -1511,7 +1514,8 @@ officedocument.wordprocessingml.document")``.
|
||||||
bot_id(:class:`telegram.utils.types.SLT[int]`, optional):
|
bot_id(:class:`telegram.utils.types.SLT[int]`, optional):
|
||||||
Which bot ID(s) to allow through.
|
Which bot ID(s) to allow through.
|
||||||
username(:class:`telegram.utils.types.SLT[str]`, optional):
|
username(:class:`telegram.utils.types.SLT[str]`, optional):
|
||||||
Which username(s) to allow through. Leading '@'s in usernames will be discarded.
|
Which username(s) to allow through. Leading ``'@'`` s in usernames will be
|
||||||
|
discarded.
|
||||||
allow_empty(:obj:`bool`, optional): Whether updates should be processed, if no user
|
allow_empty(:obj:`bool`, optional): Whether updates should be processed, if no user
|
||||||
is specified in :attr:`bot_ids` and :attr:`usernames`. Defaults to :obj:`False`
|
is specified in :attr:`bot_ids` and :attr:`usernames`. Defaults to :obj:`False`
|
||||||
|
|
||||||
|
@ -1520,8 +1524,8 @@ officedocument.wordprocessingml.document")``.
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
bot_ids(set(:obj:`int`), optional): Which bot ID(s) to allow through.
|
bot_ids(set(:obj:`int`), optional): Which bot ID(s) to allow through.
|
||||||
usernames(set(:obj:`str`), optional): Which username(s) (without leading '@') to allow
|
usernames(set(:obj:`str`), optional): Which username(s) (without leading ``'@'``) to
|
||||||
through.
|
allow through.
|
||||||
allow_empty(:obj:`bool`, optional): Whether updates should be processed, if no bot
|
allow_empty(:obj:`bool`, optional): Whether updates should be processed, if no bot
|
||||||
is specified in :attr:`bot_ids` and :attr:`usernames`.
|
is specified in :attr:`bot_ids` and :attr:`usernames`.
|
||||||
|
|
||||||
|
@ -1554,7 +1558,7 @@ officedocument.wordprocessingml.document")``.
|
||||||
Args:
|
Args:
|
||||||
username(:class:`telegram.utils.types.SLT[str]`, optional):
|
username(:class:`telegram.utils.types.SLT[str]`, optional):
|
||||||
Which username(s) to allow through.
|
Which username(s) to allow through.
|
||||||
Leading '@'s in usernames will be discarded.
|
Leading ``'@'`` s in usernames will be discarded.
|
||||||
"""
|
"""
|
||||||
return super().add_usernames(username)
|
return super().add_usernames(username)
|
||||||
|
|
||||||
|
@ -1576,7 +1580,7 @@ officedocument.wordprocessingml.document")``.
|
||||||
Args:
|
Args:
|
||||||
username(:class:`telegram.utils.types.SLT[str]`, optional):
|
username(:class:`telegram.utils.types.SLT[str]`, optional):
|
||||||
Which username(s) to disallow through.
|
Which username(s) to disallow through.
|
||||||
Leading '@'s in usernames will be discarded.
|
Leading ``'@'`` s in usernames will be discarded.
|
||||||
"""
|
"""
|
||||||
return super().remove_usernames(username)
|
return super().remove_usernames(username)
|
||||||
|
|
||||||
|
@ -1610,7 +1614,7 @@ officedocument.wordprocessingml.document")``.
|
||||||
Which chat ID(s) to allow through.
|
Which chat ID(s) to allow through.
|
||||||
username(:class:`telegram.utils.types.SLT[str]`, optional):
|
username(:class:`telegram.utils.types.SLT[str]`, optional):
|
||||||
Which username(s) to allow through.
|
Which username(s) to allow through.
|
||||||
Leading `'@'` s in usernames will be discarded.
|
Leading ``'@'`` s in usernames will be discarded.
|
||||||
allow_empty(:obj:`bool`, optional): Whether updates should be processed, if no chat
|
allow_empty(:obj:`bool`, optional): Whether updates should be processed, if no chat
|
||||||
is specified in :attr:`chat_ids` and :attr:`usernames`. Defaults to :obj:`False`
|
is specified in :attr:`chat_ids` and :attr:`usernames`. Defaults to :obj:`False`
|
||||||
|
|
||||||
|
@ -1619,8 +1623,8 @@ officedocument.wordprocessingml.document")``.
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
chat_ids(set(:obj:`int`), optional): Which chat ID(s) to allow through.
|
chat_ids(set(:obj:`int`), optional): Which chat ID(s) to allow through.
|
||||||
usernames(set(:obj:`str`), optional): Which username(s) (without leading '@') to allow
|
usernames(set(:obj:`str`), optional): Which username(s) (without leading ``'@'``) to
|
||||||
through.
|
allow through.
|
||||||
allow_empty(:obj:`bool`, optional): Whether updates should be processed, if no chat
|
allow_empty(:obj:`bool`, optional): Whether updates should be processed, if no chat
|
||||||
is specified in :attr:`chat_ids` and :attr:`usernames`.
|
is specified in :attr:`chat_ids` and :attr:`usernames`.
|
||||||
|
|
||||||
|
@ -1636,7 +1640,7 @@ officedocument.wordprocessingml.document")``.
|
||||||
Args:
|
Args:
|
||||||
username(:class:`telegram.utils.types.SLT[str]`, optional):
|
username(:class:`telegram.utils.types.SLT[str]`, optional):
|
||||||
Which username(s) to allow through.
|
Which username(s) to allow through.
|
||||||
Leading `'@'` s in usernames will be discarded.
|
Leading ``'@'`` s in usernames will be discarded.
|
||||||
"""
|
"""
|
||||||
return super().add_usernames(username)
|
return super().add_usernames(username)
|
||||||
|
|
||||||
|
@ -1657,7 +1661,7 @@ officedocument.wordprocessingml.document")``.
|
||||||
Args:
|
Args:
|
||||||
username(:class:`telegram.utils.types.SLT[str]`, optional):
|
username(:class:`telegram.utils.types.SLT[str]`, optional):
|
||||||
Which username(s) to disallow through.
|
Which username(s) to disallow through.
|
||||||
Leading '@'s in usernames will be discarded.
|
Leading ``'@'`` s in usernames will be discarded.
|
||||||
"""
|
"""
|
||||||
return super().remove_usernames(username)
|
return super().remove_usernames(username)
|
||||||
|
|
||||||
|
@ -1700,7 +1704,7 @@ officedocument.wordprocessingml.document")``.
|
||||||
Which sender chat chat ID(s) to allow through.
|
Which sender chat chat ID(s) to allow through.
|
||||||
username(:class:`telegram.utils.types.SLT[str]`, optional):
|
username(:class:`telegram.utils.types.SLT[str]`, optional):
|
||||||
Which sender chat username(s) to allow through.
|
Which sender chat username(s) to allow through.
|
||||||
Leading `'@'` s in usernames will be discarded.
|
Leading ``'@'`` s in usernames will be discarded.
|
||||||
allow_empty(:obj:`bool`, optional): Whether updates should be processed, if no sender
|
allow_empty(:obj:`bool`, optional): Whether updates should be processed, if no sender
|
||||||
chat is specified in :attr:`chat_ids` and :attr:`usernames`. Defaults to
|
chat is specified in :attr:`chat_ids` and :attr:`usernames`. Defaults to
|
||||||
:obj:`False`
|
:obj:`False`
|
||||||
|
@ -1711,7 +1715,7 @@ officedocument.wordprocessingml.document")``.
|
||||||
Attributes:
|
Attributes:
|
||||||
chat_ids(set(:obj:`int`), optional): Which sender chat chat ID(s) to allow through.
|
chat_ids(set(:obj:`int`), optional): Which sender chat chat ID(s) to allow through.
|
||||||
usernames(set(:obj:`str`), optional): Which sender chat username(s) (without leading
|
usernames(set(:obj:`str`), optional): Which sender chat username(s) (without leading
|
||||||
'@') to allow through.
|
``'@'``) to allow through.
|
||||||
allow_empty(:obj:`bool`, optional): Whether updates should be processed, if no sender
|
allow_empty(:obj:`bool`, optional): Whether updates should be processed, if no sender
|
||||||
chat is specified in :attr:`chat_ids` and :attr:`usernames`.
|
chat is specified in :attr:`chat_ids` and :attr:`usernames`.
|
||||||
super_group: Messages whose sender chat is a super group.
|
super_group: Messages whose sender chat is a super group.
|
||||||
|
@ -1735,7 +1739,7 @@ officedocument.wordprocessingml.document")``.
|
||||||
Args:
|
Args:
|
||||||
username(:class:`telegram.utils.types.SLT[str]`, optional):
|
username(:class:`telegram.utils.types.SLT[str]`, optional):
|
||||||
Which sender chat username(s) to allow through.
|
Which sender chat username(s) to allow through.
|
||||||
Leading `'@'` s in usernames will be discarded.
|
Leading ``'@'`` s in usernames will be discarded.
|
||||||
"""
|
"""
|
||||||
return super().add_usernames(username)
|
return super().add_usernames(username)
|
||||||
|
|
||||||
|
@ -1756,7 +1760,7 @@ officedocument.wordprocessingml.document")``.
|
||||||
Args:
|
Args:
|
||||||
username(:class:`telegram.utils.types.SLT[str]`, optional):
|
username(:class:`telegram.utils.types.SLT[str]`, optional):
|
||||||
Which sender chat username(s) to disallow through.
|
Which sender chat username(s) to disallow through.
|
||||||
Leading `'@'` s in usernames will be discarded.
|
Leading ``'@'`` s in usernames will be discarded.
|
||||||
"""
|
"""
|
||||||
return super().remove_usernames(username)
|
return super().remove_usernames(username)
|
||||||
|
|
||||||
|
|
|
@ -121,11 +121,11 @@ class InlineQuery(TelegramObject):
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
auto_pagination (:obj:`bool`, optional): If set to :obj:`True`, :attr:`offset` will be
|
auto_pagination (:obj:`bool`, optional): If set to :obj:`True`, :attr:`offset` will be
|
||||||
passed as :attr:`current_offset` to :meth:telegram.Bot.answer_inline_query`.
|
passed as :attr:`current_offset` to :meth:`telegram.Bot.answer_inline_query`.
|
||||||
Defaults to :obj:`False`.
|
Defaults to :obj:`False`.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
TypeError: If both :attr:`current_offset` and `auto_pagination` are supplied.
|
TypeError: If both :attr:`current_offset` and attr:`auto_pagination` are supplied.
|
||||||
"""
|
"""
|
||||||
if current_offset and auto_pagination:
|
if current_offset and auto_pagination:
|
||||||
# We raise TypeError instead of ValueError for backwards compatibility with versions
|
# We raise TypeError instead of ValueError for backwards compatibility with versions
|
||||||
|
|
Loading…
Reference in a new issue