multiple image attachments in one message

can i add multiple images to a single message, similar to how users may do it?
5 Replies
d.js toolkit
d.js toolkit11mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - 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
Syjalo
Syjalo11mo ago
Yes, add more files to the array
Lipton
LiptonOP11mo ago
it doesnt seem to accept it
const paths = [];
const imageFolder = fs.readdirSync(path.join(__dirname, '../../output'))

for (const file of imageFolder) {
paths.push(path.join(__dirname, `../../output/${file}`))
}
console.log(paths)
const channel = client.channels.cache.get('1208809020685553715');
channel.send({files: [{ attachment: paths }]});
});
const paths = [];
const imageFolder = fs.readdirSync(path.join(__dirname, '../../output'))

for (const file of imageFolder) {
paths.push(path.join(__dirname, `../../output/${file}`))
}
console.log(paths)
const channel = client.channels.cache.get('1208809020685553715');
channel.send({files: [{ attachment: paths }]});
});
TypeError [ReqResourceType]: The resource must be a string, Buffer or a valid file stream.
ahmood
ahmood11mo ago
{ files: paths } files takes an array of strings or Buffers or file stream
Lipton
LiptonOP11mo ago
worked, thanks!
Want results from more Discord servers?
Add your server