diff --git a/PBot/DualIndexSQLiteObject.pm b/PBot/DualIndexSQLiteObject.pm index 4c7a7dae..41703931 100644 --- a/PBot/DualIndexSQLiteObject.pm +++ b/PBot/DualIndexSQLiteObject.pm @@ -433,7 +433,7 @@ sub get_each { }; if ($@) { - $self->{pbot}->{logger}->log("Error getting data: $@\n"); + $self->{pbot}->{logger}->log("Error getting data: $@"); return undef; } @@ -448,7 +448,7 @@ sub get_next { }; if ($@) { - $self->{pbot}->{logger}->log("Error getting next: $@\n"); + $self->{pbot}->{logger}->log("Error getting next: $@"); return undef; } diff --git a/PBot/FactoidCommands.pm b/PBot/FactoidCommands.pm index 5ca479d8..46444950 100644 --- a/PBot/FactoidCommands.pm +++ b/PBot/FactoidCommands.pm @@ -663,6 +663,7 @@ sub cmd_factadd { $self->{pbot}->{factoids}->add_factoid('text', $from_chan, $context->{hostmask}, $keyword, $text); $self->{pbot}->{logger}->log("$context->{hostmask} added [$from_chan] $keyword_text => $text\n"); + $self->log_factoid($channel, $trigger, $context->{hostmask}, "created"); return "/say $keyword_text added to " . ($from_chan eq '.*' ? 'global channel' : $from_chan) . "."; } @@ -961,8 +962,8 @@ sub cmd_factfind { my $unquoted_args = $arguments; $unquoted_args =~ s/(?:\\(?!\\))//g; $unquoted_args =~ s/(?:\\\\)/\\/g; - if (not defined $argtype) { $argtype = "with text containing '$unquoted_args'"; } - else { $argtype .= " and with text containing '$unquoted_args'"; } + if (not defined $argtype) { $argtype = "containing '$unquoted_args'"; } + else { $argtype .= " and containing '$unquoted_args'"; } } if (not defined $argtype) { return $usage; } @@ -1021,14 +1022,14 @@ sub cmd_factfind { if ($i == 1) { chop $text; return - "Found one factoid submitted for " - . ($last_chan eq '.*' ? 'global channel' : $factoids->get_data($last_chan, '_name')) . ' ' + "Found one factoid in " + . ($last_chan eq '.*' ? 'global' : $factoids->get_data($last_chan, '_name')) . ' ' . $argtype . ": $last_trigger is " . $factoids->get_data($last_chan, $last_trigger, 'action'); } else { return "Found $i factoids " . $argtype . ": $text" unless $i == 0; - my $chans = (defined $channel ? ($channel eq '.*' ? 'global channel' : $channel) : 'any channels'); + my $chans = (defined $channel ? ($channel eq '.*' ? 'global' : $channel) : 'any channels'); return "No factoids " . $argtype . " submitted for $chans."; } } diff --git a/PBot/Factoids.pm b/PBot/Factoids.pm index 8d3fa95b..afa29f15 100644 --- a/PBot/Factoids.pm +++ b/PBot/Factoids.pm @@ -144,6 +144,8 @@ sub export_factoids { else { $filename = $self->{pbot}->{registry}->get_value('general', 'data_dir') . '/factoids.html'; } return if not defined $filename; + return if not defined $self->{factoids}->{dbh}; + $self->{pbot}->{logger}->log("Exporting factoids to $filename\n"); open FILE, "> $filename" or return "Could not open export path.";