Fetch an array of message IDs at once

Is there some sort of way to fetch multiple messages by
id
in a single request?
Kind of like
message.channel.messages.fetch([snowflake_one, snowflake_two])

I tried
interaction.channel.messages.fetch([1124766378705027212,1124766519826587670]).then(_ => console.log(_.size))

And it reports 50, which is a lot more than two lol

I basically create an array full of message ids, and I want to fetch them to get their content, author id, and displayname
But just running
messages.fetch(id)
for each one is very slow
This is what I've got right now, which is works, but is undesirable as it's very slow (many times slower requesting 3 specific IDs vs
limit
of 3)
// Fetch references from pins
let references = await Promise.all(pins.map(p => p.reference && message.channel.messages.fetch(p.reference.messageId)))
// Insert references before the relevant pin (working backwards to prevent indexes moving)
for (let i = pins.length - 1; i >= 0; i--)
    if(references[i]) pins.splice(i, 0, references[i])

It just turns an array of pins, into an array of pins and whatever they're replying to

I've read MessageManager.fetch(), but I don't really see what I'm looking for
Despite it saying that it accepts an array of options, and individual options can be snowflakes
discord.js
discord.js is a powerful Node.js module that allows you to interact with the Discord API very easily. It takes a much more object-oriented approach than most other JS Discord libraries, making your bot's code significantly tidier and easier to comprehend.
Was this page helpful?