open-wa / wa-automate-python

💬 🤖 The most advanced Python whatsapp library for chatbots with advanced features. Be sure to ⭐ this repository for updates!
Other
330 stars 71 forks source link

Open Chat returns None, and save_profile does not return wapi #9

Closed riquedev closed 4 years ago

riquedev commented 4 years ago

Guys, I was doing some tests with the package and I came across these two problems:

1 - After using save_profile (modifying or removing the remove_old parameter), the code apparently does not find Wapi again, because the class returns undefined, following the Exception:

Traceback (most recent call last): File "wa-automate-python/tests/init.py", line 21, in print(driver.open_chat("@c.us")) File "wa-automate-python\openwa__init__.py", line 490, in open_chat return self.wapi_functions.openChat(chat_id) File "wa-automate-python\openwa\wapi_js_wrapper.py", line 43, in getattr wapi_functions = dir(self) TypeError: 'NoneType' object is not iterable

2 - When I use open chat (expecting to open a chat with a "stranger", or someone whose I deleted all conversation (not just the messages), the function does not make any changes on the screen and returns me None. exceptions in this)

I'm using the version of the repository, I installed the whole package via git clone, and the original setup.

darkash commented 4 years ago

TypeError: 'NoneType' object is not iterable

this error usually pops up when your phone isn't logged in, can you check whether it's logged in? before that line?

I never used open_chat function, but save_profile don't have problem at all, at least for me

a5r0n commented 4 years ago

2 - When I use open chat (expecting to open a chat with a "stranger", or someone whose I deleted all conversation (not just the messages), the function does not make any changes on the screen and returns me None. exceptions in this)

By that line, I guess the open_chat function is intended to open the chat panel in the browser, only if the chat already exists in the chat list.

It's not meant to start a conversation with a "stranger"

mrodal commented 4 years ago

We are working on that, I'll update you on that soon!

riquedev commented 4 years ago

TypeError: 'NoneType' object is not iterable

this error usually pops up when your phone isn't logged in, can you check whether it's logged in? before that line?

I never used open_chat function, but save_profile don't have problem at all, at least for me

Yes, I can login and he can perform even "check_number_status", but in fact when he returns he does not recover the session :/

Here:

driver = WhatsBot(
        loadstyles=True,
        executable_path=config.get("dst_file"),
        username="test",
        profile=config.get("profile", "test"))

driver.wait_for_login(timeout=config.get("timeout", 90))
driver.save_firefox_profile()
driver.open_chat("<valid_phone>@c.us")

2 - When I use open chat (expecting to open a chat with a "stranger", or someone whose I deleted all conversation (not just the messages), the function does not make any changes on the screen and returns me None. exceptions in this)

By that line, I guess the open_chat function is intended to open the chat panel in the browser, only if the chat already exists in the chat list.

It's not meant to start a conversation with a "stranger"

Ahh, I understand x_x Is that in my use case I would need to be the first to send the message.

We are working on that, I'll update you on that soon!

Thanks!!

mrodal commented 4 years ago

Hey, good news, with the latest version (1.1.1) now you can contact unknown number, using a license key and providing your use case. This helps prevent bad uses like spamming, and also is some help for us maintainers for the hours we put in.

Check out https://github.com/open-wa/wa-automate-python#license-key for instructions on how to get a key