mirror of
https://github.com/lyx0/nourybot.git
synced 2024-11-13 19:49:55 +01:00
dont crash fatally
This commit is contained in:
parent
2733c47f3f
commit
ed90275045
1 changed files with 4 additions and 3 deletions
|
@ -4,8 +4,9 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
// https://api.ivr.fi
|
// https://api.ivr.fi
|
||||||
|
@ -21,14 +22,14 @@ type followageApiResponse struct {
|
||||||
func Followage(streamer string, username string) (string, error) {
|
func Followage(streamer string, username string) (string, error) {
|
||||||
resp, err := http.Get(fmt.Sprintf("https://api.ivr.fi/twitch/subage/%s/%s", username, streamer))
|
resp, err := http.Get(fmt.Sprintf("https://api.ivr.fi/twitch/subage/%s/%s", username, streamer))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalln(err)
|
log.Error(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
body, err := ioutil.ReadAll(resp.Body)
|
body, err := ioutil.ReadAll(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalln(err)
|
log.Error(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var responseObject followageApiResponse
|
var responseObject followageApiResponse
|
||||||
|
|
Loading…
Reference in a new issue