diff --git a/main.go b/main.go index 2e9a476..e6c6b5b 100644 --- a/main.go +++ b/main.go @@ -21,6 +21,8 @@ import ( "git.zio.sh/astra/bsky2tg/bsky" tgbotapi "github.com/OvyFlash/telegram-bot-api" + // apibsky "github.com/bluesky-social/indigo/api/bsky" + "github.com/bluesky-social/jetstream/pkg/client" "github.com/bluesky-social/jetstream/pkg/client/schedulers/sequential" "github.com/bluesky-social/jetstream/pkg/models" @@ -137,6 +139,47 @@ func main() { log.Fatalf("failed to create client: %v", err) } + // ------------------------------------------------------------------------------ + // file, err := os.Open("posts.json") + // if err != nil { + // fmt.Printf("Error opening file: %v\n", err) + // return + // } + // defer file.Close() + // byteValue, err := io.ReadAll(file) + // if err != nil { + // fmt.Printf("Error reading file: %v\n", err) + // return + // } + + // var posts = struct { + // Records []struct { + // URI string `json:"uri"` + // CID string `json:"cid"` + // Value *bsky.Post `json:"value"` + // } `json:"records"` + // }{} + + // // 4. Unmarshal (decode) the JSON data into the struct + // err = json.Unmarshal(byteValue, &posts) + // if err != nil { + // fmt.Printf("Error unmarshaling JSON: %v\n", err) + // return + // } + // for _, post := range posts.Records { + // log.Printf("post: %s\n", post.Value.ProcessFacets(h.bsky.Bluesky.FetchAliases())) + // s, _ := json.Marshal(post.Value) + // h.ProcessPost(&models.Event{Did: bskyClient.Bluesky.Cfg.DID, Commit: &models.Commit{ + // Record: s, + // RKey: strings.Split(post.URI, "/")[4], + // CID: post.CID, + // Collection: "app.bsky.feed.post", + // }}) + // time.Sleep(time.Second * 2) + // } + // return + // ------------------------------------------------------------------------------ + cursor := time.Now().UnixMicro() restartCount := 0 loop: @@ -301,8 +344,7 @@ func (h *handler) ProcessPost(event *models.Event) error { URL: fmt.Sprintf("https://bsky.app/profile/%s/post/%s", strings.Split(ps.Embed.Record.URI, "/")[2], strings.Split(ps.Embed.Record.URI, "/")[4]), - PreferSmallMedia: false, - PreferLargeMedia: true, + PreferSmallMedia: true, ShowAboveText: true, } } else {