From c8de7971662fb9b5451482d9fa395cf1a6a3c362 Mon Sep 17 00:00:00 2001 From: Carl Kittelberger Date: Fri, 15 Jun 2018 00:09:02 +0200 Subject: [PATCH] Implement configurable topic change timer. --- main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 70b01ca..c24570c 100644 --- a/main.go +++ b/main.go @@ -56,6 +56,7 @@ func main() { var password string var timeout time.Duration var pingFreq time.Duration + topicRefreshDelay := 30 * time.Second var allowInvite bool @@ -80,6 +81,7 @@ func main() { // football-data config kingpin.Flag("footballdata-key", "The API key to use to access the YouTube API.").StringVar(&authToken) + kingpin.Flag("topic-refresh-delay", "The interval between topic updates. (This includes asking football-data for new information!)").DurationVar(&topicRefreshDelay) // behavior config kingpin.Flag("allow-invite", "Determines whether the bot can be invited to other IRC channels.").BoolVar(&allowInvite) @@ -675,7 +677,7 @@ func main() { for { // Wait a minute before refreshing select { - case <-time.After(30 * time.Second): + case <-time.After(topicRefreshDelay): case <-updateTopicsChan: }