From cb82abd12830d9375cd4b5fc5d7192d82da58018 Mon Sep 17 00:00:00 2001 From: romy Date: Sat, 7 Dec 2024 21:09:23 +0700 Subject: [PATCH 1/2] add MessageID on NewsletterMessage --- notification.go | 1 + types/newsletter.go | 1 + 2 files changed, 2 insertions(+) diff --git a/notification.go b/notification.go index 0f46ae68..1b04a96c 100644 --- a/notification.go +++ b/notification.go @@ -274,6 +274,7 @@ func (cli *Client) parseNewsletterMessages(node *waBinary.Node) []*types.Newslet } msg := types.NewsletterMessage{ MessageServerID: child.AttrGetter().Int("server_id"), + MessageID: child.AttrGetter().String("id"), ViewsCount: 0, ReactionCounts: nil, } diff --git a/types/newsletter.go b/types/newsletter.go index 511216c4..b4dba1e1 100644 --- a/types/newsletter.go +++ b/types/newsletter.go @@ -148,6 +148,7 @@ type NewsletterText struct { type NewsletterMessage struct { MessageServerID MessageServerID + MessageID MessageID ViewsCount int ReactionCounts map[string]int From 160270b7126edb15b80c19ce6071ea3c9bec7638 Mon Sep 17 00:00:00 2001 From: romy Date: Tue, 10 Dec 2024 14:34:59 +0700 Subject: [PATCH 2/2] add TimeStamp on NewsletterMessage --- notification.go | 2 ++ types/newsletter.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/notification.go b/notification.go index 1b04a96c..2e596908 100644 --- a/notification.go +++ b/notification.go @@ -9,6 +9,7 @@ package whatsmeow import ( "encoding/json" "errors" + "time" "google.golang.org/protobuf/proto" @@ -275,6 +276,7 @@ func (cli *Client) parseNewsletterMessages(node *waBinary.Node) []*types.Newslet msg := types.NewsletterMessage{ MessageServerID: child.AttrGetter().Int("server_id"), MessageID: child.AttrGetter().String("id"), + TimeStamp: time.Unix(child.AttrGetter().Int64("t"), 0), ViewsCount: 0, ReactionCounts: nil, } diff --git a/types/newsletter.go b/types/newsletter.go index b4dba1e1..68c1da12 100644 --- a/types/newsletter.go +++ b/types/newsletter.go @@ -10,6 +10,7 @@ import ( "bytes" "encoding/json" "fmt" + "time" "go.mau.fi/util/jsontime" @@ -149,6 +150,7 @@ type NewsletterText struct { type NewsletterMessage struct { MessageServerID MessageServerID MessageID MessageID + TimeStamp time.Time ViewsCount int ReactionCounts map[string]int