Ankit404butfound / PyWhatKit

Send WhatsApp message at certain time and many other things.
MIT License
1.37k stars 297 forks source link

sleep length must be non-negative (instant messaging not working) #267

Open Mohammad699 opened 1 year ago

Mohammad699 commented 1 year ago

Description

When using instant messaging the script is crashing when you don't set wait_time and set tab_close to True

To Reproduce

pywhatkit.sendwhatmsg_instantly('+1*****', 'test', True, 7)

Screenshots

  File "D:\Python310\lib\site-packages\pywhatkit\whats.py", line 31, in sendwhatmsg_instantly
    time.sleep(wait_time - 4)
ValueError: sleep length must be non-negative

Version Information

Harsh0707005 commented 1 year ago

If you wont set wait_time the default value (15) will be taken. But you have made error in positioning your arguments. You have to set wait_time after the message you wish to send but you have set it to True which is the value for tab_close argument instead of an integer. The call should be: sendwhatmsg_instantly(phone_no, message, wait_time, tab_close, close_time)