mirror of
https://github.com/Luzifer/discord-community.git
synced 2024-12-20 10:21:22 +00:00
[liveposting] Add support for preserve-proxy for stream previews
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
d7b74f4d6c
commit
cb4dd4d4cf
2 changed files with 7 additions and 0 deletions
|
@ -272,6 +272,12 @@ func (m *modLivePosting) sendLivePost(username, displayName, title, game, previe
|
||||||
previewImageQuery.Add("_discordNoCache", time.Now().Format(time.RFC3339))
|
previewImageQuery.Add("_discordNoCache", time.Now().Format(time.RFC3339))
|
||||||
previewImageURL.RawQuery = previewImageQuery.Encode()
|
previewImageURL.RawQuery = previewImageQuery.Encode()
|
||||||
|
|
||||||
|
// @attr preserve_proxy optional string "" URL prefix of a Luzifer/preserve proxy to cache stream preview for longer
|
||||||
|
if proxy, err := url.Parse(m.attrs.MustString("preserve_proxy", ptrStringEmpty)); err == nil && proxy.String() != "" {
|
||||||
|
proxy.Path = "/" + previewImageURL.String()
|
||||||
|
previewImageURL = proxy
|
||||||
|
}
|
||||||
|
|
||||||
msgEmbed := &discordgo.MessageEmbed{
|
msgEmbed := &discordgo.MessageEmbed{
|
||||||
Author: &discordgo.MessageEmbedAuthor{
|
Author: &discordgo.MessageEmbedAuthor{
|
||||||
Name: displayName,
|
Name: displayName,
|
||||||
|
|
|
@ -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 |
|
| `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 |
|
| `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) |
|
| `poll_usernames` | | []string | `[]` | Check these usernames for active streams when executing the `cron` (at most 100 users can be checked) |
|
||||||
|
| `preserve_proxy` | | string | | URL prefix of a Luzifer/preserve proxy to cache stream preview for longer |
|
||||||
| `stream_freshness` | | duration | `5m` | How long after stream start to post shoutout |
|
| `stream_freshness` | | duration | `5m` | How long after stream start to post shoutout |
|
||||||
| `whitelisted_role` | | string | | Only post for members of this role ID |
|
| `whitelisted_role` | | string | | Only post for members of this role ID |
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue