¿Cómo envío un archivo txt en discord.js como archivo adjunto? Como esto:
He probado el siguiente código:
let content = nsOpts.Tcontent fs.writeFileSync('./nosleep.txt', content) let atc = new discord.MessageAttachment('nosleep.txt') interaction.channel.send('here ya go,', { files: [atc, 'nosleep.txt', './nosleep.txt', 'attachment://nosleep.txt']})
Pero el bot solo envía el mensaje, no el archivo.
Gracias
Prueba esto.
const fs = require('fs'); var atc = fs.readFileSync('./nosleep.txt', {"encoding": "utf-8"});