Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Never triggers, using example code #4

Closed
austinhuang0131 opened this issue Nov 10, 2017 · 5 comments
Closed

Never triggers, using example code #4

austinhuang0131 opened this issue Nov 10, 2017 · 5 comments
Assignees
Labels

Comments

@austinhuang0131
Copy link

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)');
		});
    }
});```
@brenapp brenapp self-assigned this Nov 13, 2017
@brenapp
Copy link
Owner

brenapp commented Nov 13, 2017

Can't test this now, what's the output/error?

@austinhuang0131
Copy link
Author

There is no outputaside from the "you are being ratelimited" thingy, it just doesn't do anything.

@brenapp
Copy link
Owner

brenapp commented Nov 14, 2017

If you're getting rate limiting errors, then it sounds like you haven't corrected configured your bot account. Depending on the exact error message, you may be unable to make posts/read data because of karma restrictions. You can remove these restrictions by making the bot accounts moderators on the applicable subreddit. However, I can't really help you unless you give me the exact output when the code is executed

@brenapp brenapp assigned austinhuang0131 and unassigned brenapp Nov 14, 2017
@austinhuang0131
Copy link
Author

Since I left Snoostorm already (Basically setInterval to fetch posts), I cannot retest it (I can only do stuff on my borrowed VPS which I can't use it for testing, I can only use it for production. Plus, my own PC is admin-locked thus I can't get nodejs). I think there was no output log aside from ratelimiting (by Snoowrap).

@brenapp
Copy link
Owner

brenapp commented Nov 14, 2017

Be wary of duplicate responses when using setInterval(); Snoostorm had a system to ensure that handlers were never called more than once for one comment/post

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants