From 8f5542bf7064a352c6f7c1167715a7a8fbb80a4e Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Fri, 21 Sep 2018 11:10:06 +0000 Subject: [PATCH] Fix --- structures/commands/Subreddit.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/structures/commands/Subreddit.js b/structures/commands/Subreddit.js index 7eec3d94..8ab5458a 100644 --- a/structures/commands/Subreddit.js +++ b/structures/commands/Subreddit.js @@ -12,9 +12,9 @@ module.exports = class SubredditCommand extends Command { async run(msg, { subreddit }) { if (!subreddit) subreddit = typeof this.subreddit === 'function' ? this.subreddit() : this.subreddit; try { - const { post, subreddit } = await this.random(subreddit, msg.channel.nsfw); - if (!post) return msg.reply(`I couldn't fetch anything from r/${subreddit}...`); - return msg.say(this.generateText(post, subreddit)); + const { post, origin } = await this.random(subreddit, msg.channel.nsfw); + if (!post) return msg.reply(`I couldn't fetch anything from r/${origin}...`); + return msg.say(this.generateText(post, origin)); } catch (err) { if (err.status === 403) return msg.say('This subreddit is private.'); if (err.status === 404) return msg.say('Could not find any results.'); @@ -41,7 +41,7 @@ module.exports = class SubredditCommand extends Command { }); if (!posts.length) return null; return { - subreddit, + origin: subreddit, post: posts[Math.floor(Math.random() * posts.length)].data }; }