Compare commits

...

2 commits

Author SHA1 Message Date
878efc08d0 close file 2025-06-06 09:54:10 +01:00
3a03a056e9 Change quotePostFormat 2025-06-05 07:28:22 +01:00

View file

@ -29,7 +29,8 @@ import (
const (
serverAddr = "wss://jetstream2.us-west.bsky.network/subscribe"
// serverAddr = "wss://stream.zio.blue/subscribe"
postFormat = "%s\n—\n<a href=\"https://bsky.app/profile/%s/post/%s\">🦋 @%s</a>"
postFormat = "%s\n—\n<a href=\"https://bsky.app/profile/%s/post/%s\">🦋 @%s</a>"
quotePostFormat = "<blockquote>%s</blockquote>\n<a href=\"https://bsky.app/profile/%s/post/%s\">➡️ @%s</a>\n—\n<a href=\"https://bsky.app/profile/%s/post/%s\">🦋 @%s</a>"
)
type handler struct {
@ -178,7 +179,7 @@ func (h *handler) ProcessPost(event *models.Event) error {
if ps.Embed.Record.Type == "app.bsky.embed.record" {
handle, _ := h.bsky.GetHandleFromDID(strings.Split(ps.Embed.Record.Record.URI, "/")[2])
captionText = fmt.Sprintf(
"<blockquote>%s</blockquote>\n<a href=\"https://bsky.app/profile/%s/post/%s\">➡️ @%s</a>\n—\n<a href=\"https://bsky.app/profile/%s/post/%s\">🦋 @%s</a>",
quotePostFormat,
ps.ProcessFacets(),
strings.Split(ps.Embed.Record.Record.URI, "/")[2],
strings.Split(ps.Embed.Record.Record.URI, "/")[4],
@ -189,7 +190,7 @@ func (h *handler) ProcessPost(event *models.Event) error {
} else {
handle, _ := h.bsky.GetHandleFromDID(strings.Split(ps.Embed.Record.URI, "/")[2])
captionText = fmt.Sprintf(
"<blockquote>%s</blockquote>\n<a href=\"https://bsky.app/profile/%s/post/%s\">➡️ @%s</a>\n—\n<a href=\"https://bsky.app/profile/%s/post/%s\">🦋 @%s</a>",
quotePostFormat,
ps.ProcessFacets(),
strings.Split(ps.Embed.Record.URI, "/")[2],
strings.Split(ps.Embed.Record.URI, "/")[4],
@ -231,6 +232,7 @@ func (h *handler) ProcessPost(event *models.Event) error {
resp, _ := http.Get(buildBlobURL(h.bsky.Bluesky.Cfg.PDSURL, h.bsky.Bluesky.Cfg.DID, media.URI))
defer resp.Body.Close()
f, _ := os.Create(media.URI + ".mp4")
defer f.Close()
io.Copy(f, resp.Body)
f.Seek(0, 0)
mediaAdd := tgbotapi.NewInputMediaVideo(tgbotapi.FileReader{Name: "video.mp4", Reader: f})