add option for insult probability

This commit is contained in:
Al Beano 2016-07-19 15:44:11 +01:00
parent cd457755cb
commit 6aac87f8c8
2 changed files with 6 additions and 2 deletions

View File

@ -57,12 +57,14 @@ sub said {
return unless scalar(@line) > 1; return unless scalar(@line) > 1;
my $start = int rand $#line; my $start = int rand $#line;
my $resp = markov( [$line[$start], $line[$start+1]] ); my $resp = markov( [$line[$start], $line[$start+1]] );
$resp = config("insult") unless $resp; if (rand() * 100 < config("insult_chance") && !$resp) {
$resp = config("insult");
}
$self->say( $self->say(
channel => config("irc_channel"), channel => config("irc_channel"),
body => $resp, body => $resp,
); ) if $resp;
} }
# Learn # Learn

View File

@ -3,6 +3,8 @@
# #
command_character: "." command_character: "."
insult: "you're a faggot" insult: "you're a faggot"
insult_chance: 2 # % chance that the bot will use the insult
# can be 0 to disable insults
# #
# Redis Settings # Redis Settings