diff --git a/commands/random/meme.js b/commands/random/meme.js index 146d5681..929c7eab 100644 --- a/commands/random/meme.js +++ b/commands/random/meme.js @@ -17,7 +17,13 @@ module.exports = class MemeCommand extends Command { async run(msg) { const subreddit = subreddits[Math.floor(Math.random() * subreddits.length)]; try { - const { body } = await request.get(`https://www.reddit.com/r/${subreddit}/hot.json`); + const { body } = await request + .get(`https://www.reddit.com/r/${subreddit}/top.json`) + .query({ + sort: 'top', + t: 'day', + limit: 100 + }); const posts = body.data.children.filter(post => post.data && post.data.post_hint === 'image' && post.data.url); if (!posts.length) return msg.reply(`I couldn't fetch any images from r/${subreddit}...`); const post = posts[Math.floor(Math.random() * posts.length)]; diff --git a/commands/random/reddit.js b/commands/random/reddit.js index d5c87624..ce5c349e 100644 --- a/commands/random/reddit.js +++ b/commands/random/reddit.js @@ -25,7 +25,10 @@ module.exports = class RedditCommand extends Command { try { const { body } = await request .get(`https://www.reddit.com/r/${subreddit}/new.json`) - .query({ sort: 'new' }); + .query({ + sort: 'new', + limit: 100 + }); const allowed = msg.channel.nsfw ? body.data.children : body.data.children.filter(post => !post.data.over_18); if (!allowed.length) return msg.say('Could not find any results.'); const post = allowed[Math.floor(Math.random() * allowed.length)].data; diff --git a/commands/random/shower-thought.js b/commands/random/shower-thought.js index 93311ae0..36e7393b 100644 --- a/commands/random/shower-thought.js +++ b/commands/random/shower-thought.js @@ -15,11 +15,15 @@ module.exports = class ShowerThoughtCommand extends Command { async run(msg) { try { const { body } = await request - .get('https://www.reddit.com/r/Showerthoughts.json') - .query({ limit: 1000 }); - const allowed = msg.channel.nsfw ? body.data.children : body.data.children.filter(post => !post.data.over_18); - if (!allowed.length) return msg.say('Hmm... It seems the thoughts are all gone right now. Try again later!'); - return msg.say(allowed[Math.floor(Math.random() * allowed.length)].data.title); + .get('https://www.reddit.com/r/Showerthoughts/top.json') + .query({ + sort: 'top', + t: 'day', + limit: 100 + }); + const posts = body.data.children.filter(post => post.data && (msg.channel.nsfw ? true : !post.data.over_18)); + if (!posts.length) return msg.say('Hmm... It seems the thoughts are all gone right now. Try again later!'); + return msg.say(posts[Math.floor(Math.random() * posts.length)].data.title); } catch (err) { return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); } diff --git a/package.json b/package.json index 0df3aa0a..39aebd76 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "90.2.0", + "version": "90.2.1", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {