From 761c27da0404f256aad3d5cbee30571739c2d142 Mon Sep 17 00:00:00 2001
From: Loic Bersier <loic.bersier1@gmail.com>
Date: Fri, 28 Sep 2018 16:16:50 +0200
Subject: [PATCH] Dosent get stuck in the while ( pls work for once )

---
 commands/fun/reddit.js | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/commands/fun/reddit.js b/commands/fun/reddit.js
index 32bd257..c8189c9 100644
--- a/commands/fun/reddit.js
+++ b/commands/fun/reddit.js
@@ -22,16 +22,16 @@ module.exports = class redditCommand extends Command {
         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);
         let a = 0
-        if (!body.data.children[1]) {
+        if (!body.data.children[1])
             return message.say('Not a valid subreddit')
-        }
-        while (body.data.children[i].data.post_hint !== 'image' || a == 5) {
+        while (body.data.children[i].data.post_hint !== 'image') {
             i = Math.floor((Math.random() * 100) + 1);
             a++
+            if (a == 5)
+                return message.say("Could not find any images")
         }
-            if (body.data.children[i].data.over_18 == true) {
+            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 <your feedback>\")")
-            } 
             const redditEmbed = new Discord.RichEmbed()
             .setColor("#ff9900")
             .setTitle(body.data.children[i].data.title)