From 1121f92ca6f756c830f7445f46fa9e1bf4c589fe Mon Sep 17 00:00:00 2001 From: loicbersier Date: Thu, 27 Sep 2018 23:10:46 +0200 Subject: [PATCH] put limit to 100 --- commands/fun/reddit.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/commands/fun/reddit.js b/commands/fun/reddit.js index ab47cf13..1d094661 100644 --- a/commands/fun/reddit.js +++ b/commands/fun/reddit.js @@ -19,13 +19,13 @@ module.exports = class redditCommand extends Command { } async run(message, { sub }) { - const { body } = await snekfetch.get('https://www.reddit.com/r/' + sub + '.json'); + const { body } = await snekfetch.get('https://www.reddit.com/r/' + sub + '.json?limit=100'); let /* the bodies hit the floor */ i = Math.floor((Math.random() * 10) + 1); if (!body.data.children[1]) { return message.say('Not a valid subreddit') } while (body.data.children[i].data.post_hint !== 'image') { - i = Math.floor((Math.random() * 20) + 1); + i = Math.floor((Math.random() * 100) + 1); } if (body.data.children[i].data.over_18 == true) { return message.say("No nsfw ( if you want a nsfw version of this commands use the feedback commands \"haha feedback \")")