3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-12-24 03:33:06 +01:00

Plugins: pluglist now shows count

This commit is contained in:
Pragmatic Software 2020-04-21 21:31:53 -07:00
parent f30c68d602
commit b3a5637d9f

View File

@ -155,18 +155,12 @@ sub unload_cmd {
sub list_cmd {
my ($self, $from, $nick, $user, $host, $arguments) = @_;
my $result = "Loaded plugins: ";
my $count = 0;
my $comma = '';
foreach my $plugin (sort keys %{$self->{plugins}}) {
$result .= $comma . $plugin;
$count++;
$comma = ', ';
}
my @plugins = sort keys %{$self->{plugins}};
$result .= 'none' if $count == 0;
return $result;
return "No plugins loaded." if not @plugins;
return scalar @plugins . ' plugin' . (@plugins == 1 ? '' : 's') . ' loaded: ' . join (', ', @plugins);
}
1;