mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-04 15:56:52 +02:00
Update Reddit
This commit is contained in:
@@ -26,6 +26,7 @@ module.exports = class RedditCommand extends Command {
|
||||
const { body } = await snekfetch
|
||||
.get(`https://www.reddit.com/r/${subreddit}/new.json`)
|
||||
.query({ sort: 'new' });
|
||||
if (!body.data.children.length) return msg.say('Subreddit Not Found.');
|
||||
const post = body.data.children[Math.floor(Math.random() * body.data.children.length)];
|
||||
if (!post.data) return msg.say('This post has no data, try again!');
|
||||
if (!msg.channel.nsfw && post.data.over_18) return msg.say('This post is only viewable in NSFW Channels.');
|
||||
|
||||
Reference in New Issue
Block a user