give catbase some negative back talk

This commit is contained in:
skkiesel 2017-03-13 12:41:17 -04:00
parent b0210fd240
commit f2309b9090
3 changed files with 22 additions and 0 deletions

View File

@ -57,6 +57,7 @@ type Config struct {
YourChance float64
FuckingChance float64
DuckingChance float64
NegativeChance float64
MaxLength int
}
LeftPad struct {

View File

@ -48,6 +48,7 @@
"YourChance": 0.4,
"FuckingChance": 0.15,
"DuckingChance": 0.5,
"NegativeChance": 0.5,
"MaxLength": 140
},
"LeftPad": {

View File

@ -63,6 +63,26 @@ func (p *YourPlugin) Message(message msg.Message) bool {
return true
}
}
if strings.Contains(message.Body, " is ") {
log.Println("Found an is")
if rand.Float64() < config.NegativeChance {
log.Println("Replacing an is")
r := strings.NewReplacer(" is ", " is not ")
msg := r.Replace(message.Body)
p.bot.SendMessage(message.Channel, msg)
return true
}
}
if strings.Contains(message.Body, " are ") {
log.Println("Found an are")
if rand.Float64() < config.NegativeChance {
log.Println("Replacing an are")
r := strings.NewReplacer(" are ", " are not ")
msg := r.Replace(message.Body)
p.bot.SendMessage(message.Channel, msg)
return true
}
}
return false
}