]> git.donarmstrong.com Git - infobot.git/commitdiff
* Msg user with "not found" status instead of reporting nil to the channel
authordjmcgrath <djmcgrath@c11ca15a-4712-0410-83d8-924469b57eb5>
Tue, 2 Dec 2008 23:58:34 +0000 (23:58 +0000)
committerdjmcgrath <djmcgrath@c11ca15a-4712-0410-83d8-924469b57eb5>
Tue, 2 Dec 2008 23:58:34 +0000 (23:58 +0000)
git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk@1855 c11ca15a-4712-0410-83d8-924469b57eb5

src/Modules/Google.pl

index 1fab907e866ff0dee3e933edf99eaac177dba958..3ed1c81506dac09bb67845ad650926e9eb0fcdc4 100644 (file)
@@ -36,11 +36,19 @@ sub GoogleSearch {
         return;
     }
 
         return;
     }
 
+    # No results found
+    if ( not $Search->responseData->results ) {
+        &::DEBUG( "Google::GoogleSearch> $retval" );
+        &::msg( $::who, $retval);
+        &::msg( $::who, $Search->responseStatus );
+        return;
+    }
+
     my $data    = $Search->responseData;
     my $cursor  = $data->cursor;
     my @results = $data->results;
     my $data    = $Search->responseData;
     my $cursor  = $data->cursor;
     my @results = $data->results;
-
     my $count;
     my $count;
+
     $retval = "$where says \"\002$what\002\" is at ";
     foreach my $r (@results) {
         my $url = $r->url;
     $retval = "$where says \"\002$what\002\" is at ";
     foreach my $r (@results) {
         my $url = $r->url;