mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-20 10:59:29 +01:00
Factoids: usage metadata now understands $0 for keyword
This commit is contained in:
parent
4ad1eab596
commit
563f8da40f
@ -989,7 +989,7 @@ sub factadd {
|
|||||||
my $factoids = $self->{pbot}->{factoids}->{factoids}->hash;
|
my $factoids = $self->{pbot}->{factoids}->{factoids}->hash;
|
||||||
|
|
||||||
if ($factoids->{$channel}->{$trigger}->{'locked'}) {
|
if ($factoids->{$channel}->{$trigger}->{'locked'}) {
|
||||||
return "/say $trigger is locked; unlock before overwriting.";
|
return "/say $keyword_text is locked; unlock before overwriting.";
|
||||||
}
|
}
|
||||||
|
|
||||||
my ($owner) = $factoids->{$channel}->{$trigger}->{'owner'} =~ m/([^!]+)/;
|
my ($owner) = $factoids->{$channel}->{$trigger}->{'owner'} =~ m/([^!]+)/;
|
||||||
@ -997,7 +997,7 @@ sub factadd {
|
|||||||
if ((lc $nick ne lc $owner) and (not $self->{pbot}->{admins}->loggedin($channel, "$nick!$user\@$host"))) {
|
if ((lc $nick ne lc $owner) and (not $self->{pbot}->{admins}->loggedin($channel, "$nick!$user\@$host"))) {
|
||||||
$self->{pbot}->{logger}->log("$nick!$user\@$host attempted to overwrite $trigger [not owner]\n");
|
$self->{pbot}->{logger}->log("$nick!$user\@$host attempted to overwrite $trigger [not owner]\n");
|
||||||
my $chan = ($channel eq '.*' ? 'the global channel' : $channel);
|
my $chan = ($channel eq '.*' ? 'the global channel' : $channel);
|
||||||
return "You are not the owner of $trigger for $chan; cannot overwrite";
|
return "You are not the owner of $keyword_text for $chan; cannot overwrite";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -843,7 +843,9 @@ sub interpreter {
|
|||||||
|
|
||||||
if (exists $self->{factoids}->hash->{$channel}->{$keyword}->{usage} and not length $stuff->{arguments}) {
|
if (exists $self->{factoids}->hash->{$channel}->{$keyword}->{usage} and not length $stuff->{arguments}) {
|
||||||
$stuff->{alldone} = 1;
|
$stuff->{alldone} = 1;
|
||||||
return $self->{factoids}->hash->{$channel}->{$keyword}->{usage};
|
my $usage = $self->{factoids}->hash->{$channel}->{$keyword}->{usage};
|
||||||
|
$usage =~ s/\$0/$keyword/g;
|
||||||
|
return $usage;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exists $stuff->{pipe_result}) {
|
if (exists $stuff->{pipe_result}) {
|
||||||
@ -867,7 +869,9 @@ sub interpreter {
|
|||||||
|
|
||||||
if (exists $self->{factoids}->hash->{$channel}->{$keyword}->{usage} and not length $stuff->{arguments}) {
|
if (exists $self->{factoids}->hash->{$channel}->{$keyword}->{usage} and not length $stuff->{arguments}) {
|
||||||
$stuff->{alldone} = 1;
|
$stuff->{alldone} = 1;
|
||||||
return $self->{factoids}->hash->{$channel}->{$keyword}->{usage};
|
my $usage = $self->{factoids}->hash->{$channel}->{$keyword}->{usage};
|
||||||
|
$usage =~ s/\$0/$keyword/g;
|
||||||
|
return $usage;
|
||||||
}
|
}
|
||||||
|
|
||||||
$stuff->{lang} = $lang;
|
$stuff->{lang} = $lang;
|
||||||
@ -934,6 +938,7 @@ sub handle_action {
|
|||||||
# no arguments supplied, replace $args with $nick/$tonick, etc
|
# no arguments supplied, replace $args with $nick/$tonick, etc
|
||||||
if (exists $self->{factoids}->hash->{$channel}->{$keyword}->{usage}) {
|
if (exists $self->{factoids}->hash->{$channel}->{$keyword}->{usage}) {
|
||||||
$action = "/say " . $self->{factoids}->hash->{$channel}->{$keyword}->{usage};
|
$action = "/say " . $self->{factoids}->hash->{$channel}->{$keyword}->{usage};
|
||||||
|
$action =~ s/\$0/$keyword/g;
|
||||||
$stuff->{alldone} = 1;
|
$stuff->{alldone} = 1;
|
||||||
} else {
|
} else {
|
||||||
if ($self->{factoids}->hash->{$channel}->{$keyword}->{'allow_empty_args'}) {
|
if ($self->{factoids}->hash->{$channel}->{$keyword}->{'allow_empty_args'}) {
|
||||||
|
Loading…
Reference in New Issue
Block a user