mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-26 22:09:26 +01:00
Add silent option to countertriggers
This commit is contained in:
parent
40c5ba8268
commit
1e892f4ca1
@ -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.");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user