Home > Enterprise >  Get the text of a description in an embed
Get the text of a description in an embed

Time:10-05

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: `>>>            
  • Related