mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-27 13:12:42 +01:00
Prevent creation of factoids with same name as existing built-in commands
This commit is contained in:
parent
8ac79a4cb2
commit
63cfd038d0
@ -659,6 +659,10 @@ sub factmove {
|
||||
return "/say $target already exists for the global channel and cannot be overridden for " . ($target_channel eq '.*' ? 'the global channel' : $target_channel) . ".";
|
||||
}
|
||||
|
||||
if ($self->{pbot}->{commands}->exists($target)) {
|
||||
return "/say $target already exists as a built-in command.";
|
||||
}
|
||||
|
||||
$target_channel = lc $target_channel;
|
||||
$target_channel = '.*' if $target_channel !~ /^#/;
|
||||
|
||||
@ -713,6 +717,10 @@ sub factalias {
|
||||
return "/say $alias already exists for the global channel and cannot be overridden for " . ($chan eq '.*' ? 'the global channel' : $chan) . ".";
|
||||
}
|
||||
|
||||
if ($self->{pbot}->{commands}->exists($alias)) {
|
||||
return "/say $alias already exists as a built-in command.";
|
||||
}
|
||||
|
||||
$self->{pbot}->{factoids}->add_factoid('text', $chan, "$nick!$user\@$host", $alias, "/call $command");
|
||||
|
||||
$self->{pbot}->{logger}->log("$nick!$user\@$host [$chan] aliased $alias => $command\n");
|
||||
@ -803,6 +811,10 @@ sub factadd {
|
||||
return "/say $keyword already exists for the global channel and cannot be overridden for " . ($from_chan eq '.*' ? 'the global channel' : $from_chan) . ".";
|
||||
}
|
||||
|
||||
if ($self->{pbot}->{commands}->exists($keyword)) {
|
||||
return "/say $keyword already exists as a built-in command.";
|
||||
}
|
||||
|
||||
$self->{pbot}->{factoids}->add_factoid('text', $from_chan, "$nick!$user\@$host", $keyword, $text);
|
||||
|
||||
$self->{pbot}->{logger}->log("$nick!$user\@$host added [$from_chan] $keyword => $text\n");
|
||||
|
Loading…
Reference in New Issue
Block a user