29 lines
514 B
Go
29 lines
514 B
Go
package twitch
|
|
|
|
import (
|
|
"log"
|
|
|
|
tw "github.com/gempir/go-twitch-irc/v4"
|
|
"gitnet.fr/deblan/owncast-webhook/internal/config"
|
|
"gitnet.fr/deblan/owncast-webhook/internal/store"
|
|
)
|
|
|
|
func IrcClient() {
|
|
client := tw.NewAnonymousClient()
|
|
|
|
client.OnPrivateMessage(func(message tw.PrivateMessage) {
|
|
store.GetMessageStore().Add(store.TwitchMessage{
|
|
Message: message,
|
|
})
|
|
})
|
|
|
|
client.Join(config.Get().Twitch.Channel)
|
|
|
|
go func() {
|
|
err := client.Connect()
|
|
|
|
if err != nil {
|
|
log.Fatal(err.Error())
|
|
}
|
|
}()
|
|
}
|