mirror-nourybot/pkg/commands/uptime.go
2021-10-14 22:56:08 +02:00

31 lines
615 B
Go

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