Compare commits
2 commits
be8b787c52
...
bd8a437f43
Author | SHA1 | Date | |
---|---|---|---|
bd8a437f43 | |||
dbc89e5b95 |
1 changed files with 2 additions and 44 deletions
46
main.go
46
main.go
|
@ -21,8 +21,6 @@ import (
|
||||||
"git.zio.sh/astra/bsky2tg/bsky"
|
"git.zio.sh/astra/bsky2tg/bsky"
|
||||||
tgbotapi "github.com/OvyFlash/telegram-bot-api"
|
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"
|
||||||
"github.com/bluesky-social/jetstream/pkg/client/schedulers/sequential"
|
"github.com/bluesky-social/jetstream/pkg/client/schedulers/sequential"
|
||||||
"github.com/bluesky-social/jetstream/pkg/models"
|
"github.com/bluesky-social/jetstream/pkg/models"
|
||||||
|
@ -139,47 +137,6 @@ func main() {
|
||||||
log.Fatalf("failed to create client: %v", err)
|
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()
|
cursor := time.Now().UnixMicro()
|
||||||
restartCount := 0
|
restartCount := 0
|
||||||
loop:
|
loop:
|
||||||
|
@ -344,7 +301,8 @@ func (h *handler) ProcessPost(event *models.Event) error {
|
||||||
URL: fmt.Sprintf("https://bsky.app/profile/%s/post/%s",
|
URL: fmt.Sprintf("https://bsky.app/profile/%s/post/%s",
|
||||||
strings.Split(ps.Embed.Record.URI, "/")[2],
|
strings.Split(ps.Embed.Record.URI, "/")[2],
|
||||||
strings.Split(ps.Embed.Record.URI, "/")[4]),
|
strings.Split(ps.Embed.Record.URI, "/")[4]),
|
||||||
PreferSmallMedia: true,
|
PreferSmallMedia: false,
|
||||||
|
PreferLargeMedia: true,
|
||||||
ShowAboveText: true,
|
ShowAboveText: true,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue