ref: 0483c87417cacff56e96535ba1d1caf76a198100
parent: 0e378d63fd104262b1388b8be05d89bdbf29df06
author: penny <penny@limitedideas.org>
date: Wed Sep 3 12:31:01 EDT 2025
Start working on notification interactions
--- a/commands.go
+++ b/commands.go
@@ -4,7 +4,7 @@
"strings"
)
-var commands = []string{"examine", "reply", "like", "thread", "open", "preview", "download", "dm", "rt", "parent", "children", "rm", "mark", "unmark", "account", "vim", "import", "pause", "resume", "url", "fpost", "ufpost", "edit"}+var commands = []string{"examine", "reply", "like", "thread", "open", "preview", "download", "dm", "rt", "parent", "children", "rm", "mark", "unmark", "account", "vim", "import", "pause", "resume", "url", "fpost", "ufpost", "edit", "notice"} func processInput(input string) (command string, arguments string) {--- a/hellclient.go
+++ b/hellclient.go
@@ -17,6 +17,11 @@
EOF = io.EOF
)
+type postref struct {+ prefix string
+ ref string
+}
+
type Hellclient struct {//if you're gonna touch or read anything here lock the mutex with hc.lock()
isPaused bool
@@ -83,10 +88,9 @@
func (hc *Hellclient) updatePrompt() {var sb strings.Builder
- var pg mastodon.Pagination
- notifications, _ := hc.client.GetNotifications(context.Background(), &pg)
- if len(notifications) > 0 {- sb.WriteString(fmt.Sprintf("ur:%v ", len(notifications)))+ unread, err := hc.client.GetUnreadNotifications(context.Background(), nil, nil, 0)
+ if err == nil {+ sb.WriteString(fmt.Sprintf("ur:%v ", unread.Count))}
if hc.isPaused { sb.WriteString("STREAMING PAUSED ")--- a/main.go
+++ b/main.go
@@ -108,6 +108,10 @@
//Contextual commands that need to handle their own requirements
switch command {+ case "notice":
+ notifications, _ := hc.GetUnreadNotifications()
+ hc.PrintNotifications(notifications)
+ return
case "pause":
hc.togglepause()
return
--- /dev/null
+++ b/notifications.go
@@ -1,0 +1,31 @@
+package main
+
+import (
+ "context"
+
+ "github.com/mattn/go-mastodon"
+)
+func (hc *Hellclient) GetUnreadNotifications() (notifications []*mastodon.Notification, err error) {+ markers, err := hc.client.GetTimelineMarkers(context.Background(), []string{"notifications"})+ if err != nil {+ return
+ }
+
+ LastID := markers["notifications"].LastID
+
+ page := &mastodon.Pagination {SinceID: LastID}+
+ notifications, err = hc.client.GetNotificationsExclude(context.Background(), nil, page)
+
+ return
+}
+
+func (hc *Hellclient) PrintNotifications(notifications []*mastodon.Notification) {+
+ for _, notification := range notifications {+ PrintObjectProperties(notification, hc.debugMap)
+ }
+
+
+ return
+}
\ No newline at end of file
--
⑨