add delete flag

This commit is contained in:
Astra 2025-07-02 16:38:18 +01:00
parent b390554348
commit 435f3fbb53

13
main.go
View file

@ -86,6 +86,19 @@ func main() {
handle, _ = bskyClient.ResolveHandle(s[1])
}
if *delete {
r, e := h.bsky.Bluesky.GetTelegramData(s[2])
if e == "" {
log.Printf("Found post %s in channel %d, deleting", s[2], r.ChannelID)
m := tgbotapi.NewDeleteMessage(r.ChannelID, r.MessageID)
h.tg.Send(m)
h.bsky.Bluesky.DeleteRecord([]string{s[2], s[1], "blue.zio.bsky2tg.post"})
} else {
log.Printf("Unable to find post %s on PDS", s[2])
}
return
}
postJSON := bskyClient.Bluesky.FetchPost(handle, s[2])
p, _ := json.Marshal(postJSON.Record)
h.ProcessPost(&models.Event{