Skip to content

Commit

Permalink
update twitch library
Browse files Browse the repository at this point in the history
  • Loading branch information
Kesuaheli committed Dec 26, 2023
1 parent 094dd7c commit 91cc49c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/bwmarrin/discordgo v0.27.1
github.com/go-sql-driver/mysql v1.7.1
github.com/gorilla/mux v1.8.0
github.com/kesuaheli/twitchgo v0.1.0
github.com/kesuaheli/twitchgo v0.2.2
github.com/spf13/viper v1.15.0
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
github.com/kesuaheli/twitchgo v0.1.0 h1:vteAnegcvvY6aog8Z5X35BLmu6bUV3Hw/7hnw4D5bLg=
github.com/kesuaheli/twitchgo v0.1.0/go.mod h1:swIW1jJcFa4bWi/9JfUYH4Sf1kAvj+QUcaTPkce+6Ds=
github.com/kesuaheli/twitchgo v0.2.2 h1:ub/dZO9UqfoUgCiBqs+1gQnFs6VQm1oUNNv+vqjaJwA=
github.com/kesuaheli/twitchgo v0.2.2/go.mod h1:swIW1jJcFa4bWi/9JfUYH4Sf1kAvj+QUcaTPkce+6Ds=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func main() {
webserver.Run(addr, webChan)

client := twitchgo.New(viper.GetString("twitch.name"), viper.GetString("twitch.token"))
client.SetEventChannelMessage(twitch.MessageHandler)
client.OnChannelMessage(twitch.MessageHandler)
err = client.Connect()
if err != nil {
log.Fatalf("could not open the twitch connection: %v", err)
Expand Down
7 changes: 4 additions & 3 deletions twitch/messageHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import (
"github.com/kesuaheli/twitchgo"
)

func MessageHandler(t *twitchgo.Twitch, message *twitchgo.Message) {
log.Printf("Twitch: [%s] <%s> %s", message.Command.Arguments[0], message.Source, message.Command.Data)

// MessageHandler handles new messages from the twitch chat(s). It will be called on every new
// message.
func MessageHandler(t *twitchgo.Twitch, channel string, user *twitchgo.User, message string) {
log.Printf("Twitch: [%s] <%s> %s", channel, user.Nickname, message)
}

0 comments on commit 91cc49c

Please sign in to comment.