2022-06-04 02:40:43 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import "github.com/gempir/go-twitch-irc/v3"
|
|
|
|
|
|
|
|
func (app *application) handlePrivateMessage(message twitch.PrivateMessage) {
|
|
|
|
// roomId is the Twitch UserID of the channel the
|
|
|
|
// message originated from.
|
|
|
|
roomId := message.Tags["room-id"]
|
|
|
|
|
|
|
|
// If there is no roomId something went wrong.
|
|
|
|
if roomId == "" {
|
2022-06-04 03:03:51 +02:00
|
|
|
app.logger.Error("Missing room-id in message tag ", roomId)
|
2022-06-04 02:40:43 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(message.Message) >= 2 {
|
|
|
|
if message.Message[:2] == "()" {
|
|
|
|
// TODO: Command Handling
|
2022-06-04 03:03:51 +02:00
|
|
|
app.logger.Infof("[Command detected]: ", message.Message)
|
2022-06-04 02:40:43 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Message was no command so we just print it.
|
2022-06-04 03:03:51 +02:00
|
|
|
app.logger.Infof("[#%s]:%s: %s", message.Channel, message.User.DisplayName, message.Message)
|
2022-06-04 02:40:43 +02:00
|
|
|
|
|
|
|
}
|