mirror of
https://github.com/Luzifer/discord-community.git
synced 2024-12-20 10:21:22 +00:00
Prevent duplicate attribute parsing
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
208e2e8666
commit
56fab109a1
1 changed files with 3 additions and 2 deletions
|
@ -111,14 +111,15 @@ func (m modLivePosting) fetchAndPostForUsername(usernames ...string) error {
|
|||
"users": len(users.Data),
|
||||
}).Trace("Found active streams from users")
|
||||
|
||||
// @attr stream_freshness optional duration "5m" How long after stream start to post shoutout
|
||||
streamFreshness := m.attrs.MustDuration("stream_freshness", ptrDuration(livePostingDefaultStreamFreshness))
|
||||
|
||||
for _, stream := range streams.Data {
|
||||
for _, user := range users.Data {
|
||||
if user.ID != stream.UserID {
|
||||
continue
|
||||
}
|
||||
|
||||
// @attr stream_freshness optional duration "5m" How long after stream start to post shoutout
|
||||
streamFreshness := m.attrs.MustDuration("stream_freshness", ptrDuration(livePostingDefaultStreamFreshness))
|
||||
if time.Since(stream.StartedAt) > streamFreshness {
|
||||
// Stream is too old, don't annoounce
|
||||
return nil
|
||||
|
|
Loading…
Reference in a new issue