Skip to content

Instantly share code, notes, and snippets.

@5nyper
Last active August 29, 2015 14:10
Show Gist options
  • Save 5nyper/342d11b5ad15c5d7f26a to your computer and use it in GitHub Desktop.
Save 5nyper/342d11b5ad15c5d7f26a to your computer and use it in GitHub Desktop.
function tweets() {
T.get('search/tweets', {
q: input,
since: '2013-11-11',
count: 3
}, function(err, data, response) {
if (data) {
sendMain('Twitter: ' + data.statuses[0].text + " " + data.statuses[0].created_at);
} else if (!(data && data.statuses && data.statuses[0] && data.statuses[0].text)) {
return sendMain("No such luck bruh");
}
console.log('data: ' , data);
})
}
ERROR:
sendMain('Twitter: ' + data.statuses[0].text + " " + data.stat
^
TypeError: Cannot read property 'text' of undefined
at /home/ubuntu/workspace/Main/Bot2.js:282:56
at responseHandler (/home/ubuntu/workspace/Main/node_modules/twit/lib/oarequest.js:375:12)
at passBackControl (/home/ubuntu/workspace/Main/node_modules/twit/node_modules/oauth/lib/oauth.js:367:11)
at IncomingMessage.<anonymous> (/home/ubuntu/workspace/Main/node_modules/twit/node_modules/oauth/lib/oauth.js:386:9)
at IncomingMessage.emit (events.js:117:20)
at _stream_readable.js:943:16
at process._tickCallback (node.js:419:13)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment