1
0
Fork 0
Browse Source

Make possible to set an optional footer for toots

main
Daniele Tricoli 4 months ago
parent
commit
2c2331c371
  1. 4
      README.md
  2. 5
      cmd/run.go

4
README.md

@ -23,6 +23,7 @@ public groups.
|--------------------------------|------------------------------|----------|
| `MASTODON_ACCESS_TOKEN` | Mastodon access token | *N/A* |
| `MASTODON_SERVER_ADDRESS` | Mastodon server address | *N/A* |
| `MASTODON_TOOT_FOOTER ` | Footer of each toot | "" |
| `MASTODON_TOOT_MAX_CHARACTERS` | Toot max lenght | 500 |
| `MASTODON_TOOT_VISIBILITY` | Default toot visibility | unlisted |
| `TELEGRAM_BOT_TOKEN` | Telegram bot token | *N/A* |
@ -31,6 +32,9 @@ public groups.
`MASTODON_TOOT_VISIBILITY` allowed values are: `direct`, `private`, `public`
and `unlisted`.
`MASTODON_TOOT_FOOTER` default is an empty string that disable the footer
feature, no character ad automatically added so you may want to add a space
before your footer (or a new line).
To get `MASTODON_ACCESS_TOKEN` see next point.
4. To get `MASTODON_ACCESS_TOKEN` use the subcommand `authenticate`:
```

5
cmd/run.go

@ -79,7 +79,10 @@ the specified Mastodon account.`,
text := update.Message.Text
in_reply_to := ""
for _, message := range utils.SplitTextAtChunk(text, max_characters, "") {
toot_footer := os.Getenv(MASTODON_TOOT_FOOTER)
messages := utils.SplitTextAtChunk(text, max_characters, toot_footer)
for _, message := range messages {
status, err := c.PostStatus(context.Background(), &mastodon.Toot{
Status: message,
Visibility: parseMastodonVisibility(os.Getenv(MASTODON_TOOT_VISIBILITY)),

Loading…
Cancel
Save