Reputation: 1422
I am trying to display gifs from tenor with discordjs. I have read similar posts that requires setImage
an actual file.
export const PINCH=[
"https://tenor.com/view/anime-pinch-face-gif-14114215.gif",
"https://tenor.com/view/hestia-cheek-pinch-cute-danmachi-is-it-wrong-to-try-to-pick-up-girls-in-a-dungeon-gif-19893304.gif",
"https://tenor.com/view/horimiya-anime-shota-hori-siblings-gif-19989089.gif",
"https://tenor.com/view/anime-cute-pinch-tanakakun-is-always-listless-gif-14725930.gif",
"https://tenor.com/view/anime-hibike-euphonium-asuka-tanaka-oumae-kumiko-pinch-gif-16488937.gif",
"https://tenor.com/view/squishy-cheeky-anime-gif-15322355.gif",
"https://tenor.com/view/rikka-takanashi-so-cute-chuunibyou-pinch-face-anime-gif-13451272.gif",
"https://tenor.com/view/slap-butts-anime-hit-gif-14179587.gif"
]
I have set images in an array and NOT making a fetch call to get images. Here is the code that builds the emebed image.
const getEmbedWithUser= (user: User, mention: User)=>{
const image=PINCH[Math.floor(Math.random()*PINCH.length)]
return new EmbedBuilder()
.setColor(0x0099FF)
.setAuthor({
name: `${user.username} pinches ${mention?.username}!! Aaa, that hurts`,
iconURL: user.avatarURL() || ""
})
.setImage(image);
}
Images are in loading state and then shows a discord poop image.
How do I solve this?
But I give direct links like this..
.setImage("https://c.tenor.com/M9fgYFTTCqQAAAAC/anime-cute.gif");
The image shows and works as expected.
Upvotes: 1
Views: 323
Reputation: 1464
Replace all the links with their direct version, like so:
export const PINCH = [
"https://c.tenor.com/GJMfGDUMv1QAAAAC/anime-pinch-face.gif",
"https://c.tenor.com/HarnS903A_YAAAAC/hestia-cheek-pinch.gif",
"https://c.tenor.com/OTrBBINLVswAAAAC/horimiya-anime.gif",
"https://c.tenor.com/M9fgYFTTCqQAAAAC/anime-cute.gif",
"https://c.tenor.com/aApaaPTuEvYAAAAC/anime-hibike-euphonium.gif",
"https://c.tenor.com/cg9Yp4fu7VQAAAAC/squishy-cheeky.gif",
"https://c.tenor.com/pQQWwZE_OqEAAAAC/rikka-takanashi-so-cute.gif",
"https://c.tenor.com/bHE5Txlp5-8AAAAC/slap-butts-anime.gif"
];
Upvotes: 1