add botstatus command

This commit is contained in:
lyx0 2021-10-17 10:23:36 +02:00
parent be12a44d65
commit bd4d2dbe21
2 changed files with 34 additions and 0 deletions

26
pkg/commands/botstatus.go Normal 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 BotStatus(channel string, userName string, client *twitch.Client) {
resp, err := http.Get(fmt.Sprintf("https://customapi.aidenwallis.co.uk/api/v1/twitch/botStatus/%s?includeLimits=1", userName))
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

@ -40,6 +40,14 @@ func HandleCommand(message twitch.PrivateMessage, twitchClient *twitch.Client, u
twitchClient.Say(message.Channel, "Why yes, that's my prefix :)")
return
}
case "botstatus":
if msgLen == 1 {
twitchClient.Say(message.Channel, "Usage: ()botstatus [username]")
return
} else {
commands.BotStatus(message.Channel, cmdParams[1], twitchClient)
return
}
case "bttvemotes":
commands.BttvEmotes(message.Channel, twitchClient)
return