mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-25 04:02:37 +01:00
Users: my
command now lists keys if no args
This commit is contained in:
parent
aab2a2b445
commit
91d80571e0
@ -426,16 +426,11 @@ sub mycmd {
|
|||||||
my ($self, $from, $nick, $user, $host, $arguments, $stuff) = @_;
|
my ($self, $from, $nick, $user, $host, $arguments, $stuff) = @_;
|
||||||
my ($key, $value) = $self->{pbot}->{interpreter}->split_args($stuff->{arglist}, 2);
|
my ($key, $value) = $self->{pbot}->{interpreter}->split_args($stuff->{arglist}, 2);
|
||||||
|
|
||||||
if (not defined $key) {
|
|
||||||
return "Usage: my <key> [value]";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (defined $value) {
|
if (defined $value) {
|
||||||
$value =~ s/^is\s+//;
|
$value =~ s/^is\s+//;
|
||||||
$value = undef if not length $value;
|
$value = undef if not length $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
$key = lc $key;
|
|
||||||
my $channel = $from;
|
my $channel = $from;
|
||||||
my $hostmask = "$nick!$user\@$host";
|
my $hostmask = "$nick!$user\@$host";
|
||||||
|
|
||||||
@ -459,6 +454,11 @@ sub mycmd {
|
|||||||
$self->save;
|
$self->save;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my $result = '';
|
||||||
|
|
||||||
|
if (defined $key) {
|
||||||
|
$key = lc $key;
|
||||||
|
|
||||||
if (defined $value and $u->{level} == 0) {
|
if (defined $value and $u->{level} == 0) {
|
||||||
my @disallowed = qw/level autoop autovoice/;
|
my @disallowed = qw/level autoop autovoice/;
|
||||||
if (grep { $_ eq $key } @disallowed) {
|
if (grep { $_ eq $key } @disallowed) {
|
||||||
@ -469,9 +469,13 @@ sub mycmd {
|
|||||||
if ($key eq 'level' and defined $value and $u->{level} < 90 and $value > $u->{level}) {
|
if ($key eq 'level' and defined $value and $u->{level} < 90 and $value > $u->{level}) {
|
||||||
return "You may not increase your level!";
|
return "You may not increase your level!";
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$result = "Usage: my <key> [value]; ";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
($channel, $hostmask) = $self->find_user_account($channel, $hostmask);
|
($channel, $hostmask) = $self->find_user_account($channel, $hostmask);
|
||||||
my $result = $self->{users}->set($channel, $hostmask, $key, $value);
|
$result .= $self->{users}->set($channel, $hostmask, $key, $value);
|
||||||
$result =~ s/^password => .*;?$/password => <private>;/m;
|
$result =~ s/^password => .*;?$/password => <private>;/m;
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user