Skip to content

Commit c428d13

Browse files
committed
fix: tweets creating as invalid to bsky
1 parent 2e1c78b commit c428d13

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

bluesky/blueskyapi.go

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ type User struct {
6363
type PostRecord struct {
6464
Type string `json:"$type"`
6565
CreatedAt time.Time `json:"createdAt"`
66-
Embed Embed `json:"embed"`
67-
Facets []Facet `json:"facets"`
68-
Langs []string `json:"langs"`
69-
Text string `json:"text"`
66+
Embed Embed `json:"embed,omitempty"`
67+
Facets []Facet `json:"facets,omitempty"`
68+
Langs []string `json:"langs,omitempty"`
69+
Text string `json:"text,omitempty"`
7070
Reply *ReplySubject `json:"reply,omitempty"`
7171
}
7272

@@ -79,7 +79,7 @@ type PostReason struct {
7979

8080
type Embed struct {
8181
Type string `json:"$type"`
82-
Images []Image `json:"images"`
82+
Images []Image `json:"images,omitempty"`
8383
}
8484

8585
type Image struct {
@@ -956,7 +956,12 @@ func UpdateStatus(pds string, token string, my_did string, status string, in_rep
956956
CreatedAt: time.Now().UTC(),
957957
Reply: replySubject,
958958
Facets: facets,
959-
Embed: &embeds,
959+
Embed: func() *Embed {
960+
if embeds.Type == "" {
961+
return nil
962+
}
963+
return &embeds
964+
}(),
960965
},
961966
}
962967

0 commit comments

Comments
 (0)