Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Get the text of a description in an embed

My goal is to send a message in 2 text channels.
Instead of copying/pasting the same message, I would like to be able to get the description of the first embed and then put it in the following ones.

I tried to get the text of the description of the first embed via maintenanceEmbed.description but it sends me back undefined

    async execute(interaction, client) {
      await interaction.deferReply({ fetchReply: true, ephemeral: true });
      const { options } = interaction;
      const commentaire = options.getString("commentaire");

      const statutChannel = client.channels.cache.get(process.env.statutmc);
      const chatChannel = client.channels.cache.get(process.env.chatmc);

      if (interaction.options.getString('statut') === 'maintenance') {
        const attachmentImage = new AttachmentBuilder("./src/database/img/info.png");
        const maintenanceEmbed = new EmbedBuilder()
          .setColor("#FAA619")
          .setAuthor({ name: "Maintenance", iconURL: "attachment://info.png" })
          .setDescription(`Le serveur fermera ces portes dans quelques instants pour cause de maintenance.\n ${commentaire}`);
        await statutChannel.send({ files: [attachmentImage], embeds: [maintenanceEmbed] });

        await chatChannel.send({ content: `>>> 🟠 ${maintenanceEmbed.description}`});
      };
      if (interaction.options.getString('statut') === 'arret') {
  
      };
      if (interaction.options.getString('statut') === 'actif') {
  
      };

      const gifSucess = new AttachmentBuilder("./src/database/img/tada.gif");
      const confirmationEmbed = new EmbedBuilder()
        .setColor("#43B17E")
        .setAuthor({ name: "Effectuée avec succès !", iconURL: "attachment://tada.gif" })
      return interaction.editReply({ files: [gifSucess], embeds: [confirmationEmbed], ephemeral: true });
  },

Thank you for your help ! 🦊

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Change this

exampleEmbed.description

to this

exampleEmbed.data.description
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading