if( $predicate ) {
$heap->{ 'db' }->{ uc( $subj ) } = $predicate;
DumpFile( "factoids.yaml", $heap->{ 'db' } );
- $kernel->post( $src, $replypath, "Okay, $who.", $dest );
+ $kernel->post( $src, $replypath, "$who: Factoid '$subj' defined as '$predicate'", $dest );
} else {
delete $heap->{ 'db' }->{ uc( $subj ) } if exists $heap->{ 'db' }->{ uc( $subj ) };
DumpFile( "factoids.yaml", $heap->{ 'db' } );
- $kernel->post( $src, $replypath, "Okay, $who.", $dest );
+ $kernel->post( $src, $replypath, "$who: Factoid '$subj' removed", $dest );
}
} else {
$kernel->post( $src, $replypath, "Invalid subject.", $dest );
sub {
my( $kernel, $heap, $who, $what, $src, $dest, $replypath ) = @_;
my( $service, $url ) = split( / /, $what, 2 );
- $service =~ s/[^a-z]//gi;
- if( length $url ) {
- eval "use WWW::Shorten::$service";
- if( $@ ) {
- $kernel->post( $src, $replypath, "Loading 'WWW::Shorten::$service' failed: $@", $dest );
- return;
- }
- } else {
+ if( ! length $url ) {
$url = $service;
- use WWW::Shorten::TinyURL;
+ $service = "SnipURL";
+ }
+ $service =~ s/[^a-z]//gi;
+ eval "use WWW::Shorten::$service";
+ if( $@ ) {
+ $kernel->post( $src, $replypath, "Loading 'WWW::Shorten::$service' failed: $@", $dest );
+ return;
}
- my( $kernel, $heap, $who, $url, $src, $dest, $replypath ) = @_;
if( !exists( $heap->{ 'urls' } ) ) {
$heap->{ 'urls' } = {};
}
my @arr = @{ $heap->{ 'urls' }->{ uc( $url ) } };
$kernel->post( $src, $replypath, $arr[2]." [first: ".$arr[0]."/".$arr[1]."]", $dest );
} else {
- my $url = makeashorterlink( $url ) or return;
- $heap->{ 'urls' }->{ uc( $url ) } = [ $who, $dest->{ 'dest' }, $url ];
- $kernel->post( $src, $replypath, "$url [$who]", $dest );
+ my $url = makeashorterlink( $url );
+ if( defined $url ) {
+ $heap->{ 'urls' }->{ uc( $url ) } = [ $who, $dest->{ 'dest' }, $url ];
+ $kernel->post( $src, $replypath, "$url [$who]", $dest );
+ } else {
+ $kernel->post( $src, $replypath, "Shortening URL failed.", $dest );
+ }
}
}
FLUSHURLS: |-