3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-19 10:29:30 +01:00

Timer: eventqueue remove will now list removed events

This commit is contained in:
Pragmatic Software 2020-04-24 17:28:27 -07:00
parent 8d9e3da249
commit e31fe57017

View File

@ -212,10 +212,11 @@ sub dequeue_event {
$id =~ s/\\\.\\\*/.*/g;
my $regex = qr/^$id$/i;
my $count = @{$self->{event_queue}};
my @removed = grep { $_->{id} =~ /$regex/i; } @{$self->{event_queue}};
@{$self->{event_queue}} = grep { $_->{id} !~ /$regex/i; } @{$self->{event_queue}};
my $removed = $count - @{$self->{event_queue}};
return "No matching events." if not $removed;
return "Removed $removed event" . ($removed == 1 ? '' : 's') . '.';
$count -= @{$self->{event_queue}};
return "No matching events." if not $count;
return "Removed $count event" . ($count == 1 ? '' : 's') . ': ' . join(', ', map { $_->{id} } @removed);
};
if ($@) {