1
0
Fork 0

Slice caption only when > 500 characters

main
Daniele Tricoli 5 months ago
parent ac0d898af9
commit a9719668ee
  1. 6
      cmd/run.go

@ -114,10 +114,14 @@ the specified Mastodon account.`,
log.Printf("Posted attachment %s", attachment.TextURL)
mediaIds := [...]mastodon.ID{attachment.ID}
caption := update.Message.Caption
if len(caption) > max_characters {
caption = caption[:max_characters]
}
status, err := c.PostStatus(context.Background(), &mastodon.Toot{
// Write the caption in the toot because it almost probably
// doesn't describe the image.
Status: update.Message.Caption[:max_characters],
Status: caption,
MediaIDs: mediaIds[:],
Visibility: parseMastodonVisibility(os.Getenv(MASTODON_TOOT_VISIBILITY)),
})

Loading…
Cancel
Save