mirror of
https://github.com/pragma-/pbot.git
synced 2025-01-11 04:22:35 +01:00
Timer: eventqueue remove
will now list removed events
This commit is contained in:
parent
8d9e3da249
commit
e31fe57017
@ -212,10 +212,11 @@ sub dequeue_event {
|
|||||||
$id =~ s/\\\.\\\*/.*/g;
|
$id =~ s/\\\.\\\*/.*/g;
|
||||||
my $regex = qr/^$id$/i;
|
my $regex = qr/^$id$/i;
|
||||||
my $count = @{$self->{event_queue}};
|
my $count = @{$self->{event_queue}};
|
||||||
|
my @removed = grep { $_->{id} =~ /$regex/i; } @{$self->{event_queue}};
|
||||||
@{$self->{event_queue}} = grep { $_->{id} !~ /$regex/i; } @{$self->{event_queue}};
|
@{$self->{event_queue}} = grep { $_->{id} !~ /$regex/i; } @{$self->{event_queue}};
|
||||||
my $removed = $count - @{$self->{event_queue}};
|
$count -= @{$self->{event_queue}};
|
||||||
return "No matching events." if not $removed;
|
return "No matching events." if not $count;
|
||||||
return "Removed $removed event" . ($removed == 1 ? '' : 's') . '.';
|
return "Removed $count event" . ($count == 1 ? '' : 's') . ': ' . join(', ', map { $_->{id} } @removed);
|
||||||
};
|
};
|
||||||
|
|
||||||
if ($@) {
|
if ($@) {
|
||||||
|
Loading…
Reference in New Issue
Block a user