add bttvemotes command

This commit is contained in:
lyx0 2021-10-16 18:06:34 +02:00
parent df60bd50dd
commit c0634115c1
3 changed files with 29 additions and 0 deletions

0
pkg/api/ivr.go Normal file
View file

View file

@ -0,0 +1,26 @@
package commands
import (
"fmt"
"io/ioutil"
"net/http"
"github.com/gempir/go-twitch-irc/v2"
log "github.com/sirupsen/logrus"
)
func BttvEmotes(channel string, client *twitch.Client) {
resp, err := http.Get(fmt.Sprintf("https://customapi.aidenwallis.co.uk/api/v1/emotes/%s/bttv", channel))
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, string(body))
}

View file

@ -38,7 +38,10 @@ func HandleCommand(message twitch.PrivateMessage, twitchClient *twitch.Client, u
case "":
if msgLen == 1 {
twitchClient.Say(message.Channel, "Why yes, that's my prefix :)")
return
}
case "bttvemotes":
commands.BttvEmotes(message.Channel, twitchClient)
return
case "cf":
commands.Coinflip(message.Channel, twitchClient)