Example code showing how to send file attachments in a Discord message. After installing this snippet, trigger it by typing "!file" to see the two text files in your channel.
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
await lib.discord.channels['@0.3.0'].messages.create({
channel_id: context.params.event.channel_id,
content: `Here are some uploaded files!`,
attachments: [{
filename: 'test.txt',
file: Buffer.from('Here is a text file!')
}, {
filename: 'test2.txt',
file: Buffer.from('You can use other file types too! Send them as buffers here.')
}]
});