forked from Supositware/Haha-Yes
higher limit for random image
This commit is contained in:
parent
12ea5e4861
commit
dffd207c0b
1 changed files with 4 additions and 1 deletions
|
@ -23,8 +23,11 @@ module.exports = class redditCommand extends Command {
|
||||||
const { body } = await snekfetch.get('https://www.reddit.com/r/' + sub + '.json');
|
const { body } = await snekfetch.get('https://www.reddit.com/r/' + sub + '.json');
|
||||||
let /* the bodies hit the floor */ i = Math.floor((Math.random() * 10) + 1);
|
let /* the bodies hit the floor */ i = Math.floor((Math.random() * 10) + 1);
|
||||||
console.log(body.data.children[i].data.post_hint)
|
console.log(body.data.children[i].data.post_hint)
|
||||||
|
if (body.data.dist == '0') {
|
||||||
|
return message.say('Not a valid subreddit')
|
||||||
|
}
|
||||||
while (body.data.children[i].data.post_hint !== 'image') {
|
while (body.data.children[i].data.post_hint !== 'image') {
|
||||||
i = Math.floor((Math.random() * 10) + 1);
|
i = Math.floor((Math.random() * 20) + 1);
|
||||||
}
|
}
|
||||||
if (body.data.children[i].data.over_18 == true) {
|
if (body.data.children[i].data.over_18 == true) {
|
||||||
return message.say("No nsfw")
|
return message.say("No nsfw")
|
||||||
|
|
Loading…
Reference in a new issue