diff options
| author | Xe Iaso <me@xeiaso.net> | 2024-10-26 11:26:52 -0400 |
|---|---|---|
| committer | Xe Iaso <me@xeiaso.net> | 2024-10-26 11:26:52 -0400 |
| commit | 4425f342319060c018a407795c8ee9354dc7fef2 (patch) | |
| tree | 2f0c9970e21232d0c83b735aac71045d8bbedffa /cmd | |
| parent | f1df6b07deac551f7ed1d9ef6c5d0089b170ad62 (diff) | |
| download | x-4425f342319060c018a407795c8ee9354dc7fef2.tar.xz x-4425f342319060c018a407795c8ee9354dc7fef2.zip | |
web/bskybot: add InReplyTo method for posts
Signed-off-by: Xe Iaso <me@xeiaso.net>
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/stealthmountain/main.go | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/cmd/stealthmountain/main.go b/cmd/stealthmountain/main.go index 268f20f..db0a61f 100644 --- a/cmd/stealthmountain/main.go +++ b/cmd/stealthmountain/main.go @@ -3,13 +3,11 @@ package main import ( "context" "flag" - "fmt" "log/slog" "os" "regexp" "time" - comatproto "github.com/bluesky-social/indigo/api/atproto" bskyData "github.com/bluesky-social/indigo/api/bsky" jsModels "github.com/bluesky-social/jetstream/pkg/models" "github.com/goccy/go-json" @@ -94,27 +92,12 @@ func main() { actorID := m.Header.Get("bsky-actor-did") slog.Info("found a stealth mountain!", "id", commit.Rev, "actor", actorID) - reply, err := bsky.NewPostBuilder(`I think you mean "sneak peek"`).Build() + reply, err := bsky.NewPostBuilder(`I think you mean "sneak peek"`). + InReplyTo(post, actorID, commit.CID, commit.RKey). + Build() if err != nil { slog.Error("can't build reply post", "err", err) } - parent := comatproto.RepoStrongRef{ - LexiconTypeID: "app.bsky.feed.post", - Uri: fmt.Sprintf("at://%s/app.bsky.feed.post/%s", actorID, commit.RKey), - Cid: commit.CID, - } - root := parent - - if post.Reply != nil { - root = *post.Reply.Root - } - - reply.Reply = &bskyData.FeedPost_ReplyRef{ - Parent: &parent, - Root: &root, - } - - reply.CreatedAt = time.Now().UTC().Format(time.RFC3339) cid, uri, err := bsAgent.PostToFeed(ctx, reply) if err != nil { |
