cute.js 832 Bytes
import fetch from "node-fetch";

const subReddits = [
    "aww",
    "jellybeantoes",
    "puppies"
]
// Currently BROKEN

module.exports = {
    name: 'cute',
    description: 'Embeds pictures pulled from listed subreddits',
    async execute(message, args, Discord){
        const randomIndex = randomInt(0, subReddits.length);

        //"https://reddit.com/${subReddits[randomIndex]}/.json?jsonp=?"
        let data = await fetch
        ("https://meme-api.herokuapp.com/gimme/${subReddits[randomIndex]}").then(
            res => res.json
        )

        const cuteEmbed = new Discord.MessageEmbed()
        .setColor('#91B2C7')
        .setImage(data.url);

        message.channel.send(cuteEmbed);
    }
}

//random int generator
function randomInt(min, max) {
    return (Math.floor(Math.random() * (max - min))) + min;
}