SnooStream
An event based wrapper for getting new comments and submissions from Snoowrap.
Features
- Can filter new posts via regex.
- Remove post duplicates returned from Reddit.
- Accounts for drift between system time and Reddit server time.
Installation
npm install snoostream
Usage
How to initialize
const SnooStream = ; let snooStream = ;
OR
const SnooStream = ;const Snoowrap = ; let snooWrap = ... // This is all Snoowrap configuration; let snooStream = ;
SnooStream(options[, drift])
SnooStream(Snoowrap[, drift])
options
Snoowrap configurationSnoowrap
A Snoowrap objectdrift
the number of seconds system time is ahead of Reddit server time. Usually not needed.
Create a Comment Stream
let commentStream = snooStream;// Or if you want to match with a specific regexlet commentStream = snooStream; commentStream;
snooStream.commentStream(subreddit[, options])
subreddit
the subreddit to poll for new comments. Default is 'all'.options.regex
Will only emit posts that match the provided regexoptions.rate
Rate at which to poll Reddit. Default is 1000 ms.options.*
Any additional options that would apply toSnoowrap.getNewComments()
such aslimit
which limits the amount of comments fetched every call.
Create a Submission Stream
let submissionStream = snooStream;// Or if you want to match with a specific regexlet submissionStream = snooStream; submissionStream;
snooStream.submissionStream(subreddit[, options])
subreddit
the subreddit to poll for new submissions. Default is 'all'.options.regex
Will only emit posts that match the provided regexoptions.rate
Rate at which to poll Reddit. Default is 1000 ms.options.*
Any additional options that would apply toSnoowrap.getNew()
such aslimit
which limits the amount of comments fetched every call.