Im currently trying to make a discord bot where when I type -gif arguments if displays a rich embed as shown in image with the according searched gif. For some reason, If I send the tenor api link by itself it works fine, but if I display it with an embed image, it displays nothing even using the same link. I've checked the link of the embed displayed image and it isn't a direct link ending in .gif, but if I add .gif to the end of that link, it is a direct link shown in my browser, but discord doesn't treat it like one. Code:
const Tenor = require("tenorjs").client({
"Key": "Ihaveakeyjustnotshowingit", // https://tenor.com/developer/keyregistration
"Filter": "off", // "off", "low", "medium", "high", not case sensitive
"Locale": "en_US", // Your locale here, case-sensitivity depends on input
"MediaFilter": "minimal", // either minimal or basic, not case sensitive
"DateFormat": "MM/D/YYYY - H:mm:ss A" // Change this accordingly
});
const fs = require('fs');
const discord = require('discord.js');
module.exports = {
name: 'gif',
aliases: ['tenor', 'gifsearch', 'gf'],
category: 'Funny',
utilisation: '{prefix}gif',
execute(client, message, args) {
const msgArgs = message.content.slice(this.name.length + 1)
Tenor.Search.Query(msgArgs, "1").then(Results => {
Results.forEach(Post => {
message.channel.send({
embed: {
title: 'Women',
color: 'c20d00',
image: {
url: (Post.itemurl),
},
},
})
message.channel.send(Post.itemurl)
});
}).catch(console.error);
},
};
If I add .gif to the embed link, just nothing shows up instead of showing the poop emoji error message in the embed. What am I supposed to do so it displays properly in an embed instead of just being sent as a message by itself 1 (Dont mind the weird gif tenor chose to send). I have also found other forums with similar issues and they solve it with adding .media before the .url property, but it also provides me with an error of
TypeError: Cannot read property 'media' of undefined
, which then causes the issue of simply not displaying anything within the embed 2. url: (Post.media[0].itemurl),
Thanks
Apparently its a part of discord's issue and they simply do not let tenor embeds work in a message embed, nothing I can do