Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-24.04
strategy:
matrix:
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
python-version: [ "3.9", "3.10", "3.11", "3.12" ]

steps:
- uses: actions/checkout@v3
Expand Down
6 changes: 4 additions & 2 deletions examples/full.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def message_handler(notification: Notification) -> None:
@bot.router.message(text_message=["1", "Report a problem"])
def report_problem_handler(notification: Notification) -> None:
notification.answer(
"https://github.com/green-api/issues/issues/new", link_preview=False
"https://github.com/green-api/issues/issues/new", link_preview=False, typing_time=2000
)


Expand All @@ -47,7 +47,9 @@ def show_available_rates_handler(notification: Notification) -> None:

@bot.router.message(text_message=["4", "Call a support operator"])
def call_support_operator_handler(notification: Notification) -> None:
notification.answer("Good. A tech support operator will contact you soon.")
notification.answer(
"Good. A tech support operator will contact you soon.", typing_time=2000
)

@bot.router.message(text_message=["5", "Show interactive buttons"])
def show_interactive_buttons_handler(notification: Notification) -> None:
Expand Down
5 changes: 4 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
whatsapp-api-client-python>=0.0.49
whatsapp-api-client-python>=0.0.53
aiogram>=3.21.0
aiofiles>=24.1.0
aiohttp>=3.9.0
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name="whatsapp-chatbot-python",
version="0.9.7",
version="0.9.8",
description=(
"This library helps you easily create"
" a Python chatbot with WhatsApp API."
Expand Down Expand Up @@ -43,6 +43,6 @@
"Creative Commons Attribution-NoDerivatives 4.0 International"
" (CC BY-ND 4.0)"
),
install_requires=["whatsapp-api-client-python>=0.0.49"],
install_requires=["whatsapp-api-client-python>=0.0.53"],
python_requires=">=3.7"
)
20 changes: 12 additions & 8 deletions whatsapp_chatbot_python/manager/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,13 @@ def answer(
message: str,
quoted_message_id: Optional[str] = None,
archive_chat: Optional[bool] = None,
link_preview: Optional[bool] = None
link_preview: Optional[bool] = None,
typing_time: Optional[int] = None
) -> Optional[Response]:
chat = self.get_chat()
if chat:
return self.api.sending.sendMessage(
chat, message, quoted_message_id, archive_chat, link_preview
chat, message, quoted_message_id, archive_chat, link_preview, typing_time
)

def answer_buttons(
Expand All @@ -113,7 +114,7 @@ def answer_with_interactive_buttons(
body: str,
buttons: List[Dict[str, Union[str, Dict[str, str]]]],
header: Optional[str] = None,
footer: Optional[str] = None,
footer: Optional[str] = None
) -> Optional[Response]:
chat = self.get_chat()
if chat:
Expand All @@ -126,7 +127,7 @@ def answer_with_interactive_buttons_reply(
body: str,
buttons: List[Dict[str, str]],
header: Optional[str] = None,
footer: Optional[str] = None,
footer: Optional[str] = None
) -> Optional[Response]:
chat = self.get_chat()
if chat:
Expand All @@ -139,25 +140,28 @@ def answer_with_file(
file: str,
file_name: Optional[str] = None,
caption: Optional[str] = None,
quoted_message_id: Optional[str] = None
quoted_message_id: Optional[str] = None,
typing_time: Optional[int] = None,
typing_type: Optional[str] = None
) -> Optional[Response]:
chat = self.get_chat()
if chat:
return self.api.sending.sendFileByUpload(
chat, file, file_name, caption, quoted_message_id
chat, file, file_name, caption, quoted_message_id, typing_time, typing_type
)

def answer_with_poll(
self,
message: str,
options: List[Dict[str, str]],
multiple_answers: Optional[bool] = None,
quoted_message_id: Optional[str] = None
quoted_message_id: Optional[str] = None,
typing_time: Optional[int] = None
) -> Optional[Response]:
chat = self.get_chat()
if chat:
return self.api.sending.sendPoll(
chat, message, options, multiple_answers, quoted_message_id
chat, message, options, multiple_answers, quoted_message_id, typing_time
)

HandlerType = Callable[[Notification], Any]
Expand Down