Closed Neelaksh-Singh closed 4 years ago
Thanks for reporting this :+1: Our maintainers will soon revert back to you
@xandao6 I would like to take it up in python.
@xandao6 @rpotter12 anyone of you please assign this task to @Neelaksh-Singh
@Neelaksh-Singh You will use Google API?
@Neelaksh-Singh elaborate more about this. What you are gonna do in messageblast??
Basically it will convert a users text into speech , which we can implement with our message blast for continuous pinging the respective person.
On Fri, 3 Apr 2020, 9:17 pm Rohit Potter, notifications@github.com wrote:
@Neelaksh-Singh https://github.com/Neelaksh-Singh elaborate more about this. What you are gonna do in messageblast??
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rpotter12/whatsapp-play/issues/271#issuecomment-608516175, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANLMMBCRWKNRZLECS2UD5ZDRKYAJ7ANCNFSM4L2JJMFA .
Basically it will convert a users text into speech , which we can implement with our message blast for continuous pinging the respective person. … On Fri, 3 Apr 2020, 9:17 pm Rohit Potter, @.***> wrote: @Neelaksh-Singh https://github.com/Neelaksh-Singh elaborate more about this. What you are gonna do in messageblast?? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#271 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANLMMBCRWKNRZLECS2UD5ZDRKYAJ7ANCNFSM4L2JJMFA .
You mean to say to send the audio messages??
@rpotter12 It's different he will convert the text from your friends into audio
yes both ur points are valid, further in future this feature can be implemented with various functionality of this project.
@rpotter12 It's different he will convert the text from your friends into audio
@xandao6 please explain why this is needed??
It should be speech to text conversion just like our google assistant. Text to speech is not needed because It will read all the commands from one point to the last point. It is not needed. I have some scripts related to it because I worked on a project where I have used it. But I don't know how to apply those scripts in whatsapp-play. Can any one let me know how to apply those scripts in it. I mean which file I need to change. @rpotter12 @xandao6
@rpotter12 I don't know, just for fun
It should be speech to text conversion just like our google assistant. Text to speech is not needed > because It will read all the commands from one point to the last point. It is not needed. I have some scripts related to it because I worked on a project where I have used it. But I don't know how to apply those scripts in whatsapp-play. Can any one let me know how to apply those scripts > in it. I mean which file I need to change. @rpotter12 @xandao6
@csharp489 Just put your link of scripts here. :)
@rpotter12 I don't know, just for fun
@xandao6 This is not really needed in this project. We can do that to convert the text into audio file and send it to the target person. This can be used in many other scripts like messageblast, chatting scripts etc.
@rpotter12 Here is the link .Please check it https://github.com/csharp489/KAREN-An-A.I.-U.I./blob/master/speechRecognition.py https://github.com/csharp489/KAREN-An-A.I.-U.I./blob/master/speekmodule.py
Well, I agree with you @rpotter12 We can also share our message in audio form to the target person.
@csharp489 create a function using that code and call that function where u want to use these code.
Hello to @rpotter12 As per your suggestion I have created a function and write all the necessary things. In this , I have changed two python files io.py and wchat.py. Here I am attaching code of both the changed python file. Please have a look at let me know what I am missing. TAKE YOUR TIME
io.py
__author__ = 'Alexandre Calil Martins Fonseca, github: xandao6'
# region IMPORTS
from wplay.utils.helpers import whatsapp_selectors_dict
import pyttsx3
import speech_recognition as sr
# endregion
# region FOR SCRIPTING
def ask_user_for_message():
return str(input("1.Write your message: "))
def ask_user_for_method():
print(" Press S for Speaker and W for write")
answer=input()
if answer =='S':
print("you have choosen Speaker")
engine=pyttsx3.init('sapi5')
voices=engine.getProperty('voices')
#print(voices[0].id)
engine.setProperty('voice',voices[0].id)
def speak(audio):
engine.say(audio)
engine.runAndWait()
def takeCommand():
r=sr.Recognizer()
with sr.Microphone() as source:
print("Listening...")
r.pause_threshold=1
audio=r.listen(source)
try:
print("Recognizing...")
query=r.recognize_google(audio,language='en-in')
print(f"User said: {query}\n")
except Exception as e:
print(e)
print("Say that again please...")
return "None"
return query
if __name__=="__main__":
while True:
query=takeCommand().lower()
if 'message' in query:
try:
message=[]
i=0
self.compText.set("Write your message ('Enter' to breakline)('.' alone to finish):")
speak("Write your message:")
while True:
message = takeCommand()
if message[i]=='dot':
message.pop(i)
break
i+=1
self.userText.set(message)
except:
self.compText.set('Message sent!')
speak('Sorry ' + 'Mam' + '!, I am unable to send your message at this moment!')
else:
def ask_user_for_message_breakline_mode():
message = []
i = 0
print("Write your message ('Enter' to breakline)('.' alone to finish):")
while True:
message.append(str(input()))
if message[i] == '.':
message.pop(i)
break
i += 1
return message
async def send_message(page, message):
for i in range(len(message)):
await page.type(
whatsapp_selectors_dict['message_area'],
message[i]
)
if isinstance(message, list):
await page.keyboard.down('Shift')
await page.keyboard.press('Enter')
await page.keyboard.up('Shift')
await page.keyboard.press('Enter')
# endregion
wchat.py
from wplay.utils import browser_config
from wplay.utils import target_search
from wplay.utils import target_select
from wplay.utils import io
from wplay.utils import speech_recognition as sr
async def chat(target):
page, _ = await browser_config.configure_browser_and_load_whatsapp()
if target is not None:
await target_search.search_and_select_target(page, target)
else:
await target_select.manual_select_target(page)
while True:
message = io.ask_user_for_method()
await io.send_message(page, message)
@csharp489 have you tested it yet??
Yes, I have tested but it is not giving desired output .It is not even taking the print function statement of choice(Speak or Write). I just want to know that do I need to change only these python files or need to change some other script?
@csharp489 Sorry for a very late response. I think these files will be enough to change. Let's see when you open a PR for it we will test and check where we need change more.
I would like to work on this issue.
@rpotter12 Currently only by entering the text, it's converted into speech. There should also be an option of inserting a text file and it's audio will be made. Should I implement this?
@rpotter12 Currently only by entering the text, it's converted into speech. There should also be an option of inserting a text file and it's audio will be made. Should I implement this?
@SinghHimadri there is no need of this feature. Normally people send some voice message which they have to write in the chat which we have already added.
The idea is to create a python code for text to speech conversion , which could be implemented with the message blast