diff --git a/pkg/api/aiden/aiden.go b/pkg/api/aiden/aiden.go index 497f46e..4fc8fa9 100644 --- a/pkg/api/aiden/aiden.go +++ b/pkg/api/aiden/aiden.go @@ -12,6 +12,8 @@ var ( basePath = "https://customapi.aidenwallis.co.uk/" ) +// ApiCall calls https://customapi.aidenwallis.co.uk/ with +// a given uri and returns the result and an error. func ApiCall(uri string) (string, error) { resp, err := http.Get(fmt.Sprint(basePath + uri)) if err != nil { diff --git a/pkg/api/ivr/firstline.go b/pkg/api/ivr/firstline.go index 3f2ae15..fa567b8 100644 --- a/pkg/api/ivr/firstline.go +++ b/pkg/api/ivr/firstline.go @@ -20,8 +20,10 @@ var ( firstLineBaseUrl = "https://api.ivr.fi/logs/firstmessage" ) -func FirstLine(streamer string, username string) (string, error) { - resp, err := http.Get(fmt.Sprintf("%s/%s/%s", firstLineBaseUrl, streamer, username)) +// 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)) 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 2ab1ea9..7e1379b 100644 --- a/pkg/api/ivr/followage.go +++ b/pkg/api/ivr/followage.go @@ -19,6 +19,7 @@ type followageApiResponse struct { Error string `json:"error"` } +// 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)) if err != nil { diff --git a/pkg/api/ivr/profilepicture.go b/pkg/api/ivr/profilepicture.go index 5494996..791a17b 100644 --- a/pkg/api/ivr/profilepicture.go +++ b/pkg/api/ivr/profilepicture.go @@ -19,6 +19,7 @@ var ( baseUrl = "https://api.ivr.fi/twitch/resolve" ) +// ProfilePicture returns a link to a given users profilepicture. func ProfilePicture(username string) (string, error) { resp, err := http.Get(fmt.Sprintf("%s/%s", baseUrl, username)) if err != nil { diff --git a/pkg/api/ivr/subage.go b/pkg/api/ivr/subage.go index 1c03781..83a945e 100644 --- a/pkg/api/ivr/subage.go +++ b/pkg/api/ivr/subage.go @@ -34,8 +34,9 @@ var ( subageBaseUrl = "https://api.ivr.fi/twitch/subage" ) -func Subage(username string, streamer string) (string, error) { - resp, err := http.Get(fmt.Sprintf("%s/%s/%s", subageBaseUrl, username, streamer)) +// 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)) if err != nil { log.Error(err) return "Something went wrong FeelsBadMan", err @@ -64,7 +65,7 @@ func Subage(username string, streamer string) (string, error) { return reply, nil } else { months := fmt.Sprint(responseObject.Cumulative.Months) - reply := fmt.Sprintf(username + " has been subscribed to " + streamer + " for " + months + " months.") + reply := fmt.Sprintf(username + " has been subscribed to " + channel + " for " + months + " months.") return reply, nil } } diff --git a/pkg/api/ivr/userid.go b/pkg/api/ivr/userid.go index 80c8e7c..4251d1e 100644 --- a/pkg/api/ivr/userid.go +++ b/pkg/api/ivr/userid.go @@ -15,6 +15,7 @@ type uidApiResponse struct { Error string `json:"error"` } +// 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)) if err != nil { diff --git a/pkg/api/numbersapi.go b/pkg/api/numbersapi.go index e1d4799..74606e6 100644 --- a/pkg/api/numbersapi.go +++ b/pkg/api/numbersapi.go @@ -8,6 +8,8 @@ import ( log "github.com/sirupsen/logrus" ) +// RandomNumber returns a string containg fun facts about a random number. +// API used: http://numbersapi.com func RandomNumber() string { response, err := http.Get("http://numbersapi.com/random/trivia") if err != nil { @@ -21,6 +23,8 @@ func RandomNumber() string { return string(responseData) } +// Number returns a string containing fun facts about a given number. +// API used: http://numbersapi.com func Number(number string) string { response, err := http.Get(fmt.Sprint("http://numbersapi.com/" + string(number))) if err != nil { diff --git a/pkg/api/randomcat.go b/pkg/api/randomcat.go index efede29..c2a4cff 100644 --- a/pkg/api/randomcat.go +++ b/pkg/api/randomcat.go @@ -12,6 +12,8 @@ type randomCatResponse struct { File string `json:"file"` } +// RandomCat returns a link to a random cat picture. +// API used: https://aws.random.cat/meow func RandomCat() string { response, err := http.Get("https://aws.random.cat/meow") if err != nil { diff --git a/pkg/api/randomdog.go b/pkg/api/randomdog.go index 7b17af5..f96c3e3 100644 --- a/pkg/api/randomdog.go +++ b/pkg/api/randomdog.go @@ -12,6 +12,8 @@ type randomDogResponse struct { Url string `json:"url"` } +// RandomDog returns a link to a random dog picture. +// API used: https://random.dog/woof.json func RandomDog() string { response, err := http.Get("https://random.dog/woof.json") if err != nil { diff --git a/pkg/api/randomduck.go b/pkg/api/randomduck.go index 0de634e..615851b 100644 --- a/pkg/api/randomduck.go +++ b/pkg/api/randomduck.go @@ -12,6 +12,8 @@ type randomDuckResponse struct { Url string `json:"url"` } +// RandomDuck returns a link to a random duck picture. +// API used: https://random-d.uk/api/random func RandomDuck() string { response, err := http.Get("https://random-d.uk/api/random") if err != nil { diff --git a/pkg/api/randomfox.go b/pkg/api/randomfox.go index 6a4bfc5..63f55ef 100644 --- a/pkg/api/randomfox.go +++ b/pkg/api/randomfox.go @@ -13,6 +13,8 @@ type randomFoxResponse struct { Link string `json:"link"` } +// RandomFox returns a link to a random fox picture. +// API used: https://randomfox.ca/floof/ func RandomFox() string { response, err := http.Get("https://randomfox.ca/floof/") if err != nil { diff --git a/pkg/api/randomxkcd.go b/pkg/api/randomxkcd.go index 0384758..cc7f4ba 100644 --- a/pkg/api/randomxkcd.go +++ b/pkg/api/randomxkcd.go @@ -16,6 +16,7 @@ type XkcdResponse struct { Img string `json:"img"` } +// RandomXkcd returns a link to a random Xkcd comic. func RandomXkcd() string { comicNum := fmt.Sprint(utils.GenerateRandomNumber(2468)) response, err := http.Get(fmt.Sprint("http://xkcd.com/" + comicNum + "/info.0.json")) diff --git a/pkg/api/xkcd.go b/pkg/api/xkcd.go index 6a3776d..febc34c 100644 --- a/pkg/api/xkcd.go +++ b/pkg/api/xkcd.go @@ -9,6 +9,8 @@ import ( log "github.com/sirupsen/logrus" ) +// Xkcd returns a link to the latest Xkcd comic. +// API used: https://xkcd.com/info.0.json func Xkcd() string { response, err := http.Get("https://xkcd.com/info.0.json") if err != nil {