diff --git a/pkg/api/ivr/firstline.go b/pkg/api/ivr/firstline.go index fa567b8..ff3da2f 100644 --- a/pkg/api/ivr/firstline.go +++ b/pkg/api/ivr/firstline.go @@ -16,14 +16,12 @@ type firstLineApiResponse struct { Error string `json:"error"` } -var ( - firstLineBaseUrl = "https://api.ivr.fi/logs/firstmessage" -) - // FirstLine returns the first line a given user has sent in a // given channel. func FirstLine(channel string, username string) (string, error) { - resp, err := http.Get(fmt.Sprintf("%s/%s/%s", firstLineBaseUrl, channel, username)) + baseUrl := "https://api.ivr.fi/logs/firstmessage" + + resp, err := http.Get(fmt.Sprintf("%s/%s/%s", baseUrl, channel, username)) if err != nil { log.Error(err) return "Something went wrong FeelsBadMan", err diff --git a/pkg/api/ivr/followage.go b/pkg/api/ivr/followage.go index 7e1379b..8b48089 100644 --- a/pkg/api/ivr/followage.go +++ b/pkg/api/ivr/followage.go @@ -21,7 +21,8 @@ type followageApiResponse struct { // Followage returns the time since a given user followed a given streamer func Followage(streamer string, username string) (string, error) { - resp, err := http.Get(fmt.Sprintf("https://api.ivr.fi/twitch/subage/%s/%s", username, streamer)) + baseUrl := "https://api.ivr.fi/twitch/subage" + resp, err := http.Get(fmt.Sprintf("%s/%s/%s", baseUrl, username, streamer)) if err != nil { log.Error(err) } diff --git a/pkg/api/ivr/profilepicture.go b/pkg/api/ivr/profilepicture.go index 791a17b..70180f2 100644 --- a/pkg/api/ivr/profilepicture.go +++ b/pkg/api/ivr/profilepicture.go @@ -15,12 +15,10 @@ type pfpApiResponse struct { Error string `json:"error"` } -var ( - baseUrl = "https://api.ivr.fi/twitch/resolve" -) - // ProfilePicture returns a link to a given users profilepicture. func ProfilePicture(username string) (string, error) { + baseUrl := "https://api.ivr.fi/twitch/resolve" + resp, err := http.Get(fmt.Sprintf("%s/%s", baseUrl, username)) if err != nil { log.Error(err) diff --git a/pkg/api/ivr/randomquote.go b/pkg/api/ivr/randomquote.go index 68cffd7..4c1f0ae 100644 --- a/pkg/api/ivr/randomquote.go +++ b/pkg/api/ivr/randomquote.go @@ -16,14 +16,14 @@ type randomQuoteApiResponse struct { Error string `json:"Error"` } -var ( - randomQuoteBaseUrl = "https://api.ivr.fi/logs/rq" -) +var () // FirstLine returns the first line a given user has sent in a // given channel. func RandomQuote(channel string, username string) (string, error) { - resp, err := http.Get(fmt.Sprintf("%s/%s/%s", randomQuoteBaseUrl, channel, username)) + baseUrl := "https://api.ivr.fi/logs/rq" + + resp, err := http.Get(fmt.Sprintf("%s/%s/%s", baseUrl, channel, username)) if err != nil { log.Error(err) return "Something went wrong FeelsBadMan", err diff --git a/pkg/api/ivr/subage.go b/pkg/api/ivr/subage.go index 83a945e..1497f05 100644 --- a/pkg/api/ivr/subage.go +++ b/pkg/api/ivr/subage.go @@ -30,13 +30,11 @@ type subStreak struct { Months int `json:"months"` } -var ( - subageBaseUrl = "https://api.ivr.fi/twitch/subage" -) - // Subage returns the length a given user has been subscribed to a given channel. func Subage(username string, channel string) (string, error) { - resp, err := http.Get(fmt.Sprintf("%s/%s/%s", subageBaseUrl, username, channel)) + baseUrl := "https://api.ivr.fi/twitch/subage" + + resp, err := http.Get(fmt.Sprintf("%s/%s/%s", baseUrl, username, channel)) if err != nil { log.Error(err) return "Something went wrong FeelsBadMan", err diff --git a/pkg/api/ivr/userid.go b/pkg/api/ivr/userid.go index 4251d1e..72f8095 100644 --- a/pkg/api/ivr/userid.go +++ b/pkg/api/ivr/userid.go @@ -17,7 +17,9 @@ type uidApiResponse struct { // Userid returns the userID of a given user func Userid(username string) string { - resp, err := http.Get(fmt.Sprintf("https://api.ivr.fi/twitch/resolve/%s", username)) + baseUrl := "https://api.ivr.fi/twitch/resolve" + + resp, err := http.Get(fmt.Sprintf("%s/%s", baseUrl, username)) if err != nil { log.Error(err) }