From f815095b28de01959c536850462566e9a37a01f3 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Wed, 14 Feb 2024 23:11:21 -0500 Subject: Thumbnails on embeds --- AudioBackend/PlayAudio.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/AudioBackend/PlayAudio.js b/AudioBackend/PlayAudio.js index 5c45418..a0cfb39 100644 --- a/AudioBackend/PlayAudio.js +++ b/AudioBackend/PlayAudio.js @@ -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) { -- cgit v1.2.3