mirror of
https://github.com/pragma-/pbot.git
synced 2025-01-11 04:22:35 +01:00
List keys and values when using set command without a key (but with an index)
This commit is contained in:
parent
7c1bdecfcb
commit
e3b351946a
@ -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);
|
||||
|
@ -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 {
|
||||
|
@ -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",
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user