2016-08-23 51 views
-1
gSearch: function(message){ 
     googleSearch.build({ 
     q: message          
     }, 
     function(error, response) 
     {      
     console.log(response); 
     chain.send('/me ' + response); 
     }); 
    },     

返回[Object對象]作爲結果Node.js的NPM谷歌搜索結果返回[Object對象]作爲結果

這不是HTML,它是一個機器人意味着一個IRC聊天類型。您發送一個請求,如!g「搜索詞」,然後它應該將搜索結果發送回聊天。與製造node.js的

+0

你已經明確提出會發生什麼,而不是你的問題或問題。 – ssube

+0

我如何得到它返回一個搜索結果,而不是[Object對象]它說我的搜索詞是[對象] – DiminishedHail

+0

我很抱歉,新的這個。 – DiminishedHail

回答

0

可以讓這樣的事情:

gSearch: function(message){ googleSearch.build({ q: message
}, function(error, response) {
console.log(response); chain.send('/me', JSON.stringify(response)); }); },

0

[Object object]是一個JavaScript對象的序列化。

您可能希望stringify它:

console.log(JSON.stringify(response))