Skip to content

Commit a34d407

Browse files
committed
Added name to Me() and returned unread messages auto marking
1 parent 67e6feb commit a34d407

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

reddit.go

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ func (c *Reddit) MiraRequest(method string, target string, payload map[string]st
4141
}
4242

4343
func (c *Reddit) Me() *Reddit {
44+
c.Chain.Name = c.Creds.Username
4445
c.Chain.Type = "me"
4546
return c
4647
}

streaming.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package mira
22

33
import (
4-
"fmt"
54
"time"
65

76
"github.com/thecsw/mira/models"
@@ -22,7 +21,7 @@ func (r *Reddit) StreamCommentReplies() (<-chan *models.Comment, chan bool) {
2221
if v.IsCommentReply() {
2322
c <- &v
2423
// You can read the message with
25-
//r.ReadMessage(v.GetId())
24+
r.ReadMessage(v.GetId())
2625
}
2726
}
2827
time.Sleep(r.Stream.CommentListInterval * time.Second)
@@ -43,14 +42,13 @@ func (r *Reddit) StreamMentions() (<-chan *models.Comment, chan bool) {
4342
for {
4443
stop <- false
4544
un, _ := r.Me().ListUnreadMessages()
46-
fmt.Println(un)
4745
for _, v := range un {
4846
// Only process comment replies and
4947
// mark them as read.
5048
if v.IsMention() {
5149
c <- &v
5250
// You can read the message with
53-
// r.ReadMessage(v.GetId())
51+
r.ReadMessage(v.GetId())
5452
}
5553
}
5654
time.Sleep(r.Stream.CommentListInterval * time.Second)

0 commit comments

Comments
 (0)