From b6e1ea94e8297f126aa56a8cfebcd9bdaaedfe76 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Sat, 17 Jul 2021 14:11:13 +0200 Subject: [PATCH] Fix: Load more entries and stop adding after amount to skip cancelled entries Signed-off-by: Knut Ahlers --- mod_streamSchedule.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mod_streamSchedule.go b/mod_streamSchedule.go index 7a9fec4..11e58da 100644 --- a/mod_streamSchedule.go +++ b/mod_streamSchedule.go @@ -6,7 +6,6 @@ import ( "fmt" "net/http" "net/url" - "strconv" "strings" "time" @@ -65,7 +64,6 @@ func cronUpdateSchedule() { u, _ := url.Parse("https://api.twitch.tv/helix/schedule") params := make(url.Values) params.Set("broadcaster_id", twitchChannelID) - params.Set("first", strconv.Itoa(streamScheduleEntries)) params.Set("start_time", time.Now().Add(-streamSchedulePastTime).Format(time.RFC3339)) u.RawQuery = params.Encode() @@ -117,6 +115,10 @@ func cronUpdateSchedule() { Value: title, Inline: false, }) + + if len(msgEmbed.Fields) == streamScheduleEntries { + break + } } msgs, err := discord.ChannelMessages(discordAnnouncementChannel, 100, "", "", "")