canopeas/inspiro/inspiro.go

24 lines
340 B
Go
Raw Normal View History

package inspiro
import (
"io/ioutil"
"net/http"
)
const api = "https://inspirobot.me/api?generate=true"
func Generate() (string, error) {
resp, err := http.Get(api)
if err != nil {
return "", err
}
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return "", err
}
defer resp.Body.Close()
return string(body), nil
}