Code Monkey home page Code Monkey logo

snoostorm's Introduction

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);
});

snoostorm's People

Contributors

anjanaaa avatar anulman avatar brenapp avatar callumc34 avatar catmandx avatar dependabot[bot] avatar digislaw avatar jasonharrison avatar kodypeterson avatar sabbatiw avatar snyk-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

snoostorm's Issues

Add the ability to get a stream of a user's posts and comments

Is your feature request related to a problem? Please describe.
Afaik there isn't any way to access a stream of a user's new posts and comments.

Describe the solution you'd like
User's posts and comments should be accessible like subreddits:

const comments = new CommentStream(client, { user: "ExampleUser", limit: 10, pollTime: 2000 });
comments.on("item", console.log);

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

Describe alternatives you've considered
I've used snoowrap to poll a user's posts and comments every few seconds

Memory issue with long running process

Describe the bug
I'm running a continuous snoostorm process to monitor reddit comments and am running into memory issues. It looks like every new comment encountered is pushed into an array that isn't ever reduced in size. Perhaps snoostorm wasn't intended for a continuously running use-case?

To Reproduce
Steps to reproduce the behavior:

  1. Execute a script that streams comments
  2. Monitor the memory on your machine (I'm using free -m on Ubuntu)
  3. Free memory should continue to be depleted

Expected behavior
Clear old inventory when it's no longer needed. The inventory array is used to filter out comments we have already seen. We can probably clear old inventory after the array reaches some length or remove inventory that's older than the 100th oldest comment.

Here's what I'm doing as a workaround. Probably not ideal:

let stream = new snoostorm.CommentStream(client, {
  subreddit: "all",
  limit: 100,
  pollTime: 1000,
}).on("item", (comment) => {
  processComment(comment)

  // Picked the #s 1000 and 500 here without much thought. Not ideal but better than
  // memory issues.
  let len = stream.inventory.length
  if (len > 1000) {
    stream.inventory = stream.inventory.slice(len - 500)
  }
})

System Configuration:
Using TypeScript? No
Node Version? v14.3.0
Snoostorm Version? v1.3.0

Snoostorm is not a constructor

Describe the bug
A clear and concise description of what the bug is.
When I try to do new Snoostorm(), I get an error saying Snoostorm is not a constructor.
When I try to use the Snoostorm constructor as a normal function, it also says it isn't a function?

To Reproduce
Steps to reproduce the behavior:

  1. Initialize the library as usual.
  2. Run code.
  3. View error.

Expected behavior
A clear and concise description of what you expected to happen.
The script runs successfully.

System Configuration:
Using TypeScript? No
Node Version? v12.18.3
Snoostorm Version? latest
Snoowrap Version? latest

Additional context
Add any other context about the problem here.
None.

Documentation?

Hello, I would really like to use this library but couldn't find any documentation beyond the basic usage in the readme. Could anyone point me to some resources where I could learn to use this library?

TypeError: Snoostorm is not a constructor

I used this tutorial to set up a Reddit bot. This is my code so far:

//modules
require('dotenv').config();
const Snoowrap = require('snoowrap');
const Snoostorm = require('snoostorm');

//clients
const r = new Snoowrap({
	userAgent: 'some-description',
	clientId: process.env.CLIENT_ID,
	clientSecret: process.env.CLIENT_SECRET,
	username: process.env.REDDIT_USER,
	password: process.env.REDDIT_PASS
});
const client = new Snoostorm(r);

//options and stream
const streamOpts = {
	subreddit: 'all',
	results: 25
};
const comments = client.CommentStream(streamOpts);

comments.on('comment', (comment) => {
	console.log(comment);
});

However, when I run it I get this error:

const client = new Snoostorm(r);
               ^

TypeError: Snoostorm is not a constructor
    at Object.<anonymous> (/Users/myname/Documents/GitHub/repo-name/server.js:14:16)
    at Module._compile (internal/modules/cjs/loader.js:799:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:810:10)
    at Module.load (internal/modules/cjs/loader.js:666:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:606:12)
    at Function.Module._load (internal/modules/cjs/loader.js:598:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:862:12)
    at internal/main/run_main_module.js:21:11

Error: Cannot find module 'snoostorm' after upgrading to 1.2.0

Describe the bug

Cannot find module 'snoostorm' after upgrading to [email protected].

To Reproduce
Steps to reproduce the behavior:

mkdir tmp/ && cd tmp/
yarn add snoostorm
echo "require('snoostorm')" > blah.js
node blah.js

Expected behavior

The snoostorm module should be imported.

Observed behavior

jason@phl07s26 ~/projects/snoostorm> mkdir tmp/ && cd tmp/
                       yarn add snoostorm
                       echo "require('snoostorm')" > blah.js
                       node blah.js
yarn add v1.17.3
...
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
...
success Saved 1 new dependency.
info Direct dependencies
└─ [email protected]
info All dependencies
└─ [email protected]
Done in 1.53s.

internal/modules/cjs/loader.js:670
    throw err;
    ^

Error: Cannot find module 'snoostorm'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:668:15)
    at Function.Module._load (internal/modules/cjs/loader.js:591:27)
    at Module.require (internal/modules/cjs/loader.js:723:19)
    at require (internal/modules/cjs/helpers.js:14:16)
    at Object.<anonymous> (/home/jason/projects/test/tmp/blah.js:1:1)
    at Module._compile (internal/modules/cjs/loader.js:816:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)
    at Module.load (internal/modules/cjs/loader.js:685:32)
    at Function.Module._load (internal/modules/cjs/loader.js:620:12)
    at Function.Module.runMain (internal/modules/cjs/loader.js:877:12)

System Configuration:
Using TypeScript? Fails for both TS and nodeJS.
Node Version? v11.15.0
Snoostorm Version? 1.2.0

Ratelimit

Can't send comment replies - have to wait 10 minutes
So whenever I run my app locally, this rate limit thing never was an issue, I could send comments literally every second, mind you that the bot reddit account is fairly new - around 5 days.

I decided that its ready to deploy on heroku, so I did that, it works every now and then, but the thing is, it gives an error. Only gives it on heroku, not locally.

To Reproduce
Unhandled rejection Error: RATELIMIT,Looks like you've been doing that a lot. Take a break for 9 minutes before trying again.,ratelimit

Expected behavior
I actually am confused why this happens, im not sure if that's because of my config or heroku itself? because as I said, this was not the case when I run my bot locally

System Configuration:
Using Javascript
Node 16.16.0, npm 8.11
"snoostorm": "^1.5.2",
"snoowrap": "^1.23.0",

Additional context
That's it, bug only happens when its deployed online and working that way, rather than locally.

Fetches older post as new when a post is removed.

Describe the bug
Every time a post is deleted from the subreddit you're watching, the Xth post on the subreddit will get reposted in your feed (Assuming X is the number of results configured in your code.)

To Reproduce
Steps to reproduce the behavior:

  1. Submit more posts than the "results" config to a subreddit you're watching
  2. Remove the latest post
  3. See error

Expected behavior
Nothing. When a post is removed, it should do nothing.

Additional context
This happens because of how new posts are detected by comparing batches and removing duplicates. When a post is removed, the new batch will have an older post than every post in the previous batch, and that one is treated as new by the code.
Easy fix: compare timestamps between posts.

Does this poll, or use the stream api?

The description suggests that this uses streaming, which implies the use of a push api through websockets. However, there's a pollTime setting, which makes me think that this just polls periodically.

Which is the case?

(node:16843) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'split' of undefined

Hey there,

When I try running this:

const stream = new CommentStream(r, { subreddit: "all", results: 25 });

stream.on("item", comment => {
      console.log(comment);
})

I get the following error:

(node:16843) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'split' of undefined
    at /Users/cyrus/Documents/Progs/A_code/franklin-ford-bot/code/main_project/node_modules/snoowrap/dist/request_handler.js:246:38
    at tryCatcher (/Users/cyrus/Documents/Progs/A_code/franklin-ford-bot/code/main_project/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/Users/cyrus/Documents/Progs/A_code/franklin-ford-bot/code/main_project/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/Users/cyrus/Documents/Progs/A_code/franklin-ford-bot/code/main_project/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/Users/cyrus/Documents/Progs/A_code/franklin-ford-bot/code/main_project/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/Users/cyrus/Documents/Progs/A_code/franklin-ford-bot/code/main_project/node_modules/bluebird/js/release/promise.js:694:18)
    at _drainQueueStep (/Users/cyrus/Documents/Progs/A_code/franklin-ford-bot/code/main_project/node_modules/bluebird/js/release/async.js:138:12)
    at _drainQueue (/Users/cyrus/Documents/Progs/A_code/franklin-ford-bot/code/main_project/node_modules/bluebird/js/release/async.js:131:9)
    at Async._drainQueues (/Users/cyrus/Documents/Progs/A_code/franklin-ford-bot/code/main_project/node_modules/bluebird/js/release/async.js:147:5)
    at Immediate.Async.drainQueues [as _onImmediate] (/Users/cyrus/Documents/Progs/A_code/franklin-ford-bot/code/main_project/node_modules/bluebird/js/release/async.js:17:14)
    at processImmediate (timers.js:632:19)
(node:16843) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:16843) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Any thoughts what is going here?

Requesting clarification regarding exception handling

How can I handle exceptions or errors thrown by Reddit on snoostorm?

In plain snoowrap I know I can do something like

r.getUser(name).fetch().catch({ statusCode: 404 }, err => {[...]}) with r being the snoowrap object.

How could I achieve something similar in snoostorm?
I would like to catch both HTTP errors and Reddit exceptions such as RATELIMIT, THREAD_LOCKED and so on.

way to stop commentStream

How can i stop the commentStream after certain time period ? or what is the way to stop comment stream?

Required TypeScript fields in package.json

The package.json file for a TypeScript module requires both a "main" field and a "types" field.

For this package I believe they should be set to the following:
"main": "out/main.js",
"types": "out/main.d.ts"

Without these two fields set correctly, Node.js throws the following error when attempting to require('snoostorm'):
Error: Cannot find module 'snoostorm'.

Getting the username of the user an another user replied to in the InboxSteam

First of all, Snoostorm is amazing. Thank you for putting your effort & time in order to keep this project alive.

I don't think that this is currently possible due to Reddit API limits, but basically I have a Reddit bot that watches the InboxSteam for mentions. If the bot is mentioned, it does stuff.

Let's say that I mention the bot by replying to an another user. Is there any way I can possibly grab the username of the user I replied to? The message does arrive to the bot's inbox, however when browsing the inbox's json, I do not see any value that could represent the name of the user that another user mentioning the bot replied to. I only found author.name, but that is the username of the user that mentioned the bot (eg. my username), not the username of the user I'm replying to.

I don't want to watch r/all because of the huge amount of data, so I'm trying to work around inbox instead. Did I miss something in the json, or is there any function to get the data I need, if this is possible at all?

Thank you for your time, and good luck with your projects.

Ratelimited always

I always get a ratelimit after replying using item.reply. how to fix?

Could not find a declaration file for module 'snoostorm'

Describe the bug
After upgrading to 1.2.1, no typings are found.

To Reproduce
Install [email protected] and attempt to use with TypeScript.

Expected behavior
Typings should exist.

Actual behavior
Could not find a declaration file for module 'snoostorm'

System Configuration:
Using TypeScript? Yes, 3.6.2
Node Version? 11.15.0
Snoostorm Version? 1.2.1

I can't get comments?

I'm not getting any info from my comment stream

Code for comments:


stream.on("comment", (comment) => {
  console.log('Comment: ' + comment);
};

Very long delay for replies to register on reddit.

Describe the bug
Not sure on what exactly the bug is but there is a huge delay (>50 minutes) in replies registering (displaying in the post comments, displaying in inbox, displaying in overview, etc) on reddit. This occurs within 5 minutes of starting the streams. There is also a delay in saving comments and submissions. This is not affecting retrieving comments.

To Reproduce
Run this code, let it sit for around 5 or more minutes, then trigger the streams with comments or posts.

const client: Snoowrap = new Snoowrap({
    userAgent: process.env.USER_AGENT,
    clientId: process.env.CLIENT_ID,
    clientSecret: process.env.CLIENT_SECRET,
    username: process.env.REDDIT_USER,
    password: process.env.REDDIT_PASS
});
client.config({ continueAfterRatelimitError: true, requestDelay: 2000 });

const comments: CommentStream = new CommentStream(client, { subreddit: '<name>', limit: 100 });
comments.on('item', (comment: Comment): void => {
    if (!comment.saved && comment.author.name !== BOT_NAME) {
        // Just constructs a string for the reply and could just be const reply: string = 'foo';.
        const reply: string = getReply(comment);
        if (reply) {
            comment.reply(reply);
            comment.save();
        }
    }
});

const submissions: SubmissionStream = new SubmissionStream(client, { subreddit: '<name>', limit: 100 });
submissions.on('item', (submission: Submission) => { // Same as CommentStream. });

Expected behavior
The replies later in the streams' uptimes registering on reddit as quickly as in the beginning.

System Configuration:
TypeScript - 3.6.4
Node Version - 12.13.0
Snoostorm Version - 1.2.2
Snoowrap Version - 1.20.0

Additional context
I have this running on both a Linux EC2 instance and a personal Windows 7 machine. The delays occur on both machines. As for snoowrap config options and snoostorm stream options, I tried continueAfterRatelimitError and requestDelay with various combinations of limit and pollTime.

ModMailStream not firing on new mod mail

Describe the bug
After setting up a ModMailStream using mod credentials and adding a listener for .on("item", (item) => console.log) and having new messages sent in modmail, I am not seeing the callback fire.

To Reproduce
Steps to reproduce the behavior:
Run the code below:

import { ModMailStream } from "snoostorm";
import { redditapi } from "./services/redditapi";
import snoowrap from "snoowrap";

const redditapi = new snoowrap({
  userAgent: process.env.REDDIT_USER_AGENT,
  clientId: process.env.REDDIT_CLIENTID,
  clientSecret: process.env.REDDIT_CLIENTSECRET,
  username: process.env.REDDIT_USERNAME,
  password: process.env.REDDIT_PASSWORD,
});

redditapi.getModmail().then((messages) => {
  console.log(messages);
});

const modListener = new ModMailStream(redditapi, {
  pollTime: 1000, // FIXME: use environment variable
});

modListener.on("item", (item) => console.log(item));
modListener.on("listing", (items) => {
  if (items.length > 0) console.log(items);
});

It does successfully retrieve 25 modmail messages on startup, and it does keeping firing the "listing" event listeners with an empty array, however neither the "item" or "listing" listeners fire with mod mail despite a handful of messages arriving since startup.

Expected behavior
New mod mail messages should be fired into the listener

System Configuration:
Using TypeScript? v3.9.5
Node Version? v12.16.3
Snoostorm Version? v1.4.2

Additional context
Not sure if I just missed something in the docs. Thank you.

Upgrade snoostorm to resolve upstream lodash vuln

Describe the bug
GitHub Alerts is notifying me of a vuln on lodash < 4.17.13, which is a transitive dependency of the pinned snoowrap version.

To Reproduce
Steps to reproduce the behavior:

  1. Run npm-why lodash (or yarn why lodash) in this project, or a project depending on snoostorm
  2. See a transitive dependency on lodash @ 4.17.11
    image

Expected behavior
The transitive dependency should resolve to 4.17.15, per changes from 4 days ago, released with (snoowrap 1.19.0)[https://www.npmjs.com/package/snoowrap]

System Configuration:
Using TypeScript? N
Node Version? 11.9
Snoostorm Version? ^1.1.2

Additional context
N/A

Trying to TDD with jest

Is your feature request related to a problem? Please describe.
I'm trying to test as I develop with jest.

Describe the solution you'd like
A working example would be really helpful

Describe alternatives you've considered
I've tried to figure it out myself. I got as far as the following code, but I get the Jest has detected the following 1 open handle potentially keeping Jest from exiting: error:

import { SubmissionStream } from "snoostorm";
import { redditApiClientInfo } from "./redditApi";

let submissionStream: SubmissionStream;
beforeAll(() => {
    submissionStream = new SubmissionStream(redditApiClientInfo, {
        subreddit: "malefashionadvice",
        pollTime: 1000, // runs every 1 seconds
        limit: 2,
    });
});

afterAll(async () => {
   return submissionStream.end()
});

export async function getLatestWaywtPost(submissionStream: SubmissionStream) {
    let submissionsCount = 0;
    submissionStream.on("item", async submission => {
        console.log(submission);
        submissionsCount ++;
    })
    if(submissionsCount === 2){
        console.log("ending stream, count:", submissionsCount);
        return submissionsCount;
    }
}

test("getLatestWaywtPost()", async () => {
    const latestPostLength = await getLatestWaywtPost(submissionStream)
    await new Promise((r) => setTimeout(r, 2000));
    expect(latestPostLength).toBe(2)
});

Additional context
N/A

Never triggers, using example code

require('dotenv').config();

const Snoowrap = require('snoowrap');
const Snoostorm = require('snoostorm');

const r = new Snoowrap({
    userAgent: 'nodejs:redditinsurance:v1.0.0 (by u/austinhuang)',
    clientId: process.env.CLIENT_ID,
    clientSecret: process.env.CLIENT_SECRET,
    username: process.env.REDDIT_USER,
    password: process.env.REDDIT_PASS
});
const client = new Snoostorm(r);

var comments = client.CommentStream({
	subreddit: "all",
	results: 1000,
	pollTime: 3000
});

comments.on('comment', (comment) => {
    if (comment.body === 'I\'d like to start a claim.') {
		return r.getSubmission(comment.link_id).fetch().then(post => {
			return comment.reply('Your claim has been submitted. We\'ll get back to you once it is processed.\n\nBest Regards, Reddit Insurance^[Info](https://reddit.com/r/RedditInsurance)');
		});
    }
});```

Error handling?

Hi!

I have a question regarding error handling. How do you recommend to do this? I occasionally get 401 errors, and am not sure how I should catch them. Thanks!

RFC: Modularize API Library

Currently, this project uses snoowrap as it's API provider, as it remains the most popular library, and was pretty much the only one when I created this project.

Is there a need for other providers to be used? What providers should I consider adding?

TypeError: client.getNewComments is not a function

Describe the bug
A clear and concise description of what the bug is.
I can't launch bot
(node:23869) UnhandledPromiseRejectionWarning: TypeError: client.getNewComments is not a function

To Reproduce
Steps to reproduce the behavior:

  1. turn on bot
  2. get (node:23869) UnhandledPromiseRejectionWarning: TypeError: client.getNewComments is not a function

Expected behavior
A clear and concise description of what you expected to happen.
Bot to turn on

System Configuration:
Using TypeScript? no
Node Version? latest
Snoostorm Version? latest
Snoowrap Version? latest

Additional context
Add any other context about the problem here.
here is my code

// ----- PACKAGES -----
const { CommentStream, InboxStream, SubmissionStream } = require("snoostorm")
const Snoowrap = require("snoowrap") // Snoowrap is the reddit API
const Snoostorm = require("snoostorm") // Reads comments/posts

// ----- FILE IMPORTS -----
const config = require("./config.json")

// ----- VARIABLES -----

// ----- BOT SETUP -----
const client = config.credentials

const streamOpts = {
    subreddit: config.subreddit,
    results: 25
};

const stream = new CommentStream(streamOpts);

// ----- BOT LISTENER -----

stream.on('comment', (comment) => {
    console.log('New comment: ' + comment);
});```

Config is not getting set with Snoostorm

Using the following code

const r = new Snoowrap({
    userAgent: USER_AGENT,
    clientId: CLIENT_ID,
    clientSecret: CLIENT_SECRET,
    username: USERNAME,
    password: PASSWORD
});

r.config({continueAfterRatelimitError: true});

const client = new Snoostorm(r);
stream = client.SubmissionStream({
     subreddit: subreddits,
      results: 10,
      pollTime: 1000
});
stream.on('submission', (data) => {
 // data has continueAfterRatelimitError as false.
});

I am getting the following:

You have triggered an unhandledRejection, you may have forgotten to catch a Promise rejection:
Error: snoowrap refused to continue because reddit's ratelimit was exceeded. For more information about reddit's ratelimit, please consult reddit's API rules at https://github.com/reddit/reddit/wiki/API.

CommentStream appears to drop a significant amount of comments from /r/all.

When listening for comments on /r/all, CommentStream appears to drop a significant number of comments when compared to comment streams created by accessing the Reddit API via other means. I created two simple scripts, one in Node.js utilizing Snoostorm, and one in Python using the very popular PRAW module. Both scripts listened for comments on /r/all and printed comment IDs to a file.

The results from PRAW surfaced a very large number of comments that were not present in the results from the script utilizing Snoostorm.

const r = new Snoowrap({
    userAgent: 'reddit-bot-example-node',
    clientId: CLIENT_ID,
    clientSecret: CLIENT_SECRET,
    username: REDDIT_USER,
    password: REDDIT_PASS
});

const stream = new CommentStream(r, { subreddit: "all"});
stream.on("item", comment => {
    fs.appendFile('results.txt', comment.id + " " + comment.permalink +"\n", function (err) {
        if (err) throw err;
        console.log('Saved!');
    });
})

How do I see the ratelimits info

It would be helpful if there was a way to see the X-Ratelimit-Reset and X-Ratelimit-Remaining headers, or even implement your own rate limit handler

can't use r/all

Describe the bug
when i give a comment stream all as the subreddit it doesn't get anything, while if i do askreddit i'll get a lot of things

To Reproduce

  1. use this code with a snoowrap client called client
const comments = new CommentStream(client, {
  subreddit: "all",
  limit: 10,
  pollTime: 2000,
});
  1. run
  2. it doesnt work
    Expected behavior
    It will get a bunch of posts from r/all

System Configuration:
Using TypeScript?
no
Node Version?
node: '12.14.1',
Snoostorm Version?
^1.5.0
Snoowrap Version?
1.21.0
Additional context
I didn't do anything and it just stopped working? is this a reddit api thing?

Get only unread messages in inbox stream/filtering the inbox

Is your feature request related to a problem? Please describe.
I found it difficult to find/apply the way to apply snoowrap's inbox filters to snoostorm's inbox stream

Describe the solution you'd like
I would love it if it was as easy as pie to use filters in the inbox stream, for example like so.

Describe alternatives you've considered
Apparently, snoostorm-es6 has this feature, but hasn't been updated in a while, so I'll simply use my own snoowrap function until this is fixed or further instructions are provided on how to resolve it.

Additional context
Otherwise, the library is stellar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.