mirror of
https://github.com/lyx0/nourybot.git
synced 2024-11-13 19:49:55 +01:00
change game and weather command to new api call
This commit is contained in:
parent
f5aca689c0
commit
3a827bbd6f
|
@ -2,25 +2,14 @@ package commands
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
|
||||
"github.com/gempir/go-twitch-irc/v2"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/lyx0/nourybot/pkg/api/aiden"
|
||||
)
|
||||
|
||||
func Game(channel string, name string, client *twitch.Client) {
|
||||
resp, err := http.Get(fmt.Sprintf("https://customapi.aidenwallis.co.uk/api/v1/twitch/channel/%s/game", name))
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
defer resp.Body.Close()
|
||||
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
client.Say(channel, fmt.Sprintf("%s is playing: %s", name, string(body)))
|
||||
game := aiden.ApiCall(fmt.Sprintf("api/v1/twitch/channel/%s/game", name))
|
||||
reply := fmt.Sprintf("@%s was last seen playing: %s", name, game)
|
||||
client.Say(channel, reply)
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
|
||||
func Weather(channel string, location string, client *twitch.Client) {
|
||||
|
||||
reply := aiden.Weather(fmt.Sprintf("api/v1/misc/weather/%s", location))
|
||||
reply := aiden.ApiCall(fmt.Sprintf("api/v1/misc/weather/%s", location))
|
||||
client.Say(channel, reply)
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue