From 44212312fbcbf6d6defee291009828fdbd9cf2ef Mon Sep 17 00:00:00 2001 From: Yves Mongo Date: Wed, 8 Feb 2023 11:33:53 +0000 Subject: [PATCH 1/4] update wait times, removed click on sendmessing with dual screen --- pywhatkit/core/core.py | 4 +--- pywhatkit/whats.py | 16 ++++++++-------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/pywhatkit/core/core.py b/pywhatkit/core/core.py index 094c48b..2f055c1 100644 --- a/pywhatkit/core/core.py +++ b/pywhatkit/core/core.py @@ -100,9 +100,7 @@ def send_message(message: str, receiver: str, wait_time: int) -> None: """Parses and Sends the Message""" _web(receiver=receiver, message=message) - time.sleep(7) - click(WIDTH / 2, HEIGHT / 2 + 15) - time.sleep(wait_time - 7) + time.sleep(wait_time) if not check_number(number=receiver): for char in message: if char == "\n": diff --git a/pywhatkit/whats.py b/pywhatkit/whats.py index 72dc831..d603f20 100755 --- a/pywhatkit/whats.py +++ b/pywhatkit/whats.py @@ -19,7 +19,7 @@ def sendwhatmsg_instantly( phone_no: str, message: str, - wait_time: int = 15, + wait_time: int = 30, tab_close: bool = False, close_time: int = 3, ) -> None: @@ -46,7 +46,7 @@ def sendwhatmsg_instantly( def sendimg_or_video_immediately( phone_no: str, path: str, - wait_time: int = 15, + wait_time: int = 30, tab_close: bool = False, close_time: int = 3, ) -> None: @@ -84,7 +84,7 @@ def sendimg_or_video_immediately( def sendwhatdoc_immediately( phone_no: str, path: str, - wait_time: int = 15, + wait_time: int = 30, tab_close: bool = True, close_time: int = 3, ) -> None: @@ -124,7 +124,7 @@ def sendwhatmsg( message: str, time_hour: int, time_min: int, - wait_time: int = 15, + wait_time: int = 30, tab_close: bool = False, close_time: int = 3, ) -> None: @@ -168,7 +168,7 @@ def sendwhatmsg_to_group( message: str, time_hour: int, time_min: int, - wait_time: int = 15, + wait_time: int = 30, tab_close: bool = False, close_time: int = 3, ) -> None: @@ -204,7 +204,7 @@ def sendwhatmsg_to_group( def sendwhatmsg_to_group_instantly( group_id: str, message: str, - wait_time: int = 15, + wait_time: int = 30, tab_close: bool = False, close_time: int = 3, ) -> None: @@ -223,7 +223,7 @@ def sendwhatsmsg_to_all( message: str, time_hour: int, time_min: int, - wait_time: int = 15, + wait_time: int = 30, tab_close: bool = False, close_time: int = 3, ): @@ -239,7 +239,7 @@ def sendwhats_image( time_hour: int, time_min: int, caption: str = "", - wait_time: int = 15, + wait_time: int = 30, tab_close: bool = False, close_time: int = 3, ) -> None: From f748b5b470836d52da8476b699f1d5db9ef9cbba Mon Sep 17 00:00:00 2001 From: Yves Mongo Date: Wed, 21 Dec 2022 14:48:36 +0000 Subject: [PATCH 2/4] modified send message to Ctrl+V instead of typ --- pywhatkit/core/core.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pywhatkit/core/core.py b/pywhatkit/core/core.py index 2f055c1..f29dde5 100644 --- a/pywhatkit/core/core.py +++ b/pywhatkit/core/core.py @@ -4,7 +4,8 @@ from platform import system from urllib.parse import quote from webbrowser import open - +import pyperclip +import platform import requests from pyautogui import click, hotkey, locateOnScreen, moveTo, press, size, typewrite @@ -102,11 +103,12 @@ def send_message(message: str, receiver: str, wait_time: int) -> None: _web(receiver=receiver, message=message) time.sleep(wait_time) if not check_number(number=receiver): - for char in message: - if char == "\n": - hotkey("shift", "enter") - else: - typewrite(char) + pyperclip.copy(message) + if platform.system() == "Darwin": + hotkey("command", "v") + else: + hotkey("ctrl", "v") + time.sleep(1) findtextbox() press("enter") From 6d292e3106e43103d08baddc35caa041149be22b Mon Sep 17 00:00:00 2001 From: Yves Mongo Date: Wed, 21 Dec 2022 15:27:23 +0000 Subject: [PATCH 3/4] to be squashed --- pywhatkit/core/core.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pywhatkit/core/core.py b/pywhatkit/core/core.py index f29dde5..2f424c2 100644 --- a/pywhatkit/core/core.py +++ b/pywhatkit/core/core.py @@ -109,7 +109,6 @@ def send_message(message: str, receiver: str, wait_time: int) -> None: else: hotkey("ctrl", "v") time.sleep(1) - findtextbox() press("enter") From 8141f905c0e7aae2a2e744cf4aebc85d35657ff9 Mon Sep 17 00:00:00 2001 From: Yves Mongo Date: Thu, 9 Feb 2023 07:07:13 +0000 Subject: [PATCH 4/4] pyperclip mod --- pywhatkit/whats.py | 78 +++++++++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/pywhatkit/whats.py b/pywhatkit/whats.py index d603f20..67ac01e 100755 --- a/pywhatkit/whats.py +++ b/pywhatkit/whats.py @@ -17,11 +17,11 @@ def sendwhatmsg_instantly( - phone_no: str, - message: str, - wait_time: int = 30, - tab_close: bool = False, - close_time: int = 3, + phone_no: str, + message: str, + wait_time: int = 30, + tab_close: bool = False, + close_time: int = 3, ) -> None: """Send WhatsApp Message Instantly""" @@ -120,13 +120,13 @@ def sendwhatdoc_immediately( def sendwhatmsg( - phone_no: str, - message: str, - time_hour: int, - time_min: int, - wait_time: int = 30, - tab_close: bool = False, - close_time: int = 3, + phone_no: str, + message: str, + time_hour: int, + time_min: int, + wait_time: int = 30, + tab_close: bool = False, + close_time: int = 3, ) -> None: """Send a WhatsApp Message at a Certain Time""" if not core.check_number(number=phone_no): @@ -164,13 +164,13 @@ def sendwhatmsg( def sendwhatmsg_to_group( - group_id: str, - message: str, - time_hour: int, - time_min: int, - wait_time: int = 30, - tab_close: bool = False, - close_time: int = 3, + group_id: str, + message: str, + time_hour: int, + time_min: int, + wait_time: int = 30, + tab_close: bool = False, + close_time: int = 3, ) -> None: """Send WhatsApp Message to a Group at a Certain Time""" @@ -202,11 +202,11 @@ def sendwhatmsg_to_group( def sendwhatmsg_to_group_instantly( - group_id: str, - message: str, - wait_time: int = 30, - tab_close: bool = False, - close_time: int = 3, + group_id: str, + message: str, + wait_time: int = 30, + tab_close: bool = False, + close_time: int = 3, ) -> None: """Send WhatsApp Message to a Group Instantly""" @@ -219,13 +219,13 @@ def sendwhatmsg_to_group_instantly( def sendwhatsmsg_to_all( - phone_nos: List[str], - message: str, - time_hour: int, - time_min: int, - wait_time: int = 30, - tab_close: bool = False, - close_time: int = 3, + phone_nos: List[str], + message: str, + time_hour: int, + time_min: int, + wait_time: int = 30, + tab_close: bool = False, + close_time: int = 3, ): for phone_no in phone_nos: sendwhatmsg( @@ -234,14 +234,14 @@ def sendwhatsmsg_to_all( def sendwhats_image( - receiver: str, - img_path: str, - time_hour: int, - time_min: int, - caption: str = "", - wait_time: int = 30, - tab_close: bool = False, - close_time: int = 3, + receiver: str, + img_path: str, + time_hour: int, + time_min: int, + caption: str = "", + wait_time: int = 30, + tab_close: bool = False, + close_time: int = 3, ) -> None: """Send Image to a WhatsApp Contact or Group at a Certain Time"""