diff --git a/PBot/Factoids.pm b/PBot/Factoids.pm index 2aca3074..cd4bd50a 100644 --- a/PBot/Factoids.pm +++ b/PBot/Factoids.pm @@ -14,6 +14,7 @@ $VERSION = $PBot::PBot::VERSION; use HTML::Entities; use Time::HiRes qw(gettimeofday); use Carp (); +use POSIX qw(strftime); use PBot::FactoidModuleLauncher; use PBot::DualIndexHashObject; @@ -114,15 +115,31 @@ sub export_factoids { open FILE, "> $filename" or return "Could not open export path."; my $time = localtime; - print FILE "
Last updated at $time\n"; + print FILE "\n\n"; + print FILE '' . "\n"; + print FILE '' . "\n"; + print FILE "\nLast updated at $time\n"; print FILE "owner | \n"; + print FILE "created on | \n"; + print FILE "times referenced | \n"; + print FILE "factoid | \n"; + print FILE "last edited by | \n"; + print FILE "edited date | \n"; + print FILE "last referenced by | \n"; + print FILE "last referenced date | \n"; + print FILE "
---|---|---|---|---|---|---|---|
" . $self->factoids->hash->{$channel}->{$trigger}->{owner} . " | \n"; + print FILE "" . encode_entities(strftime "%Y/%m/%d %H:%M:%S", localtime $self->factoids->hash->{$channel}->{$trigger}->{created_on}) . " | \n"; + + print FILE "" . $self->factoids->hash->{$channel}->{$trigger}->{ref_count} . " | \n"; + my $action = $self->factoids->hash->{$channel}->{$trigger}->{action}; $action =~ s/(.*?)http(s?:\/\/[^ ]+)/encode_entities($1) . "http" . encode_entities($2) . "<\/a>"/ge; $action =~ s/(.*)<\/a>(.*$)/"$1<\/a>" . encode_entities($2)/e; - print FILE "$trigger is " . $action . " | \n"; - - print FILE "- submitted by " . $self->factoids->hash->{$channel}->{$trigger}->{owner} . " " . localtime($self->factoids->hash->{$channel}->{$trigger}->{created_on}) . "\n | \n" . $self->factoids->hash->{$channel}->{$trigger}->{edited_by} . " | \n"; + print FILE "" . encode_entities(strftime "%Y/%m/%d %H:%M:%S", localtime $self->factoids->hash->{$channel}->{$trigger}->{edited_on}) . " | \n"; + } else { + print FILE "\n"; + print FILE " | \n"; + } + + print FILE " | " . $self->factoids->hash->{$channel}->{$trigger}->{ref_user} . " | \n"; + + if(exists $self->factoids->hash->{$channel}->{$trigger}->{last_referenced_on}) { + print FILE "" . encode_entities(strftime "%Y/%m/%d %H:%M:%S", localtime $self->factoids->hash->{$channel}->{$trigger}->{last_referenced_on}) . " | \n"; + } else { + print FILE "\n"; + } + + print FILE "\n"; } } - print FILE " |