A modular Twitch bot made in Go
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
635 B

package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"twitch/twitchbot"
)
type Config struct {
Bot struct {
Token string `json:"token"`
Nick string `json:"nick"`
} `json:"bot"`
}
func main() {
var config Config
data, _ := ioutil.ReadFile("config.json")
err := json.Unmarshal(data, &config)
if err != nil {
log.Panicln(err)
}
bot := twitchbot.NewBot(config.Bot.Token, config.Bot.Nick, []string{"witer33"})
bot.OnMessage(func(bot *twitchbot.Bot, message *twitchbot.Message) {
fmt.Println(message)
if message.Message == "!ping" {
message.Reply("pong")
message.Delete()
}
})
bot.Run()
}