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:
parent
40c5ba8268
commit
1e892f4ca1
@ -606,17 +606,24 @@ sub on_public {
|
|||||||
foreach my $trigger (@triggers) {
|
foreach my $trigger (@triggers) {
|
||||||
eval {
|
eval {
|
||||||
my $message;
|
my $message;
|
||||||
|
|
||||||
if ($trigger->{trigger} =~ m/^\^/) {
|
if ($trigger->{trigger} =~ m/^\^/) {
|
||||||
$message = "$hostmask $msg";
|
$message = "$hostmask $msg";
|
||||||
} else {
|
} else {
|
||||||
$message = $msg;
|
$message = $msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my $silent = 0;
|
||||||
|
|
||||||
|
if ($trigger->{trigger} =~ s/:silent$//i) {
|
||||||
|
$silent = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if ($message =~ m/$trigger->{trigger}/i) {
|
if ($message =~ m/$trigger->{trigger}/i) {
|
||||||
my ($desc, $timestamp) = $self->reset_counter($channel, $trigger->{target});
|
my ($desc, $timestamp) = $self->reset_counter($channel, $trigger->{target});
|
||||||
|
|
||||||
if (defined $desc) {
|
if (defined $desc) {
|
||||||
if (gettimeofday - $timestamp >= 60 * 60) {
|
if (not $silent and gettimeofday - $timestamp >= 60 * 60) {
|
||||||
my $ago = duration gettimeofday - $timestamp;
|
my $ago = duration gettimeofday - $timestamp;
|
||||||
$event->{conn}->privmsg($channel, "It had been $ago since $desc.");
|
$event->{conn}->privmsg($channel, "It had been $ago since $desc.");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user