Sending file without file

Hello, i want to send a string as a file, how can i do that?
8 Replies
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Kryp Arnold
Kryp ArnoldOP3y ago
sometimes when you have more than 2000 characters in a message discord converts it to a file how can i do that on a bot
MrMythical
MrMythical3y ago
new AttachmentBuilder(Buffer.from(text)) and send it as a file
Kryp Arnold
Kryp ArnoldOP3y ago
i'll try it
Kryp Arnold
Kryp ArnoldOP3y ago
Kryp Arnold
Kryp ArnoldOP3y ago
it gives that error and here is my code
bot.on(Events.MessageCreate, async message => {
if(message.author.bot)return;
const content = "string content";
const att = new AttachmentBuilder(Buffer.from(content))
await message.channel.send({content:"file",attachments:[att]})
});
bot.on(Events.MessageCreate, async message => {
if(message.author.bot)return;
const content = "string content";
const att = new AttachmentBuilder(Buffer.from(content))
await message.channel.send({content:"file",attachments:[att]})
});
MrMythical
MrMythical3y ago
files: [att]
Kryp Arnold
Kryp ArnoldOP3y ago
ohh thank you so much

Did you find this page helpful?