mirror of
https://github.com/lyx0/nourybot.git
synced 2024-11-13 19:49:55 +01:00
add 8ball command
This commit is contained in:
parent
a83ae99f4f
commit
ca1034a79e
28
pkg/commands/eightball.go
Normal file
28
pkg/commands/eightball.go
Normal file
|
@ -0,0 +1,28 @@
|
|||
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))
|
||||
|
||||
}
|
|
@ -64,6 +64,9 @@ func HandleCommand(message twitch.PrivateMessage, twitchClient *twitch.Client, u
|
|||
case "mycolor":
|
||||
commands.Color(message, twitchClient)
|
||||
return
|
||||
case "8ball":
|
||||
commands.EightBall(message, twitchClient)
|
||||
return
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue