From 9621c6ffbee7f969e8e66d090b03f0a348576d19 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Wed, 22 Feb 2017 04:18:26 -0800 Subject: [PATCH] AntiTwitter: Warn twice before tempban; add logging --- PBot/Plugins/AntiTwitter.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/PBot/Plugins/AntiTwitter.pm b/PBot/Plugins/AntiTwitter.pm index 4700dd59..0987bc0a 100644 --- a/PBot/Plugins/AntiTwitter.pm +++ b/PBot/Plugins/AntiTwitter.pm @@ -45,13 +45,18 @@ sub on_public { if ($self->{pbot}->{nicklist}->is_present($channel, $n)) { $self->{offenses}->{$channel}->{$nick}->{offenses}++; $self->{offenses}->{$channel}->{$nick}->{time} = gettimeofday; + + $self->{pbot}->{logger}->log("$nick!$user\@$host is a twit. $self->{offenses}->{$channel}->{$nick}->{offenses} offenses. Msg: $msg\n"); given ($self->{offenses}->{$channel}->{$nick}->{offenses}) { when (1) { + $event->{conn}->privmsg($nick, "$nick: Please do not use \@nick to address people. Drop the @ symbol; it's not necessary and it's ugly."); + } + when (2) { $event->{conn}->privmsg($nick, "$nick: Please do not use \@nick to address people. Drop the @ symbol; it's not necessary and it's ugly. Doing this again will result in a temporary ban."); } default { - my $offenses = $self->{offenses}->{$channel}->{$nick}->{offenses} - 1; + my $offenses = $self->{offenses}->{$channel}->{$nick}->{offenses} - 2; my $length = 60 * ($offenses * $offenses + 1); $self->{pbot}->{chanops}->ban_user_timed("*!*\@$host", $channel, $length); $self->{pbot}->{chanops}->gain_ops($channel);