diff options
| -rw-r--r-- | cmd/statsbot/main.go | 22 | ||||
| -rw-r--r-- | go.mod | 2 | ||||
| -rw-r--r-- | go.sum | 2 |
3 files changed, 24 insertions, 2 deletions
diff --git a/cmd/statsbot/main.go b/cmd/statsbot/main.go index c048119..4e4ac77 100644 --- a/cmd/statsbot/main.go +++ b/cmd/statsbot/main.go @@ -1,7 +1,25 @@ package main -import "fmt" +import ( + "log" + + "github.com/gempir/go-twitch-irc" +) func main() { - fmt.Println("hello world") + client := twitch.NewClient("justinfan65432", "12345") + + client.OnConnect(func() { + log.Println("Connected to Twitch IRC!") + }) + + client.OnNewMessage(func(channel string, user twitch.User, message twitch.Message) { + log.Printf("Message: %s\n", message.Text) + }) + + client.Join("forsen") + + if err := client.Connect(); err != nil { + log.Panicf("Failed to connect Twitch IRC: %v\n", err) + } } @@ -1,3 +1,5 @@ module ilotterytea/tinystats go 1.22.2 + +require github.com/gempir/go-twitch-irc v1.1.0 // indirect @@ -0,0 +1,2 @@ +github.com/gempir/go-twitch-irc v1.1.0 h1:Q9gQGI/3yJzYwlYDlFsGJzWfpaqubMExfmBXNpOC6W0= +github.com/gempir/go-twitch-irc v1.1.0/go.mod h1:Pc661rsUSmkQXvI9W2bNyLt4ZrMAgHZPnVwMQEJ0fdo= |
