monitor forsen bans

This commit is contained in:
lyx0 2023-12-03 16:35:34 +01:00
parent 7da57dd655
commit 6f28849331
3 changed files with 33 additions and 6 deletions

View file

@ -16,6 +16,10 @@ import (
func (app *application) handleCommand(message twitch.PrivateMessage) {
var reply string
if message.Channel == "forsen" {
return
}
// Increments the counter how many commands have been used, called in the ping command.
go common.CommandUsed()

View file

@ -4,6 +4,7 @@ import (
"context"
"database/sql"
"flag"
"fmt"
"os"
"time"
@ -134,12 +135,12 @@ func main() {
// Received a PrivateMessage (normal chat message).
app.TwitchClient.OnPrivateMessage(func(message twitch.PrivateMessage) {
sugar.Infow("New Twitch PrivateMessage",
"message.Channel", message.Channel,
"message.User.DisplayName", message.User.DisplayName,
"message.User.ID", message.User.ID,
"message.Message", message.Message,
)
// sugar.Infow("New Twitch PrivateMessage",
// "message.Channel", message.Channel,
// "message.User.DisplayName", message.User.DisplayName,
// "message.User.ID", message.User.ID,
// "message.Message", message.Message,
// )
// roomId is the Twitch UserID of the channel the message originated from.
// If there is no roomId something went really wrong.
@ -165,6 +166,16 @@ func main() {
}
})
app.TwitchClient.OnClearChatMessage(func(message twitch.ClearChatMessage) {
if message.BanDuration == 0 && message.Channel == "forsen" {
app.TwitchClient.Say("nouryxd", fmt.Sprintf("MODS https://logs.ivr.fi/?channel=forsen&username=%v", message.TargetUsername))
}
if message.BanDuration >= 28700 && message.Channel == "forsen" {
app.TwitchClient.Say("nouryxd", fmt.Sprintf("MODS https://logs.ivr.fi/?channel=forsen&username=%v", message.TargetUsername))
}
})
app.TwitchClient.OnConnect(func() {
common.StartTime()

View file

@ -91,6 +91,10 @@ func (app *application) SendNoContext(target, message string) {
return
}
if target == "forsen" {
return
}
identifier := uuid.NewString()
go app.Models.SentMessagesLogs.Insert(target, message, "unavailable", "unavailable", "unavailable", "unavailable", identifier, "unavailable")
@ -145,6 +149,10 @@ func (app *application) Send(target, message string, msgContext twitch.PrivateMe
return
}
if target == "forsen" {
return
}
commandName := strings.ToLower(strings.SplitN(msgContext.Message, " ", 3)[0][2:])
identifier := uuid.NewString()
go app.Models.SentMessagesLogs.Insert(target, message, commandName, msgContext.User.Name, msgContext.User.ID, msgContext.Message, identifier, msgContext.Raw)
@ -200,6 +208,10 @@ func (app *application) SendNoBanphrase(target, message string) {
return
}
if target == "forsen" {
return
}
identifier := uuid.NewString()
go app.Models.SentMessagesLogs.Insert(target, message, "unavailable", "unavailable", "unavailable", "unavailable", identifier, "unavailable")