This commit is contained in:
parent
acbdd41680
commit
c4d4e91548
1 changed files with 9 additions and 4 deletions
13
main.go
13
main.go
|
@ -88,11 +88,11 @@ func main() {
|
||||||
log.Fatal("Unable to send posts from other accounts")
|
log.Fatal("Unable to send posts from other accounts")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tgpost, tgposterr := h.bsky.Bluesky.GetTelegramData(s[2])
|
||||||
if *delete {
|
if *delete {
|
||||||
r, e := h.bsky.Bluesky.GetTelegramData(s[2])
|
if tgposterr == "" {
|
||||||
if e == "" {
|
log.Printf("Found post %s in channel %d, deleting", s[2], tgpost.ChannelID)
|
||||||
log.Printf("Found post %s in channel %d, deleting", s[2], r.ChannelID)
|
m := tgbotapi.NewDeleteMessages(tgpost.ChannelID, tgpost.MessageID)
|
||||||
m := tgbotapi.NewDeleteMessages(r.ChannelID, r.MessageID)
|
|
||||||
h.tg.Send(m)
|
h.tg.Send(m)
|
||||||
h.bsky.Bluesky.DeleteRecord([]string{s[2], s[1], "blue.zio.bsky2tg.post"})
|
h.bsky.Bluesky.DeleteRecord([]string{s[2], s[1], "blue.zio.bsky2tg.post"})
|
||||||
} else {
|
} else {
|
||||||
|
@ -101,6 +101,11 @@ func main() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if tgpost.ChannelID != 0 {
|
||||||
|
log.Printf("Post %s already sent to channel %d, exiting", s[2], tgpost.ChannelID)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
postJSON := bskyClient.Bluesky.FetchPost(handle, s[2])
|
postJSON := bskyClient.Bluesky.FetchPost(handle, s[2])
|
||||||
p, _ := json.Marshal(postJSON.Record)
|
p, _ := json.Marshal(postJSON.Record)
|
||||||
h.ProcessPost(&models.Event{
|
h.ProcessPost(&models.Event{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue