Last active
August 29, 2015 14:17
-
-
Save Anaphase/e7af5a29b7bf60f89db2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var RedditStream, auth, comment_stream; | |
RedditStream = require('reddit-stream'); | |
comment_stream = new RedditStream('comments', 'all', 'unique user agent for my-supercool-bot'); | |
auth = { | |
username: 'my-supercool-bot', | |
password: 'password', | |
app: { | |
id: 'your-app-id', | |
secret: 'your-app-secret' | |
} | |
}; | |
comment_stream.login(auth).then(function() { | |
console.log('logged in for comment stream'); | |
comment_stream.start(); | |
setTimeout(function() { | |
comment_stream.stop(); | |
setTimeout(function() { | |
comment_stream.start(); | |
}, 60 * 1000); | |
}, 60 * 1000); | |
}, function() { | |
console.log('failed to log in!'); | |
}); | |
comment_stream.on('new', function(comments) { | |
console.log('found', comments.length, 'comment(s)'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment