Thumbnails on embeds

This commit is contained in:
Andrew Lee 2024-02-14 23:11:21 -05:00
parent c180bd541a
commit f815095b28
Signed by: andrew
SSH key fingerprint: SHA256:bbGg1DYG5CuKl2jo1DqzvUsaTeyvhM3tjCsej5lYMg4

View file

@ -68,7 +68,7 @@ export async function playAudio(bot) {
const imageBuffer = Buffer.from(common.picture[0].data, 'base64');
// Create a new attachment using the buffer
audioPicture = new AttachmentBuilder(imageBuffer, 'albumArt.png');
audioPicture = new AttachmentBuilder(imageBuffer, { name: 'albumArt.png' });
}
} else {
metadataEmpty = true;
@ -105,15 +105,20 @@ export async function playAudio(bot) {
{ name: t('musicDuration'), value: `${duration}` }
);
// if (audioPicture) {
// statusEmbed.setThumbnail('attachment://albumArt.png');
// }
if (audioPicture) {
statusEmbed.setThumbnail('attachment://albumArt.png');
}
statusEmbed.setFooter({ text: t('playerFooter', { audioAlbum, audioFile }) });
statusEmbed.setColor('#0066ff');
}
const channel = bot.channels.cache.get(statusChannel);
if (!channel) return console.error(t('statusChannelError'));
return await channel.send({ embeds: [statusEmbed] });
if (audioPicture) {
return await channel.send({ embeds: [statusEmbed], files: [audioPicture] });
} else {
return await channel.send({ embeds: [statusEmbed] });
}
}
export function updatePlaylist(option) {