.setThumbnail link not working.

I would like to use a local file as embed thumbnail, that is served by node-js express that is running alongside my bot. I generate the link properly, it works fine when checked in a web browser, yet it does not appear on discord.
2 Replies
d.js toolkit
d.js toolkit•11mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
Farleena (Dani)
Farleena (Dani)OP•11mo ago
Embed code:
const embed = new EmbedBuilder()
.setTitle('🔧 Beállítások')
.setDescription('A legördülő menü segítségével válassz beállítási kategóriát!')
.setColor(0x0000FF)
// .setThumbnail(getRandomElement(settingsThumbnails))
.setThumbnail(`${process.env.WEBREDIRECT}/resources/${getRandomElement(settingsThumbnails)}`)
.setFooter({ text: `${interaction.client.user.username} by Farleena`, iconURL: `${interaction.client.user.displayAvatarURL({ dynamic: true })}` });

const row = new ActionRowBuilder()
.addComponents([settingsPageSelector]);
const embed = new EmbedBuilder()
.setTitle('🔧 Beállítások')
.setDescription('A legördülő menü segítségével válassz beállítási kategóriát!')
.setColor(0x0000FF)
// .setThumbnail(getRandomElement(settingsThumbnails))
.setThumbnail(`${process.env.WEBREDIRECT}/resources/${getRandomElement(settingsThumbnails)}`)
.setFooter({ text: `${interaction.client.user.username} by Farleena`, iconURL: `${interaction.client.user.displayAvatarURL({ dynamic: true })}` });

const row = new ActionRowBuilder()
.addComponents([settingsPageSelector]);
WEBREDIRECT is defined in .env WEBREDIRECT=https://kurumi.farleena.cc getRandomElement chooses from these: "settingsThumbnails": ["settingsThumbnails/mehnera-settings-1.png", "settingsThumbnails/mehnera-settings-2.png"], so an example complete link looks like this: https://kurumi.farleena.cc/resources/settingsThumbnails/mehnera-settings-2.png Yet as thumbnail it does not appear (the link might not always be available for you to check, the express runs along the bot and only alive when I am debugging the bot) actually, if I put a fixed, completed link in there, it also does not work.. maybe I serve the file wrong?
app.get('/resources/:subdirname/:filename', (request, response) => {
return response.sendFile(request.params.filename, { root: path.join(path.resolve(__dirname, '..'), 'resources/pics', request.params.subdirname) });
});
app.get('/resources/:subdirname/:filename', (request, response) => {
return response.sendFile(request.params.filename, { root: path.join(path.resolve(__dirname, '..'), 'resources/pics', request.params.subdirname) });
});
Want results from more Discord servers?
Add your server