diff options
| author | ilotterytea <iltsu@alright.party> | 2025-10-11 20:12:23 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-10-11 20:12:23 +0500 |
| commit | d680e3d9566c622c16f299c3399b5668b9b34cb0 (patch) | |
| tree | 860b42339e838cda087d053135e2df84a34b85e8 | |
| parent | cc40d94b3edb6ab22954e20d9ca0ddd66dcacf3b (diff) | |
feat: connect to twitch
| -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= |
