M
M
matveyyyyyyyy2020-11-11 16:47:31
JavaScript
matveyyyyyyyy, 2020-11-11 16:47:31

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);
        })
    }
})


The .meme command will display a random joke from reddit, but is there any Russian-language similar resource with which you can do this, because not all users have the knowledge of English to understand these jokes;)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Yarkov, 2020-11-11
@yarkov

https://idaprikol.ru/top-memes
Open DevTools browser and see API requests

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question