diff --git a/config/config.go b/config/config.go index 5809471..719a423 100644 --- a/config/config.go +++ b/config/config.go @@ -37,9 +37,9 @@ type Config struct { Freq int Channels []string } - Twitch struct { - Freq int - Users map[string][]string //channel -> usernames + Twitch struct { + Freq int + Users map[string][]string //channel -> usernames } EnforceNicks bool WelcomeMsgs []string @@ -56,6 +56,7 @@ type Config struct { Your struct { YourChance float64 FuckingChance float64 + DuckingChance float64 MaxLength int } LeftPad struct { diff --git a/example_config.json b/example_config.json index 3540c3f..0942470 100644 --- a/example_config.json +++ b/example_config.json @@ -47,6 +47,7 @@ "Your": { "YourChance": 0.4, "FuckingChance": 0.15, + "DuckingChance": 0.5, "MaxLength": 140 }, "LeftPad": { diff --git a/plugins/your/your.go b/plugins/your/your.go index ed2df52..7342f7d 100644 --- a/plugins/your/your.go +++ b/plugins/your/your.go @@ -44,6 +44,16 @@ func (p *YourPlugin) Message(message msg.Message) bool { return true } } + if strings.Contains(message.Body, "ducking") || strings.Contains(message.Body, "fucking") { // let's not mess with case + log.Println("Found a fucking|ducking") + if rand.Float64() < config.DuckingChance { + log.Println("Replacing a ducking") + r := strings.NewReplacer("fucking", "ducking", "ducking", "fucking") + msg := r.Replace(message.Body) + p.bot.SendMessage(message.Channel, msg) + return true + } + } if strings.Contains(lower, "your") || strings.Contains(lower, "you're") { if rand.Float64() < config.YourChance { r := strings.NewReplacer("Your", "You're", "your", "you're", "You're",