newsletter: parse ID, type and timestamp for incoming messages (#742)

This commit is contained in:
devlikeapro authored and GitHub committed 2025-02-15 15:16:13 +02:00
1 parent f9f9f52a82
commit 9fd5350535
2 files changed
+9 -1

No files matched your search

+5 -1
View File
@@ -272,8 +272,12 @@ func (cli *Client) parseNewsletterMessages(node *waBinary.Node) []*types.Newslet
if child.Tag != "message" {
continue
}
ag := child.AttrGetter()
msg := types.NewsletterMessage{
MessageServerID: child.AttrGetter().Int("server_id"),
MessageServerID: ag.Int("server_id"),
MessageID: ag.String("id"),
Type: ag.String("type"),
Timestamp: ag.UnixTime("t"),
ViewsCount: 0,
ReactionCounts: nil,
}
+4
View File
@@ -10,6 +10,7 @@ import (
"bytes"
"encoding/json"
"fmt"
"time"
"go.mau.fi/util/jsontime"
@@ -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