Slice caption only when > 500 characters
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
ac0d898af9
commit
a9719668ee
|
@ -114,10 +114,14 @@ the specified Mastodon account.`,
|
||||||
log.Printf("Posted attachment %s", attachment.TextURL)
|
log.Printf("Posted attachment %s", attachment.TextURL)
|
||||||
|
|
||||||
mediaIds := [...]mastodon.ID{attachment.ID}
|
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{
|
status, err := c.PostStatus(context.Background(), &mastodon.Toot{
|
||||||
// Write the caption in the toot because it almost probably
|
// Write the caption in the toot because it almost probably
|
||||||
// doesn't describe the image.
|
// doesn't describe the image.
|
||||||
Status: update.Message.Caption[:max_characters],
|
Status: caption,
|
||||||
MediaIDs: mediaIds[:],
|
MediaIDs: mediaIds[:],
|
||||||
Visibility: parseMastodonVisibility(os.Getenv(MASTODON_TOOT_VISIBILITY)),
|
Visibility: parseMastodonVisibility(os.Getenv(MASTODON_TOOT_VISIBILITY)),
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue