diff --git a/mod_livePosting.go b/mod_livePosting.go index 4de4b90..6f4f3f3 100644 --- a/mod_livePosting.go +++ b/mod_livePosting.go @@ -3,6 +3,7 @@ package main import ( "context" "encoding/base64" + "fmt" "net/url" "strconv" "strings" @@ -230,12 +231,15 @@ func (m *modLivePosting) sendLivePost(username, displayName, title, game, previe "game": game, }) + // @attr post_text required string "" Message to post to channel use `${displayname}` and `${username}` as placeholders + postTemplateDefault := m.attrs.MustString("post_text", nil) + postText := strings.NewReplacer( "${displayname}", displayName, "${username}", username, ).Replace( - // @attr post_text required string "" Message to post to channel use `${displayname}` and `${username}` as placeholders - m.attrs.MustString("post_text", nil), + // @attr post_text_{username} optional string "" Override the default `post_text` with this one (e.g. `post_text_luziferus: "${displayName} is now live"`) + m.attrs.MustString(fmt.Sprintf("post_text_%s", strings.ToLower(username)), &postTemplateDefault), ) // @attr discord_channel_id required string "" ID of the Discord channel to post the message to diff --git a/wiki/Home.md b/wiki/Home.md index 065b152..6b86a27 100644 --- a/wiki/Home.md +++ b/wiki/Home.md @@ -84,6 +84,7 @@ Announces stream live status based on Discord streaming status | `cron` | | string | `*/5 * * * *` | Fetch live status of `poll_usernames` (set to empty string to disable): keep this below `stream_freshness` or you might miss streams | | `disable_presence` | | bool | `false` | Disable posting live-postings for discord presence changes | | `poll_usernames` | | []string | `[]` | Check these usernames for active streams when executing the `cron` (at most 100 users can be checked) | +| `post_text_{username}` | | string | | Override the default `post_text` with this one (e.g. `post_text_luziferus: "${displayName} is now live"`) | | `preserve_proxy` | | string | | URL prefix of a Luzifer/preserve proxy to cache stream preview for longer | | `remove_old` | | bool | `false` | If set to `true` older message with same content will be deleted | | `stream_freshness` | | duration | `5m` | How long after stream start to post shoutout |