diff --git a/pywa/handlers.py b/pywa/handlers.py index f55d4719..842bcfa6 100644 --- a/pywa/handlers.py +++ b/pywa/handlers.py @@ -587,7 +587,7 @@ def __init__(self: WhatsApp): raise TypeError("This class cannot be instantiated.") def on_raw_update( - self: WhatsApp = None, + self: WhatsApp | Filter = None, filters: Filter = None, priority: int = 0, ) -> Callable[[_RawUpdateCallback], _RawUpdateCallback] | _RawUpdateCallback: @@ -628,7 +628,7 @@ def deco(callback: _RawUpdateCallback) -> _RawUpdateCallback: return deco def on_message( - self: WhatsApp = None, + self: WhatsApp | Filter = None, filters: Filter = None, priority: int = 0, ) -> Callable[[_MessageCallback], _MessageCallback] | _MessageCallback: @@ -671,7 +671,7 @@ def deco(callback: _MessageCallback) -> _MessageCallback: return deco def on_callback_button( - self: WhatsApp = None, + self: WhatsApp | Filter = None, filters: Filter = None, factory: type[CallbackData] | None = None, priority: int = 0, @@ -724,7 +724,7 @@ def deco(callback: _CallbackButtonCallback) -> _CallbackButtonCallback: return deco def on_callback_selection( - self: WhatsApp = None, + self: WhatsApp | Filter = None, filters: Filter = None, factory: type[CallbackData] | None = None, priority: int = 0, @@ -777,7 +777,7 @@ def deco(callback: _CallbackSelectionCallback) -> _CallbackSelectionCallback: return deco def on_message_status( - self: WhatsApp = None, + self: WhatsApp | Filter = None, filters: Filter = None, factory: type[CallbackData] | None = None, priority: int = 0, @@ -834,7 +834,7 @@ def deco(callback: _MessageStatusCallback) -> _MessageStatusCallback: return deco def on_chat_opened( - self: WhatsApp = None, + self: WhatsApp | Filter = None, filters: Filter = None, priority: int = 0, ) -> Callable[[_ChatOpenedCallback], _ChatOpenedCallback] | _ChatOpenedCallback: @@ -876,7 +876,7 @@ def deco(callback: _ChatOpenedCallback) -> _ChatOpenedCallback: return deco def on_template_status( - self: WhatsApp = None, + self: WhatsApp | Filter = None, filters: Filter = None, priority: int = 0, ) -> ( @@ -925,7 +925,7 @@ def deco(callback: _TemplateStatusCallback) -> _TemplateStatusCallback: return deco def on_flow_completion( - self: WhatsApp = None, + self: WhatsApp | Filter = None, filters: Filter = None, priority: int = 0, ) -> ( diff --git a/pywa/types/base_update.py b/pywa/types/base_update.py index b5414353..a8490cde 100644 --- a/pywa/types/base_update.py +++ b/pywa/types/base_update.py @@ -203,60 +203,6 @@ def reply_text( ... quote=True, ... ) - Example with keyboard buttons: - - >>> from pywa.types import Button - >>> msg.reply_text( - ... header="Hello from PyWa!", - ... text="What can I help you with?", - ... footer="Powered by PyWa", - ... buttons=[ - ... Button("Help", data="help"), - ... Button("About", data="about"), - ... ], - ... quote=True - ... ) - - Example with a section list: - - >>> from pywa.types import SectionList, Section, SectionRow - >>> msg.reply_text( - ... header="Hello from PyWa!", - ... text="What can I help you with?", - ... footer="Powered by PyWa", - ... buttons=SectionList( - ... button_title="Choose an option", - ... sections=[ - ... Section( - ... title="Help", - ... rows=[ - ... SectionRow( - ... title="Help", - ... callback_data="help", - ... description="Get help with PyWa", - ... ), - ... SectionRow( - ... title="About", - ... callback_data="about", - ... description="Learn more about PyWa", - ... ), - ... ], - ... ), - ... Section( - ... title="Other", - ... rows=[ - ... SectionRow( - ... title="GitHub", - ... callback_data="github", - ... description="View the PyWa GitHub repository", - ... ), - ... ], - ... ), - ... ], - ... ), - ... quote=True - ... ) - Args: text: The text to reply with (markdown allowed, max 4096 characters). header: The header of the reply (if buttons are provided, optional, up to 60 characters, diff --git a/pywa_async/types/base_update.py b/pywa_async/types/base_update.py index 965048a1..7f0b14d2 100644 --- a/pywa_async/types/base_update.py +++ b/pywa_async/types/base_update.py @@ -58,59 +58,6 @@ async def reply_text( ... quote=True, ... ) - Example with keyboard buttons: - - >>> from pywa.types import Button - >>> msg.reply_text( - ... header="Hello from PyWa!", - ... text="What can I help you with?", - ... footer="Powered by PyWa", - ... buttons=[ - ... Button("Help", data="help"), - ... Button("About", data="about"), - ... ], - ... quote=True - ... ) - - Example with a section list: - - >>> from pywa.types import SectionList, Section, SectionRow - >>> msg.reply_text( - ... header="Hello from PyWa!", - ... text="What can I help you with?", - ... footer="Powered by PyWa", - ... buttons=SectionList( - ... button_title="Choose an option", - ... sections=[ - ... Section( - ... title="Help", - ... rows=[ - ... SectionRow( - ... title="Help", - ... callback_data="help", - ... description="Get help with PyWa", - ... ), - ... SectionRow( - ... title="About", - ... callback_data="about", - ... description="Learn more about PyWa", - ... ), - ... ], - ... ), - ... Section( - ... title="Other", - ... rows=[ - ... SectionRow( - ... title="GitHub", - ... callback_data="github", - ... description="View the PyWa GitHub repository", - ... ), - ... ], - ... ), - ... ], - ... ), - ... quote=True - ... ) Args: text: The text to reply with (markdown allowed, max 4096 characters).