Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

222
Views
Discord tenor gif embed doesn't load

I'm having a problem with my code. My code sends the gif in the embed but the gif doesn't load so I want to know if it is from my code or from discord/tenor.

This is my code:

client.on('message', message => {
  if (message.content.startsWith(prefix + 'punch')) {
    const user = message.mentions.users.first();
    if (user) {
      request('https://api.tenor.com/v1/random?key==punch&limit=1', function (error, response, body) {
        if (!error && response.statusCode == 200) {
          const data = JSON.parse(body);
          const gif = data.results[0].url;
          const embed = new MessageEmbed()
            .setTitle(`${message.author.username} a fraper ${user.username}`)
            .setColor(0x00AE86)
            .setImage(gif)
            .setTimestamp()
            .setFooter('GIFER', 'https://discord.com/api/oauth2/authorize?client_id=962008158727974922&permissions=8&scope=bot');
          message.channel.send({ embeds: [embed]});
        }
      });
    } else {
      message.channel.send('Vous devez mentionner un utilisateur !');
    }
  }
});
about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

data.results[0].url is not a direct link to the file, but the short URL to view the post on tenor.com. If you check https://tenor.com/becER.gif, it redirects to https://tenor.com/view/good-ebening-good-evening-coach-looking-searching-gif-15739239.

You should use the media key instead. It's an array of dictionaries with the format (like gif, mp4, webm, etc.) as the key and a media object (with keys like size, duration, and url) as the value. It means you can get the URL of the gif like this:

const gif = data.results[0].media[0].gif.url;
about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!