mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-26 22:09:26 +01:00
Fix handling of no factoid found from find_factoid()
This commit is contained in:
parent
d4eb08856a
commit
04aaeb5475
@ -511,7 +511,7 @@ sub factrem {
|
||||
|
||||
my @factoids = $self->{pbot}->{factoids}->find_factoid($from_chan, $from_trigger, undef, 0, 1);
|
||||
|
||||
if(not @factoids) {
|
||||
if (not @factoids or not $factoids[0]) {
|
||||
if ($needs_disambig) {
|
||||
return "$from_trigger not found";
|
||||
} else {
|
||||
@ -612,7 +612,7 @@ sub factshow {
|
||||
|
||||
my @factoids = $self->{pbot}->{factoids}->find_factoid($chan, $trig, undef, 0, 1);
|
||||
|
||||
if (not @factoids) {
|
||||
if (not @factoids or not $factoids[0]) {
|
||||
if ($needs_disambig) {
|
||||
return "$trig not found";
|
||||
} else {
|
||||
@ -672,7 +672,7 @@ sub factinfo {
|
||||
|
||||
my @factoids = $self->{pbot}->{factoids}->find_factoid($chan, $trig, undef, 0, 1);
|
||||
|
||||
if(not @factoids) {
|
||||
if (not @factoids or not $factoids[0]) {
|
||||
if ($needs_disambig) {
|
||||
return "$trig not found";
|
||||
} else {
|
||||
@ -720,7 +720,7 @@ sub factinfo {
|
||||
return "$trigger: Regex created by " . $factoids->{$channel}->{$trigger}->{owner} . " for $chan on " . localtime($factoids->{$channel}->{$trigger}->{created_on}) . " [$created_ago], " . (defined $factoids->{$channel}->{$trigger}->{edited_by} ? "last edited by $factoids->{$channel}->{$trigger}->{edited_by} on " . localtime($factoids->{$channel}->{$trigger}->{edited_on}) . " [" . ago(gettimeofday - $factoids->{$channel}->{$trigger}->{edited_on}) . "], " : "") . " used " . $factoids->{$channel}->{$trigger}->{ref_count} . " times (last by " . $factoids->{$channel}->{$trigger}->{ref_user} . (exists $factoids->{$channel}->{$trigger}->{last_referenced_on} ? " on " . localtime($factoids->{$channel}->{$trigger}->{last_referenced_on}) . " [$ref_ago]" : "") . ")";
|
||||
}
|
||||
|
||||
return "$trigger is not a factoid or a module";
|
||||
return "$arguments is not a factoid or a module";
|
||||
}
|
||||
|
||||
sub top20 {
|
||||
|
@ -47,7 +47,7 @@ sub execute_module {
|
||||
my @factoids = $self->{pbot}->{factoids}->find_factoid($from, $keyword);
|
||||
|
||||
|
||||
if(not @factoids) {
|
||||
if(not @factoids or not $factoids[0]) {
|
||||
$self->{pbot}->{interpreter}->handle_result($from, $nick, $user, $host, $command, "$keyword $arguments", "/msg $nick Failed to find module for '$keyword' in channel $from\n", 1, 0);
|
||||
return;
|
||||
}
|
||||
|
@ -361,7 +361,7 @@ sub expand_factoid_vars {
|
||||
}
|
||||
|
||||
my @factoids = $self->find_factoid($from, $v, undef, 0, 1);
|
||||
next if not @factoids;
|
||||
next if not @factoids or not $factoids[0];
|
||||
|
||||
my ($var_chan, $var) = ($factoids[0]->[0], $factoids[0]->[1]);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user