mirror of
https://github.com/pragma-/pbot.git
synced 2025-01-11 12:32:37 +01:00
factundo/factredo now respect locked metadata
This commit is contained in:
parent
3fa44a1a19
commit
fd8a43c9cd
@ -302,6 +302,17 @@ sub factundo {
|
||||
return "There are no undos available for [$channel] $trigger.";
|
||||
}
|
||||
|
||||
my $factoids = $self->{pbot}->{factoids}->{factoids}->hash;
|
||||
my $admininfo = $self->{pbot}->{admins}->loggedin($channel, "$nick!$user\@$host");
|
||||
if ($factoids->{$channel}->{$trigger}->{'locked'}) {
|
||||
return "/say $trigger is locked and cannot be reverted." if not defined $admininfo;
|
||||
|
||||
if (exists $factoids->{$channel}->{$trigger}->{'effective-level'}
|
||||
and $admininfo->{level} < $factoids->{$channel}->{$trigger}->{'effective-level'}) {
|
||||
return "/say $trigger is locked with an effective-level higher than your level and cannot be reverted.";
|
||||
}
|
||||
}
|
||||
|
||||
if ($undos->{idx} == 0) {
|
||||
return "There are no more undos remaining for [$channel] $trigger.";
|
||||
}
|
||||
@ -339,6 +350,17 @@ sub factredo {
|
||||
return "There are no redos available for [$channel] $trigger.";
|
||||
}
|
||||
|
||||
my $factoids = $self->{pbot}->{factoids}->{factoids}->hash;
|
||||
my $admininfo = $self->{pbot}->{admins}->loggedin($channel, "$nick!$user\@$host");
|
||||
if ($factoids->{$channel}->{$trigger}->{'locked'}) {
|
||||
return "/say $trigger is locked and cannot be reverted." if not defined $admininfo;
|
||||
|
||||
if (exists $factoids->{$channel}->{$trigger}->{'effective-level'}
|
||||
and $admininfo->{level} < $factoids->{$channel}->{$trigger}->{'effective-level'}) {
|
||||
return "/say $trigger is locked with an effective-level higher than your level and cannot be reverted.";
|
||||
}
|
||||
}
|
||||
|
||||
if ($undos->{idx} + 1 == @{$undos->{list}}) {
|
||||
return "There are no more redos remaining for [$channel] $trigger.";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user