Replying to a message on the watched channel now posts the reply as a reply to the posts that message produced, instead of as a standalone post. Discord tells us the parent through MessageReference, and the store maps it back to the Ref each output returned; that Ref rides along on the new Post.ReplyTo. X takes it as in_reply_to_tweet_id. Bluesky needs the thread root as well as the parent, so a Ref now carries the root it was posted under and a post that is not itself a reply acts as its own root. Replying to something we never distributed, an error notice from the bot for instance, still posts normally. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
33 lines
594 B
Go
33 lines
594 B
Go
package output
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
type stdoutput struct {
|
|
}
|
|
|
|
func StdOutput() *stdoutput {
|
|
return &stdoutput{}
|
|
}
|
|
|
|
func (so *stdoutput) Write(post Post) (Ref, error) {
|
|
if post.ReplyTo != nil {
|
|
fmt.Printf("[reply to: %s]\n", post.ReplyTo.ID)
|
|
}
|
|
fmt.Println(post.Text)
|
|
for _, img := range post.Images {
|
|
fmt.Printf("[image: %s (%s, %d bytes)]\n", img.Filename, img.ContentType, len(img.Data))
|
|
}
|
|
return Ref{ID: post.Text}, nil
|
|
}
|
|
|
|
func (so *stdoutput) Delete(ref Ref) error {
|
|
fmt.Printf("[deleted: %s]\n", ref.ID)
|
|
return nil
|
|
}
|
|
|
|
func (so *stdoutput) GetName() string {
|
|
return "stdout"
|
|
}
|