Skip to content

Commit

Permalink
Whatsapp Automation using Python
Browse files Browse the repository at this point in the history
  • Loading branch information
adityajha2005 committed May 27, 2024
1 parent a278727 commit 612d5fe
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 0 deletions.
15 changes: 15 additions & 0 deletions PyWhatKit_DB.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Date: 27/5/2024
Time: 17:47
Phone Number: +919990362668
Message: hey buddy how are you
--------------------
Date: 27/5/2024
Time: 17:51
Phone Number: +919990362668
Message: Hey buddy ssup
--------------------
Date: 27/5/2024
Time: 17:54
Phone Number: +919990362668
Message: heyooo
--------------------
59 changes: 59 additions & 0 deletions Whatsapp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import pywhatkit
import pyttsx3
import datetime
import speech_recognition
import webbrowser
from bs4 import BeautifulSoup
from time import sleep
import os
from datetime import timedelta
from datetime import datetime

engine = pyttsx3.init("sapi5")
voices = engine.getProperty("voices")
for voice in voices:
if "zira" in voice.name.lower():
engine.setProperty("voice", voice.id)
break
engine.setProperty("rate", 170)

def speak(audio):
engine.say(audio)
engine.runAndWait()


def takeCommand():
r = speech_recognition.Recognizer()
with speech_recognition.Microphone() as source:
print("Listening...")
r.pause_threshold = 1
r.energy_threshold = 300
audio = r.listen(source, 0, 4)

try:
print("Understanding..")
query = r.recognize_google(audio, language="en-in")
print(f"You said : {query}\n")
except Exception as e:
print("Say that again")
return "None"
return query

strTime = int(datetime.now().strftime("%H"))
update = int((datetime.now() + timedelta(minutes=2)).strftime("%M"))
def sendMessage():
speak("Who do you want to send the message to?")
a = int(input("Aditya - 1 , Babita - 2 \n Enter the number:"))

if a == 1:
speak("What message do you want to send?")
message = str(input("Enter the message: "))

pywhatkit.sendwhatmsg("+9199XX3XXXX", message, time_hour=strTime,time_min=update)
speak("Message sent successfully")
elif a == 2:
speak("What message do you want to send?")
message = str(input("Enter the message: "))
pywhatkit.sendwhatmsg("+919XX8XX35XXX", message, time_hour=strTime,time_min=update)
speak("Message sent successfully")

Binary file added __pycache__/Whatsapp.cpython-312.pyc
Binary file not shown.
4 changes: 4 additions & 0 deletions daisy_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ def convert_to_datetime(alarm_time_str):
query = query.replace("Daisy", "")
Calc(query)

elif "whatsapp" in query:
from Whatsapp import sendMessage
sendMessage()

elif "temperature" in query:
search = "temperature here is "
url=f"https://www.google.com/search?q={search}"
Expand Down

0 comments on commit 612d5fe

Please sign in to comment.