mirror-nourybot/pkg/commands/weather.go
2021-10-14 22:40:20 +02:00

32 lines
628 B
Go

package commands
import (
"fmt"
"io/ioutil"
"net/http"
"github.com/gempir/go-twitch-irc/v2"
log "github.com/sirupsen/logrus"
)
func Weather(channel string, location string, client *twitch.Client) {
resp, err := http.Get(fmt.Sprintf("https://customapi.aidenwallis.co.uk/api/v1/misc/weather/%s", location))
if err != nil {
client.Say(channel, "Something went wrong FeelsBadMan")
log.Error(err)
return
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
client.Say(channel, "Something went wrong FeelsBadMan")
log.Error(err)
return
}
client.Say(channel, string(body))
}