From 1e892f4ca1998a30cc7d420efba0ce0248216ff0 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Sun, 6 Mar 2016 22:25:22 -0800 Subject: [PATCH] Add silent option to countertriggers --- PBot/Plugins/Counter.pm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/PBot/Plugins/Counter.pm b/PBot/Plugins/Counter.pm index f2c00e6b..05a8df30 100644 --- a/PBot/Plugins/Counter.pm +++ b/PBot/Plugins/Counter.pm @@ -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."); }