3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-10-01 17:16:39 +02:00

List keys and values when using set command without a key (but with an index)

This commit is contained in:
Pragmatic Software 2010-06-18 04:40:12 +00:00
parent 7c1bdecfcb
commit e3b351946a
3 changed files with 14 additions and 3 deletions

View File

@ -49,8 +49,8 @@ sub set {
my ($self, $from, $nick, $user, $host, $arguments) = @_;
my ($channel, $key, $value) = split / /, $arguments, 3;
if(not defined $channel or not defined $key) {
return "/msg $nick Usage: chanset <channel> <key> <value>";
if(not defined $channel) {
return "/msg $nick Usage: chanset <channel> [[key] <value>]";
}
return "/msg $nick " . $self->channels->set($channel, $key, $value);

View File

@ -223,6 +223,17 @@ sub set {
return $result;
}
if(not defined $key) {
my $result = "[$self->{name}] $hash_index keys: ";
my $comma = '';
foreach my $k (sort keys %{ $self->hash->{$hash_index} }) {
$result .= $comma . "$k => " . $self->hash->{$hash_index}{$k};
$comma = ", ";
}
$result .= "none" if($comma eq '');
return $result;
}
if(not defined $value) {
$value = $self->hash->{$hash_index}{$key};
} else {

View File

@ -13,7 +13,7 @@ use warnings;
# These are set automatically by the build/commit script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 173,
BUILD_REVISION => 174,
BUILD_DATE => "2010-06-17",
};