3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-20 02:49:49 +01:00

Add silent option to countertriggers

This commit is contained in:
Pragmatic Software 2016-03-06 22:25:22 -08:00
parent 40c5ba8268
commit 1e892f4ca1

View File

@ -606,17 +606,24 @@ sub on_public {
foreach my $trigger (@triggers) {
eval {
my $message;
if ($trigger->{trigger} =~ m/^\^/) {
$message = "$hostmask $msg";
} else {
$message = $msg;
}
my $silent = 0;
if ($trigger->{trigger} =~ s/:silent$//i) {
$silent = 1;
}
if ($message =~ m/$trigger->{trigger}/i) {
my ($desc, $timestamp) = $self->reset_counter($channel, $trigger->{target});
if (defined $desc) {
if (gettimeofday - $timestamp >= 60 * 60) {
if (not $silent and gettimeofday - $timestamp >= 60 * 60) {
my $ago = duration gettimeofday - $timestamp;
$event->{conn}->privmsg($channel, "It had been $ago since $desc.");
}