mirror-nourybot/pkg/commands/eightball.go

29 lines
599 B
Go
Raw Normal View History

2021-10-14 22:32:00 +02:00
package commands
import (
"io/ioutil"
"net/http"
"github.com/gempir/go-twitch-irc/v2"
log "github.com/sirupsen/logrus"
)
func EightBall(message twitch.PrivateMessage, client *twitch.Client) {
resp, err := http.Get("https://customapi.aidenwallis.co.uk/api/v1/misc/8ball")
if err != nil {
client.Say(message.Channel, "Something went wrong FeelsBadMan")
log.Error(err)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
client.Say(message.Channel, "Something went wrong FeelsBadMan")
log.Error(err)
}
client.Say(message.Channel, string(body))
}