Make possible to set an optional footer for toots
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
30a96b9e27
commit
2c2331c371
|
@ -23,6 +23,7 @@ public groups.
|
||||||
|--------------------------------|------------------------------|----------|
|
|--------------------------------|------------------------------|----------|
|
||||||
| `MASTODON_ACCESS_TOKEN` | Mastodon access token | *N/A* |
|
| `MASTODON_ACCESS_TOKEN` | Mastodon access token | *N/A* |
|
||||||
| `MASTODON_SERVER_ADDRESS` | Mastodon server address | *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_MAX_CHARACTERS` | Toot max lenght | 500 |
|
||||||
| `MASTODON_TOOT_VISIBILITY` | Default toot visibility | unlisted |
|
| `MASTODON_TOOT_VISIBILITY` | Default toot visibility | unlisted |
|
||||||
| `TELEGRAM_BOT_TOKEN` | Telegram bot token | *N/A* |
|
| `TELEGRAM_BOT_TOKEN` | Telegram bot token | *N/A* |
|
||||||
|
@ -31,6 +32,9 @@ public groups.
|
||||||
|
|
||||||
`MASTODON_TOOT_VISIBILITY` allowed values are: `direct`, `private`, `public`
|
`MASTODON_TOOT_VISIBILITY` allowed values are: `direct`, `private`, `public`
|
||||||
and `unlisted`.
|
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.
|
To get `MASTODON_ACCESS_TOKEN` see next point.
|
||||||
4. To get `MASTODON_ACCESS_TOKEN` use the subcommand `authenticate`:
|
4. To get `MASTODON_ACCESS_TOKEN` use the subcommand `authenticate`:
|
||||||
```
|
```
|
||||||
|
|
|
@ -79,7 +79,10 @@ the specified Mastodon account.`,
|
||||||
text := update.Message.Text
|
text := update.Message.Text
|
||||||
in_reply_to := ""
|
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, err := c.PostStatus(context.Background(), &mastodon.Toot{
|
||||||
Status: message,
|
Status: message,
|
||||||
Visibility: parseMastodonVisibility(os.Getenv(MASTODON_TOOT_VISIBILITY)),
|
Visibility: parseMastodonVisibility(os.Getenv(MASTODON_TOOT_VISIBILITY)),
|
||||||
|
|
Loading…
Reference in New Issue