Answer the question
In order to leave comments, you need to log in
What resource can be replaced here?
robot.on("message", message => {
if (message.content === ".meme") {
const embed = new Discord.MessageEmbed()
got('https://www.reddit.com/r/memes/random/.json').then(response => {
let content = JSON.parse(response.body);
let permalink = content[0].data.children[0].data.permalink;
let memeUrl = `https://reddit.com${permalink}`;
let memeImage = content[0].data.children[0].data.url;
let memeTitle = content[0].data.children[0].data.title;
let memeUpvotes = content[0].data.children[0].data.ups;
let memeDownvotes = content[0].data.children[0].data.downs;
let memeNumComments = content[0].data.children[0].data.num_comments;
embed.setTitle(`${memeTitle}`)
embed.setURL(`${memeUrl}`)
embed.setImage(memeImage)
embed.setColor('RANDOM')
embed.setFooter(` ${memeUpvotes} ${memeDownvotes} ${memeNumComments}`)
message.channel.send(embed);
})
}
})
Answer the question
In order to leave comments, you need to log in
https://idaprikol.ru/top-memes
Open DevTools browser and see API requests
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question