made butt decision always false if sender might be another bot, to prevent spam

This commit is contained in:
shabble 2009-10-28 02:10:32 +00:00
parent 2722b8bbe4
commit 31ec19d77e
1 changed files with 8 additions and 1 deletions

View File

@ -169,7 +169,7 @@ sub said {
# butting is the default behaviour.
$self->log("BUTT: Might butt\n");
if ($self->to_butt_or_not_to_butt($who)) {
$self->log("BUTT: Buttiing $who in [$channel]\n");
$self->log("BUTT: Butting $who in [$channel]\n");
$self->buttify_message($who, $channel, $body, 0);
}
@ -344,6 +344,8 @@ sub to_butt_or_not_to_butt {
my $rnd = 0;
my $frequencies = $self->config('frequency');
return 0 if $self->might_be_a_bot($sufferer);
if ($self->is_enemy($sufferer)) {
$rnd = 0;
$self->log("BUTT: Enemy [$sufferer], not butting\n");
@ -358,6 +360,11 @@ sub to_butt_or_not_to_butt {
return ($rnd==1);
}
sub might_be_a_bot {
my ($self, $who) = @_;
return ($who =~ m/cout|(?:bot$)/i);
}
sub is_enemy {
my ($self, $who) = @_;
my $enemies = $self->config('enemies');