3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-27 06:19:25 +01:00

Show factlog for currently deleted factoids if log file exists

This commit is contained in:
Pragmatic Software 2015-12-13 22:20:57 -08:00
parent 4a765277cb
commit 1540483639

View File

@ -724,15 +724,6 @@ sub factlog {
my @factoids = $self->{pbot}->{factoids}->find_factoid($chan, $trig, undef, 0, 1);
if (not @factoids or not $factoids[0]) {
if ($needs_disambig) {
return "$trig not found";
} else {
$chan = 'global channel' if $chan eq '.*';
return "$trig not found in $chan";
}
}
my ($channel, $trigger);
if (@factoids > 1) {
@ -746,8 +737,10 @@ sub factlog {
}
}
}
} else {
} elsif (@factoids and $factoids[0]) {
($channel, $trigger) = ($factoids[0]->[0], $factoids[0]->[1]);
} else {
($channel, $trigger) = ($chan, $trig);
}
my $result;
@ -755,6 +748,7 @@ sub factlog {
$channel = 'global' if $channel eq '.*';
open my $fh, "< $path/$trigger.$channel" or do {
$self->{pbot}->{logger}->log("Could not open $path/$trigger.$channel: $!\n");
$channel = 'the global channel' if $channel eq 'global';
return "No factlog available for $trigger in $channel.";
};