diff --git a/README_RAW.rst b/README_RAW.rst index 4670bf7ac..6c8b61111 100644 --- a/README_RAW.rst +++ b/README_RAW.rst @@ -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 `_. .. 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 .. 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 .. 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 .. 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 -.. 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/ :alt: Documentation Status diff --git a/telegram/ext/dispatcher.py b/telegram/ext/dispatcher.py index ba52c53e7..ed20a6148 100644 --- a/telegram/ext/dispatcher.py +++ b/telegram/ext/dispatcher.py @@ -80,7 +80,7 @@ def run_async( 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 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 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. run_async (:obj:`bool`, optional): Whether this handlers callback should be run diff --git a/telegram/ext/filters.py b/telegram/ext/filters.py index 4e0997f37..eaf1f100e 100644 --- a/telegram/ext/filters.py +++ b/telegram/ext/filters.py @@ -91,7 +91,7 @@ class BaseFilter(ABC): 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 handled, :obj:`False` otherwise. 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 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: 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): - """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 :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: name (:obj:`str`): Name for this filter. Defaults to the type of filter. @@ -316,7 +318,7 @@ class MergedFilter(UpdateFilter): class XORFilter(UpdateFilter): """Convenience filter acting as wrapper for :class:`MergedFilter` representing the an XOR gate - for two filters + for two filters. Args: base_filter: Filter 1 of the merged filter. @@ -1413,7 +1415,8 @@ officedocument.wordprocessingml.document")``. user_id(:class:`telegram.utils.types.SLT[int]`, optional): Which user ID(s) to allow through. 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 is specified in :attr:`user_ids` and :attr:`usernames`. Defaults to :obj:`False` @@ -1422,8 +1425,8 @@ officedocument.wordprocessingml.document")``. Attributes: 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 - through. + usernames(set(:obj:`str`), optional): Which username(s) (without leading ``'@'``) to + allow through. allow_empty(:obj:`bool`, optional): Whether updates should be processed, if no user is specified in :attr:`user_ids` and :attr:`usernames`. @@ -1456,7 +1459,7 @@ officedocument.wordprocessingml.document")``. Args: username(:class:`telegram.utils.types.SLT[str]`, optional): 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) @@ -1477,7 +1480,7 @@ officedocument.wordprocessingml.document")``. Args: username(:class:`telegram.utils.types.SLT[str]`, optional): 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) @@ -1511,7 +1514,8 @@ officedocument.wordprocessingml.document")``. bot_id(:class:`telegram.utils.types.SLT[int]`, optional): Which bot ID(s) to allow through. 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 is specified in :attr:`bot_ids` and :attr:`usernames`. Defaults to :obj:`False` @@ -1520,8 +1524,8 @@ officedocument.wordprocessingml.document")``. Attributes: 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 - through. + usernames(set(:obj:`str`), optional): Which username(s) (without leading ``'@'``) to + allow through. allow_empty(:obj:`bool`, optional): Whether updates should be processed, if no bot is specified in :attr:`bot_ids` and :attr:`usernames`. @@ -1554,7 +1558,7 @@ officedocument.wordprocessingml.document")``. Args: username(:class:`telegram.utils.types.SLT[str]`, optional): 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) @@ -1576,7 +1580,7 @@ officedocument.wordprocessingml.document")``. Args: username(:class:`telegram.utils.types.SLT[str]`, optional): 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) @@ -1610,7 +1614,7 @@ officedocument.wordprocessingml.document")``. Which chat ID(s) to allow through. username(:class:`telegram.utils.types.SLT[str]`, optional): 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 is specified in :attr:`chat_ids` and :attr:`usernames`. Defaults to :obj:`False` @@ -1619,8 +1623,8 @@ officedocument.wordprocessingml.document")``. Attributes: 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 - through. + usernames(set(:obj:`str`), optional): Which username(s) (without leading ``'@'``) to + allow through. allow_empty(:obj:`bool`, optional): Whether updates should be processed, if no chat is specified in :attr:`chat_ids` and :attr:`usernames`. @@ -1636,7 +1640,7 @@ officedocument.wordprocessingml.document")``. Args: username(:class:`telegram.utils.types.SLT[str]`, optional): 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) @@ -1657,7 +1661,7 @@ officedocument.wordprocessingml.document")``. Args: username(:class:`telegram.utils.types.SLT[str]`, optional): 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) @@ -1700,7 +1704,7 @@ officedocument.wordprocessingml.document")``. Which sender chat chat ID(s) to allow through. username(:class:`telegram.utils.types.SLT[str]`, optional): 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 chat is specified in :attr:`chat_ids` and :attr:`usernames`. Defaults to :obj:`False` @@ -1711,7 +1715,7 @@ officedocument.wordprocessingml.document")``. Attributes: 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 - '@') to allow through. + ``'@'``) to allow through. allow_empty(:obj:`bool`, optional): Whether updates should be processed, if no sender chat is specified in :attr:`chat_ids` and :attr:`usernames`. super_group: Messages whose sender chat is a super group. @@ -1735,7 +1739,7 @@ officedocument.wordprocessingml.document")``. Args: username(:class:`telegram.utils.types.SLT[str]`, optional): 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) @@ -1756,7 +1760,7 @@ officedocument.wordprocessingml.document")``. Args: username(:class:`telegram.utils.types.SLT[str]`, optional): 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) diff --git a/telegram/inline/inlinequery.py b/telegram/inline/inlinequery.py index 231046520..84129949f 100644 --- a/telegram/inline/inlinequery.py +++ b/telegram/inline/inlinequery.py @@ -121,11 +121,11 @@ class InlineQuery(TelegramObject): Args: 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`. 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: # We raise TypeError instead of ValueError for backwards compatibility with versions