Sending a JSON file as an attachment through a bot
Is it possible to send a JSON file or any file that isn't an image for that matter using discord.js? If so, how?
8 Replies
Should be exactly the same?
you should be able to with
new MessageAttachment()
since it accepts a bufferMake an attachment using the file/buffer of the data and send it
Is that not working for you?
So I'd need to do
Buffer.from(JSON.stringify(obj))
right?well that should work fine
I was trying with just the raw JSON object and it didn't work, maybe that's why
If you're doing from in-memory data yeah
I think that's correct since that's how you'd print it to file
Might want to pretty it too, idk
yeah that worked, thanks lads!