mirror of
https://github.com/lyx0/nourybot.git
synced 2024-11-13 19:49:55 +01:00
27 lines
493 B
Go
27 lines
493 B
Go
|
package aiden
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"io/ioutil"
|
||
|
"net/http"
|
||
|
|
||
|
log "github.com/sirupsen/logrus"
|
||
|
)
|
||
|
|
||
|
func Weather(location string) string {
|
||
|
resp, err := http.Get(fmt.Sprintf("https://customapi.aidenwallis.co.uk/api/v1/misc/weather/%s", location))
|
||
|
if err != nil {
|
||
|
log.Error(err)
|
||
|
return "Something went wrong FeelsBadMan"
|
||
|
}
|
||
|
|
||
|
defer resp.Body.Close()
|
||
|
|
||
|
body, err := ioutil.ReadAll(resp.Body)
|
||
|
if err != nil {
|
||
|
log.Error(err)
|
||
|
return "Something went wrong FeelsBadMan"
|
||
|
}
|
||
|
return string(body)
|
||
|
}
|