How to save data in the empty Array from message attachments? So I can send more attachments in one message Discord.js

Ras*_*onT 6 arrays message attachment node.js discord.js

How I can fill the empty array with attachments url, so I can send them all of them in one message? Because when I send use url varaible, same message will be sent several times depending on attachment numbers. This is what I tried so far, but I can't pass through this.. I'm out of ideas.

      message.attachments.forEach(attachment => {
        const url = attachment.url;
        if(url) {
        let links = []
        Array.from(message.attachments).forEach(links => console.log(links));
        const exampleEmbed = new MessageEmbed()
        .setColor('#ff0000')
        .setAuthor(lastMessage.author.username, message.author.avatarURL({ dynamic: true }))
        .setTitle(`(Report)Bug report from ` + lastMessage.author.username + `#` + lastMessage.author.discriminator)
        .setURL('https://discord.com/channels/' + lastMessage.guildId + '/' + lastMessage.channelId + '/' + lastMessage.id)
        .setDescription(lastMessage.content.replace(/^([^ ]+ ){2}/, '') + ' ' + links);
        client.channels.cache.get('ID').send({ embeds: [exampleEmbed] });
        }
      })
    }
  }
Run Code Online (Sandbox Code Playgroud)

Problem is I'm unable to fill links array with the urls , so then I can use them in the description, also links inside of .setDescription does not provide any value, it's just empty, so it seems that .forEach(links => console.log(links)); doesn't add anything to the let links = []

I was suggested to use this

Array
   .from(message.attachments)
   .forEach(...);

// Or

[...message.attachments]
   .forEach(...);
Run Code Online (Sandbox Code Playgroud)

Trying it with Array.from(message.attachments).forEach, however I can't figure out how to use it correctly, I'm completely confused from the another examples that I saw(general examples) Every help will be much appreciated..

Log from the Array.from(message.attachments).forEach(links => console.log(links));

[
  '924775808831197184',
  MessageAttachment {
    attachment: 'https://cdn.discordapp.com/attachments/924298360603672576/924775808831197184/bug1.gif',
    name: 'bug1.gif',
    id: '924775808831197184',
    size: 5314,
    url: 'https://cdn.discordapp.com/attachments/924298360603672576/924775808831197184/bug1.gif',
    proxyURL: 'https://media.discordapp.net/attachments/924298360603672576/924775808831197184/bug1.gif',
    height: 128,
    width: 128,
    contentType: 'image/gif'
  }
]
[
  '924775809040932945',
  MessageAttachment {
    attachment: 'https://cdn.discordapp.com/attachments/924298360603672576/924775809040932945/bug.gif',
    name: 'bug.gif',
    id: '924775809040932945',
    size: 5314,
    url: 'https://cdn.discordapp.com/attachments/924298360603672576/924775809040932945/bug.gif',
    proxyURL: 'https://media.discordapp.net/attachments/924298360603672576/924775809040932945/bug.gif',
    height: 128,
    width: 128,
    contentType: 'image/gif'
  }
]
[
  '924775808831197184',
  MessageAttachment {
    attachment: 'https://cdn.discordapp.com/attachments/924298360603672576/924775808831197184/bug1.gif',
    name: 'bug1.gif',
    id: '924775808831197184',
    size: 5314,
    url: 'https://cdn.discordapp.com/attachments/924298360603672576/924775808831197184/bug1.gif',
    proxyURL: 'https://media.discordapp.net/attachments/924298360603672576/924775808831197184/bug1.gif',
    height: 128,
    width: 128,
    contentType: 'image/gif'
  }
]
[
  '924775809040932945',
  MessageAttachment {
    attachment: 'https://cdn.discordapp.com/attachments/924298360603672576/924775809040932945/bug.gif',
    name: 'bug.gif',
    id: '924775809040932945',
    size: 5314,
    url: 'https://cdn.discordapp.com/attachments/924298360603672576/924775809040932945/bug.gif',
    proxyURL: 'https://media.discordapp.net/attachments/924298360603672576/924775809040932945/bug.gif',
    height: 128,
    width: 128,
    contentType: 'image/gif'
  }
]
Run Code Online (Sandbox Code Playgroud)

MrM*_*cal 1

如果您想填充一个links以邮件中所有附件 URL 命名的数组,请使用这个简单的单行代码

const links = message.attachments.map(a => a.url)
Run Code Online (Sandbox Code Playgroud)

这将获取邮件的所有附件,并将其与 URL 进行映射。