cute.js
900 Bytes
const subReddits = [
"r/aww"
]
module.exports = {
name: 'cute',
description: 'Embeds pictures pulled from listed subreddits',
execute(message, args, Discord){
const randomIndex = randomInt(0, subReddits.length);
axios
.get(`https://reddit.com/${subReddits[randomIndex]}/.json`)
.then((resp) => {
const {
title,
url,
subreddit_name_prefixed: subreddit
} = getRandomPost(resp.data.data.children);
})
const newEmbed = new Discord.cuteEmbed()
.setTitle('${title}')
.setImage('${url}');
}
}
//random int generator
function randomInt(min, max) {
return (Math.floor(Math.random() * (max - min))) + min;
}
//random post generator
function getRandomPost(posts) {
const randomIndex = randomInt(0, posts.length);
return posts[randomIndex].data;
}