An event based wrapper for getting new comments and submissions from Snoowrap.
- Can filter new posts via regex.
- Remove post duplicates returned from Reddit.
- Accounts for drift between system time and Reddit server time.
npm install snoostream
const { SnooStream } = require('snoostream');
let snooStream = new SnooStream({
... // This is all Snoowrap configuration
});
OR
const { SnooStream } = require('snoostream');
const Snoowrap = require('snoowrap');
let snooWrap = new Snoowrap({
... // This is all Snoowrap configuration
});
let snooStream = new SnooStream(snooWrap);
const commentStream = snooStream.commentStream('all');
// Or if you want to match with a specific regex
const commentStream = snooStream.commentStream('all', { regex: /abc/ });
commentStream.on('comment', (comment, match) => {
... // comment is returned directly from Snoowrap
... // match contains the groups matched by regex
});
const submissionStream = snooStream.submissionStream('all');
// Or if you want to match with a specific regex
const submissionStream = snooStream.submissionStream('all', { regex: /abc/ });
submissionStream.on('submission', (submission, match) => {
... // submission is returned directly from Snoowrap
... // match contains the groups matched by regex
});