mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-17 09:29:30 +01:00
Commands/Factoids: remove "not owner" restriction on factset
/factunset
This commit is contained in:
parent
5bca8c7d16
commit
c6433a662f
@ -390,33 +390,11 @@ sub cmd_factset($self, $context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (defined $owner_channel) {
|
|
||||||
my $factoid = $self->{pbot}->{factoids}->{data}->{storage}->get_data($owner_channel, $owner_trigger);
|
|
||||||
|
|
||||||
my $owner;
|
|
||||||
my $mask;
|
|
||||||
|
|
||||||
if ($factoid->{'locked'}) {
|
|
||||||
# check owner against full hostmask for locked factoids
|
|
||||||
$owner = $factoid->{'owner'};
|
|
||||||
$mask = $context->{hostmask};
|
|
||||||
} else {
|
|
||||||
# otherwise just the nick
|
|
||||||
($owner) = $factoid->{'owner'} =~ m/([^!]+)/;
|
|
||||||
$mask = $context->{nick};
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((defined $value and $key ne 'action' and $key ne 'action_with_args')
|
|
||||||
and lc $mask ne lc $owner
|
|
||||||
and not $self->{pbot}->{capabilities}->userhas($userinfo, 'admin'))
|
|
||||||
{
|
|
||||||
return "You are not the owner of $trigger_name.";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
my $result = $self->{pbot}->{factoids}->{data}->{storage}->set($channel, $trigger, $key, $value);
|
my $result = $self->{pbot}->{factoids}->{data}->{storage}->set($channel, $trigger, $key, $value);
|
||||||
|
|
||||||
if (defined $value and $result =~ m/set to/) { $self->log_factoid($channel, $trigger, $context->{hostmask}, "set $key to $value"); }
|
if (defined $value and $result =~ m/set to/) {
|
||||||
|
$self->log_factoid($channel, $trigger, $context->{hostmask}, "set $key to $value");
|
||||||
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
@ -472,20 +450,7 @@ sub cmd_factunset($self, $context) {
|
|||||||
$channel_name = 'global' if $channel_name eq '.*';
|
$channel_name = 'global' if $channel_name eq '.*';
|
||||||
$trigger_name = "\"$trigger_name\"" if $trigger_name =~ / /;
|
$trigger_name = "\"$trigger_name\"" if $trigger_name =~ / /;
|
||||||
|
|
||||||
my $oldvalue;
|
my $oldvalue = $self->{pbot}->{factoids}->{data}->{storage}->get_data($channel, $trigger, $key);
|
||||||
|
|
||||||
if (defined $owner_channel) {
|
|
||||||
my $factoid = $self->{pbot}->{factoids}->{data}->{storage}->get_data($owner_channel, $owner_trigger);
|
|
||||||
my ($owner) = $factoid->{'owner'} =~ m/([^!]+)/;
|
|
||||||
|
|
||||||
if ($key ne 'action_with_args' and lc $context->{nick} ne lc $owner
|
|
||||||
and not $self->{pbot}->{capabilities}->userhas($userinfo, 'admin'))
|
|
||||||
{
|
|
||||||
return "You are not the owner of $trigger_name.";
|
|
||||||
}
|
|
||||||
|
|
||||||
$oldvalue = $self->{pbot}->{factoids}->{data}->{storage}->get_data($channel, $trigger, $key);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (not defined $oldvalue) {
|
if (not defined $oldvalue) {
|
||||||
return "[$channel_name] $trigger_name: key '$key' does not exist.";
|
return "[$channel_name] $trigger_name: key '$key' does not exist.";
|
||||||
|
@ -25,8 +25,8 @@ use PBot::Imports;
|
|||||||
# These are set by the /misc/update_version script
|
# These are set by the /misc/update_version script
|
||||||
use constant {
|
use constant {
|
||||||
BUILD_NAME => "PBot",
|
BUILD_NAME => "PBot",
|
||||||
BUILD_REVISION => 4851,
|
BUILD_REVISION => 4852,
|
||||||
BUILD_DATE => "2024-11-13",
|
BUILD_DATE => "2024-11-14",
|
||||||
};
|
};
|
||||||
|
|
||||||
sub initialize {}
|
sub initialize {}
|
||||||
|
Loading…
Reference in New Issue
Block a user