All Projects → MayorMonty → Snoostorm

MayorMonty / Snoostorm

Licence: MIT license
An event based library for streaming from the Reddit API. Built on top of snoowrap

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Snoostorm

GfycatDetailsConvert
Reddit bot built on top of snoowrap which helps with converting Gfycat URLs.
Stars: ✭ 14 (-83.13%)
Mutual labels:  snoowrap
saveddit
Bulk Downloader for Reddit
Stars: ✭ 130 (+56.63%)
Mutual labels:  reddit-api
neo
A Discord bot built to satisfy a multitude of needs
Stars: ✭ 16 (-80.72%)
Mutual labels:  reddit-api
node-express-reddit-clone
Build a Node, Express and MySQL-based clone of Reddit for DecodeMTL web development bootcamp
Stars: ✭ 28 (-66.27%)
Mutual labels:  reddit-api
DRAW
DRAW: The Dart Reddit API Wrapper
Stars: ✭ 82 (-1.2%)
Mutual labels:  reddit-api
fridaybot
Slack bot for https://spb-frontend.slack.com
Stars: ✭ 29 (-65.06%)
Mutual labels:  reddit-api
Unim.press
A Reddit front-page reader in the style of The New York Times.
Stars: ✭ 199 (+139.76%)
Mutual labels:  reddit-api
Mongit
💾 Mongo-esque Reddit-based Database!
Stars: ✭ 20 (-75.9%)
Mutual labels:  reddit-api
roux
Simple and (a)synchronous Reddit API wrapper for Rust.
Stars: ✭ 41 (-50.6%)
Mutual labels:  reddit-api
rreddit
𝐫⟋ Get Reddit data
Stars: ✭ 49 (-40.96%)
Mutual labels:  reddit-api
reddit-image-fetcher
A JavaScript package for fetching reddit images, memes, wallpapers and more.
Stars: ✭ 40 (-51.81%)
Mutual labels:  reddit-api
MemePolice bot
This is a bot for r/PewdiepieSubmissions. Moderate harmful submissions by applying OCR on graphical content
Stars: ✭ 26 (-68.67%)
Mutual labels:  reddit-api
reddit-api-client
A PHP client for the Reddit API
Stars: ✭ 74 (-10.84%)
Mutual labels:  reddit-api
crypto-subreddits-cli
👽 Track Cryptocurrency Subreddits On The Command Line 👽
Stars: ✭ 24 (-71.08%)
Mutual labels:  reddit-api
redditwatcher
📻 Reddit streaming CLI
Stars: ✭ 17 (-79.52%)
Mutual labels:  reddit-api
Praw
PRAW, an acronym for "Python Reddit API Wrapper", is a python package that allows for simple access to Reddit's API.
Stars: ✭ 2,675 (+3122.89%)
Mutual labels:  reddit-api
aPRAW
Asynchronous Python Reddit API Wrapper
Stars: ✭ 49 (-40.96%)
Mutual labels:  reddit-api
ARAW
The Android Reddit API Wrapper
Stars: ✭ 75 (-9.64%)
Mutual labels:  reddit-api
set-top-reddit-wallpaper
PowerShell script to set the wallpaper as the top post of the day/week/month from /r/wallpapers and /r/wallpaper or any other subreddits.
Stars: ✭ 17 (-79.52%)
Mutual labels:  reddit-api
cronnit.com
A free tool for scheduling posts to Reddit.
Stars: ✭ 3 (-96.39%)
Mutual labels:  reddit-api

Snoostorm

Snoostorm is an event-based wrapped around snoowrap. It handles polling for you so you can design Reddit bots and applications to more easily react to new comments, messages, and other events on the site.

Install

You can install snoostorm from NPM. As snoostorm is implemented in TypeScript, types come preinstalled with the package.

npm install snoostorm
yarn add snoostorm

Usage

Let's get started with a simple example.

import { InboxStream, CommentStream, SubmissionStream } from "snoostorm";
import Snoowrap from "snoowrap";

const creds = require("./credentials.json");

const client = new Snoowrap(creds);

// Options object is a Snoowrap Listing object, but with subreddit and pollTime options
const comments = new CommentStream(client, {
  subreddit: "AskReddit",
  limit: 10,
  pollTime: 2000,
});
comments.on("item", console.log);

const submissions = new SubmissionStream(client, {
  subreddit: "AskReddit",
  limit: 10,
  pollTime: 2000,
});
submissions.on("item", console.log);

const inbox = new InboxStream(client);
inbox.on("item", console.log);

inbox.end();
inbox.on("end", () => console.log("And now my watch has ended"));

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);
});
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].