add embed URL
All checks were successful
/ build (push) Successful in 1m12s

This commit is contained in:
Astra 2025-09-26 09:34:25 +01:00
parent c4d4e91548
commit 2afd9af2af

View file

@ -29,10 +29,11 @@ import (
) )
const ( const (
serverAddr = "wss://jetstream2.us-west.bsky.network/subscribe"
// serverAddr = "wss://stream.zio.blue/subscribe" // serverAddr = "wss://stream.zio.blue/subscribe"
serverAddr = "wss://jetstream2.us-west.bsky.network/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>" 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>"
embedURL = "https://fxbsky.app/profile/%s/post/%s"
) )
type handler struct { type handler struct {
@ -307,7 +308,7 @@ func (h *handler) ProcessPost(event *models.Event) error {
if ps.IsQuotePost() { if ps.IsQuotePost() {
m.LinkPreviewOptions = tgbotapi.LinkPreviewOptions{ m.LinkPreviewOptions = tgbotapi.LinkPreviewOptions{
IsDisabled: false, IsDisabled: false,
URL: fmt.Sprintf("https://fxbsky.app/profile/%s/post/%s", URL: fmt.Sprintf(embedURL,
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: false, PreferSmallMedia: false,