SnooStorm
Event-based wrapper around snoowrap
Usage
Basic Usage:
;; const creds = ; const client = creds; // Options object is a Snoowrap Listing object, but with subreddit and pollTime optionsconst comments = client subreddit: "AskReddit" limit: 10 pollTime: 2000;comments; const submissions = client subreddit: "AskReddit" limit: 10 pollTime: 2000;submissions; const inbox = client;inbox; inbox;inbox;
Custom Polls
Out of the box, snoostorm
supports the following objects:
- Comments
- Submissions
- Inbox
- Modmail
If you would like to poll another object in snoowrap
, you can implement your own Poll easily. For example, here is an implementation that will poll for new friends:
import { Poll } from "snoostorm" export interface FriendStreamOptions { pollTime?: number;} export class FriendStream extends Poll<Snoowrap.RedditUser> { constructor( client: Snoowrap, options: FriendStreamOptions = { pollTime: 2000 } ) { super({ frequency: options.pollTime, get: () => client.getFriends(), identifier: "name", }); }} const friends = new FriendStream(client); friends.on("item", (item) => { console.log("New Friend!", item.name);});