mukulhase / WebWhatsapp-Wrapper

An API for sending and receiving messages over web.whatsapp [Working as of 18th May 2018]
https://webwhatsapi.readthedocs.io/en/latest/
MIT License
2.03k stars 795 forks source link

Does not receive document (PDF) and audio (PTT) #989

Closed msiena closed 3 years ago

msiena commented 3 years ago

The get_unread() function is no longer receiving messages from documents (PDF) and also from audio (PTT). The messages are simply ignored.

pailus commented 3 years ago

on message.py change like this def factory_message(js_obj, driver): """Factory function for creating appropriate object given selenium JS object""" if js_obj is None: return

if "lat" in js_obj and "lng" in js_obj and js_obj["lat"] and js_obj["lng"]:
    return GeoMessage(js_obj, driver)

if js_obj["isMedia"] or js_obj["type"] == 'document':
    return MediaMessage(js_obj, driver)

if js_obj["isNotification"]:
    return NotificationMessage(js_obj, driver)

if "isMMS" in js_obj and js_obj["isMMS"]:
    return MMSMessage(js_obj, driver)

if js_obj["type"] in ["vcard", "multi_vcard"]:
    return VCardMessage(js_obj, driver)

return Message(js_obj, driver)
edsondasilva commented 3 years ago

if js_obj["isMedia"] or js_obj["type"] == 'document' or js_obj["type"] == 'ptt': return MediaMessage(js_obj, driver)

msiena commented 3 years ago

on message.py change like this def factory_message(js_obj, driver): """Factory function for creating appropriate object given selenium JS object""" if js_obj is None: return

if "lat" in js_obj and "lng" in js_obj and js_obj["lat"] and js_obj["lng"]:
    return GeoMessage(js_obj, driver)

if js_obj["isMedia"] or js_obj["type"] == 'document':
    return MediaMessage(js_obj, driver)

if js_obj["isNotification"]:
    return NotificationMessage(js_obj, driver)

if "isMMS" in js_obj and js_obj["isMMS"]:
    return MMSMessage(js_obj, driver)

if js_obj["type"] in ["vcard", "multi_vcard"]:
    return VCardMessage(js_obj, driver)

return Message(js_obj, driver)

Tank you for answering. Your instruction solved the PDF problem.

msiena commented 3 years ago

if js_obj["isMedia"] or js_obj["type"] == 'document' or js_obj["type"] == 'ptt': return MediaMessage(js_obj, driver)

Thank you. With it complement the PTT problem was solved.