Skip to content

Commit

Permalink
newsletters: extract MessageId, Type, Timestamp available in the attrs
Browse files Browse the repository at this point in the history
  • Loading branch information
devlikepro committed Feb 5, 2025
1 parent a75587a commit 2d4953b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,9 @@ func (cli *Client) parseNewsletterMessages(node *waBinary.Node) []*types.Newslet
}
msg := types.NewsletterMessage{
MessageServerID: child.AttrGetter().Int("server_id"),
MessageID: child.AttrGetter().String("id"),
Type: child.AttrGetter().String("type"),
Timestamp: child.AttrGetter().UnixTime("t"),
ViewsCount: 0,
ReactionCounts: nil,
}
Expand Down
4 changes: 4 additions & 0 deletions types/newsletter.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"bytes"
"encoding/json"
"fmt"
"time"

"go.mau.fi/util/jsontime"

Expand Down Expand Up @@ -148,6 +149,9 @@ type NewsletterText struct {

type NewsletterMessage struct {
MessageServerID MessageServerID
MessageID MessageID
Type string
Timestamp time.Time
ViewsCount int
ReactionCounts map[string]int

Expand Down

0 comments on commit 2d4953b

Please sign in to comment.