Skip to content

Commit a0198ab

Browse files
authored
Merge pull request #165 from bharathbrat/patch-1
Sending Message to Group Instantly
2 parents 5e9fe3c + ec82130 commit a0198ab

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ pywhatkit.sendwhats_image("+910123456789", "Images/Hello.png")
6868
# Send a WhatsApp Message to a Group at 12:00 AM
6969
pywhatkit.sendwhatmsg_to_group("AB123CDEFGHijklmn", "Hey All!", 0, 0)
7070

71+
# Send a WhatsApp Message to a Group instantly
72+
pywhatkit.sendwhatmsg_to_group_instantly("AB123CDEFGHijklmn", "Hey All!")
73+
7174
# Play a Video on YouTube
7275
pywhatkit.playonyt("PyWhatKit")
7376
```

pywhatkit/whats.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,24 @@ def sendwhatmsg_to_group(
114114
core.close_tab(wait_time=close_time)
115115

116116

117+
def sendwhatmsg_to_group_instantly(
118+
group_id: str,
119+
message: str,
120+
wait_time: int = 15,
121+
tab_close: bool = False,
122+
close_time: int = 3,
123+
) -> None:
124+
"""Send WhatsApp Message to a Group Instantly"""
125+
126+
current_time = time.localtime()
127+
128+
time.sleep(sleep_time)
129+
core.send_message(message=message, receiver=group_id, wait_time=wait_time)
130+
log.log_message(_time=current_time, receiver=group_id, message=message)
131+
if tab_close:
132+
core.close_tab(wait_time=close_time)
133+
134+
117135
def sendwhats_image(
118136
receiver: str,
119137
img_path: str,

0 commit comments

Comments
 (0)