mirror of https://github.com/velour/catbase.git
Add a ducking filter
This commit is contained in:
parent
2f9abf660d
commit
7b7c0dc5bb
|
@ -56,6 +56,7 @@ type Config struct {
|
|||
Your struct {
|
||||
YourChance float64
|
||||
FuckingChance float64
|
||||
DuckingChance float64
|
||||
MaxLength int
|
||||
}
|
||||
LeftPad struct {
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
"Your": {
|
||||
"YourChance": 0.4,
|
||||
"FuckingChance": 0.15,
|
||||
"DuckingChance": 0.5,
|
||||
"MaxLength": 140
|
||||
},
|
||||
"LeftPad": {
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in New Issue