diff --git a/webwhatsapi/objects/message.py b/webwhatsapi/objects/message.py index e7a72927..dbd7899b 100755 --- a/webwhatsapi/objects/message.py +++ b/webwhatsapi/objects/message.py @@ -65,6 +65,16 @@ def __init__(self, js_obj, driver=None): self.content = "" self.safe_content = "..." + if js_obj["quotedStanzaID"]: + self.quoting = js_obj["quotedStanzaID"] + else: + self.quoting = "" + + if js_obj["isForwarded"]: + self.forwarded = js_obj["isForwarded"] + else: + self.forwarded = False + def __repr__(self): return "".format( type=self.type, @@ -174,15 +184,11 @@ def __repr__(self): class NotificationMessage(Message): def __init__(self, js_obj, driver=None): - super(NotificationMessage, self).__init__(js_obj, driver) - self.type = js_obj["type"] - self.subtype = js_obj["subtype"] - if js_obj["recipients"]: - self.recipients = [getContacts(x, driver) for x in js_obj["recipients"]] - - def __repr__(self): readable = { - "call_log": {"miss": "Missed Call"}, + "call_log": { + "miss": "Missed Call", + "miss_video": "Missed Video Call", + }, "e2e_notification": {"encrypt": "Messages now Encrypted"}, "gp2": { "invite": "Joined an invite link", @@ -192,13 +198,21 @@ def __repr__(self): "leave": "Left the group", }, } + super(NotificationMessage, self).__init__(js_obj, driver) + self.type = js_obj["type"] + self.subtype = js_obj["subtype"] + self.readable = readable[self.type][self.subtype] + if js_obj["recipients"]: + self.recipients = [getContacts(x, driver) for x in js_obj["recipients"]] + + def __repr__(self): sender = ( "" if not self.sender else ("from " + str(safe_str(self.sender.get_safe_name()))) ) return "".format( - type=readable[self.type][self.subtype], + type=self.readable, sender=sender, timestamp=self.timestamp, recip=""