Answers for "get random post from reddit nodejs"

1

get random reddit image link

case "pic":
    if (!args[1]) return message.channel.send("Enter a title (Be VERY specific");
    // pics was set equal to "https://www.reddit.com/r/pics.json" earlier
    snekfetch.get(pics).then(r => {
        let postTitle = args[1];
        let img = r.preview.images[0].source.url;
        let entry = r.find(post => post.title == postTitle);
        let picture = new Discord.RichEmbed()
            .setAuthor(entry.title)
            .addField(entry)
            .setImage(img);
        message.channel.send(picture);
        //message.channel.send(entry.preview.images[0].source.url);
    });
    break;
Posted by: Guest on September-25-2020

Browse Popular Code Answers by Language