mirror of
https://github.com/lyx0/nourybot.git
synced 2024-11-13 19:49:55 +01:00
refactor baseUrl
This commit is contained in:
parent
4682657025
commit
5d4c5b4402
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue