Attaching local image file to embed

const imageFile = new AttachmentBuilder(`../../assets/war_ranks/${warRank}.png`, { name: `${warRank}.png` });

            const embed= new EmbedBuilder()
            .setTitle(`[${tag}] ${name}`)
            .setDescription(`${desc}`)
            .setThumbnail(`attachment://${imageFile.name}`);
            
            await interaction.channel.send({ embeds: [embed], files: [imageFile] });


Errors:
CombinedError (2)
  Received one or more errors

  1 ValidationError > s.nullish
  |   Expected undefined or null
  |
  |   Received:
  |   | 'attachment://Platinum 4.png'

  2 ExpectedConstraintError > s.string.url
  |   Invalid URL
  |
  |   Expected: expected to match a URL
  |
  |   Received:
  |   | 'attachment://Platinum 4.png'
Was this page helpful?