Search code examples
node.jsdiscord.jsembed

Now showing URL image discord.js


This is the code:

fetch(`https://api.tenor.com/v1/random?key=${tenorAPI}&q=anime+kiss&limit=1.`)
  .then(res => res.json())
  .then(json => message.channel.send() + message.say(json.results[0].url))
    
  const embed = new MessageEmbed()
      .setDescription(`**${user.username}** you've kissed by **${message.author.username}**! OwO`)
      .setColor("RANDOM")
      .setImage(`https://api.tenor.com/v1/random?key=${tenorAPI}&q=anime+kiss&limit=1.gif`)
   message.channel.send(embed).then(message.react('🥰'));
    return;

I want to know how can I do to see the GIF

See

Other command not embedded it shows

enter image description here


Solution

  • It works perfectly now, this is the code,it is similar to the previous user but there was an error

    const embed = new MessageEmbed()
          .setDescription(`**${user.username}** you've kissed by **${message.author.username}**! OwO`)
          .setColor("RANDOM")
    fetch(`https://api.tenor.com/v1/random?key=${tenorAPI}&q=anime+kiss&limit=1`)
      .then(res => res.json())
      .then(json => {
         embed.setImage(json.results[0].media[0].gif.url);
         message.channel.send(embed).then(message.react('🥰'));
       })