#Image in Embed

10 messages · Page 1 of 1 (latest)

thin oasis
#
const { EmbedBuilder } = require('discord.js');
const { twiter } = require('../config.json');  

module.exports = {
  name: 'messageCreate',
  async execute(message) {
    const targetChannelId = twiter;  

    if (message.channel.id === targetChannelId && !message.author.bot) {
      try {
        const messageContent = message.content;

        await message.delete();

        const creationTimestamp = Math.floor(message.createdTimestamp / 1000);

        const embed = new EmbedBuilder()
          .setColor('#1DA1F2')  
          .setTitle(':bird: | Twitter')  
          .setDescription(
            `**Użytkownik:** __<@${message.author.id}>__ wysłał nową wiadomość 🔔\n\n` +
            `**Treść:** ${messageContent || 'Brak treści'}\n\n` +  
            `**Załącznik:** ${message.attachments.size > 0 ? message.attachments.first().url : 'Brak załączników'}`
          ) 
          .setFooter({ text: `LublinRP | Twitter` })
          .setTimestamp();

        await message.channel.send({ embeds: [embed] });

      } catch (error) {
        console.error('Błąd podczas przetwarzania wiadomości:', error);
      }
    }
  },
};

I have trouble to image. The code is when person sent something in channel the bot delete it and send embed, (and when person add image the bot will showup in the embed) <- there is the issiue, the bot is sending like image.png not the photo

sweet sapphireBOT
#
  • What's your exact discord.js npm list discord.js and node node -v version?
  • Not a discord.js issue? Check out #1081585952654360687.
  • 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!
  • Marked as resolved by OP
thin oasis
#

this is how its work today

#

And this is how its should work

polar tide
#

Well your putting it inside the description, so it shows the link

cyan prismBOT
polar tide
#

Set it as an image to the embed ^

wheat linden
#

And you also delete the message containing the image so the image gets deleted too. Need to reupload it with your message before deleting the message from the user

kind ivy
lusty mesa