add alias support for mentions
This commit is contained in:
parent
fa0376bf3c
commit
164f3629ab
3 changed files with 53 additions and 7 deletions
12
main.go
12
main.go
|
@ -110,7 +110,7 @@ func main() {
|
|||
// return
|
||||
// }
|
||||
// for _, post := range posts.Records {
|
||||
// log.Printf("post: %s\n", post.Value.ProcessFacets())
|
||||
// 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,
|
||||
|
@ -180,7 +180,7 @@ func (h *handler) ProcessPost(event *models.Event) error {
|
|||
handle, _ := h.bsky.GetHandleFromDID(strings.Split(ps.Embed.Record.Record.URI, "/")[2])
|
||||
captionText = fmt.Sprintf(
|
||||
quotePostFormat,
|
||||
ps.ProcessFacets(),
|
||||
ps.ProcessFacets(h.bsky.Bluesky.FetchAliases()),
|
||||
strings.Split(ps.Embed.Record.Record.URI, "/")[2],
|
||||
strings.Split(ps.Embed.Record.Record.URI, "/")[4],
|
||||
handle,
|
||||
|
@ -191,7 +191,7 @@ func (h *handler) ProcessPost(event *models.Event) error {
|
|||
handle, _ := h.bsky.GetHandleFromDID(strings.Split(ps.Embed.Record.URI, "/")[2])
|
||||
captionText = fmt.Sprintf(
|
||||
quotePostFormat,
|
||||
ps.ProcessFacets(),
|
||||
ps.ProcessFacets(h.bsky.Bluesky.FetchAliases()),
|
||||
strings.Split(ps.Embed.Record.URI, "/")[2],
|
||||
strings.Split(ps.Embed.Record.URI, "/")[4],
|
||||
handle,
|
||||
|
@ -202,8 +202,8 @@ func (h *handler) ProcessPost(event *models.Event) error {
|
|||
}
|
||||
|
||||
if captionText == "" {
|
||||
if ps.ProcessFacets() != "" {
|
||||
captionText = fmt.Sprintf(postFormat, ps.ProcessFacets(), h.bsky.Bluesky.Cfg.DID, event.Commit.RKey, h.bsky.Bluesky.Cfg.Handle)
|
||||
if ps.ProcessFacets(h.bsky.Bluesky.FetchAliases()) != "" {
|
||||
captionText = fmt.Sprintf(postFormat, ps.ProcessFacets(h.bsky.Bluesky.FetchAliases()), h.bsky.Bluesky.Cfg.DID, event.Commit.RKey, h.bsky.Bluesky.Cfg.Handle)
|
||||
} else {
|
||||
captionText = fmt.Sprintf("<a href=\"https://bsky.app/profile/%s/post/%s\">🦋 @%s</a>", h.bsky.Bluesky.Cfg.DID, event.Commit.RKey, h.bsky.Bluesky.Cfg.Handle)
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ func (h *handler) ProcessPost(event *models.Event) error {
|
|||
} else {
|
||||
m := tgbotapi.MessageConfig{}
|
||||
if captionText == "" {
|
||||
m = tgbotapi.NewMessage(cid, fmt.Sprintf(postFormat, ps.ProcessFacets(), h.bsky.Bluesky.Cfg.DID, event.Commit.RKey, h.bsky.Bluesky.Cfg.Handle))
|
||||
m = tgbotapi.NewMessage(cid, fmt.Sprintf(postFormat, ps.ProcessFacets(h.bsky.Bluesky.FetchAliases()), h.bsky.Bluesky.Cfg.DID, event.Commit.RKey, h.bsky.Bluesky.Cfg.Handle))
|
||||
} else {
|
||||
m = tgbotapi.NewMessage(cid, captionText)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue