Skip to content
Open
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
19 changes: 9 additions & 10 deletions pywhatkit/core/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -100,16 +101,14 @@ 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":
hotkey("shift", "enter")
else:
typewrite(char)
findtextbox()
pyperclip.copy(message)
if platform.system() == "Darwin":
hotkey("command", "v")
else:
hotkey("ctrl", "v")
time.sleep(1)
press("enter")


Expand Down
82 changes: 41 additions & 41 deletions pywhatkit/whats.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@


def sendwhatmsg_instantly(
phone_no: str,
message: str,
wait_time: int = 15,
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"""

Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -120,13 +120,13 @@ def sendwhatdoc_immediately(


def sendwhatmsg(
phone_no: str,
message: str,
time_hour: int,
time_min: int,
wait_time: int = 15,
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):
Expand Down Expand Up @@ -164,13 +164,13 @@ def sendwhatmsg(


def sendwhatmsg_to_group(
group_id: str,
message: str,
time_hour: int,
time_min: int,
wait_time: int = 15,
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"""

Expand Down Expand Up @@ -202,11 +202,11 @@ def sendwhatmsg_to_group(


def sendwhatmsg_to_group_instantly(
group_id: str,
message: str,
wait_time: int = 15,
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"""

Expand All @@ -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 = 15,
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(
Expand All @@ -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 = 15,
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"""

Expand Down