mirror Discord replies as replies on X and bluesky
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>
This commit is contained in:
@@ -7,18 +7,28 @@ type Image struct {
|
||||
}
|
||||
|
||||
// Ref identifies a post an output has already published so it can later be
|
||||
// deleted. The fields are output specific; only the ones the publishing
|
||||
// output filled in are meaningful to it.
|
||||
// replied to or deleted. The fields are output specific; only the ones the
|
||||
// publishing output filled in are meaningful to it.
|
||||
type Ref struct {
|
||||
ID string `json:"id,omitempty"` // twitter: tweet ID
|
||||
URI string `json:"uri,omitempty"` // bluesky: at:// URI of the record
|
||||
CID string `json:"cid,omitempty"` // bluesky: record CID
|
||||
ID string `json:"id,omitempty"` // twitter: tweet ID
|
||||
URI string `json:"uri,omitempty"` // bluesky: at:// URI of the record
|
||||
CID string `json:"cid,omitempty"` // bluesky: record CID
|
||||
RootURI string `json:"rooturi,omitempty"`
|
||||
RootCID string `json:"rootcid,omitempty"`
|
||||
}
|
||||
|
||||
// IsZero reports whether the ref points at nothing.
|
||||
func (r Ref) IsZero() bool {
|
||||
return r == Ref{}
|
||||
}
|
||||
|
||||
// Post is a single message to distribute.
|
||||
type Post struct {
|
||||
Text string
|
||||
Images []Image
|
||||
// ReplyTo is the Ref this same output returned for the post being
|
||||
// replied to, or nil for a top level post.
|
||||
ReplyTo *Ref
|
||||
}
|
||||
|
||||
type OutputInterface interface {
|
||||
|
||||
Reference in New Issue
Block a user