Discord- DM user files

Does anyone know how to make a bot send files into someone’s DMs? For example a user to run !test and the bot DMs the user a file named “test.txt” and “test2.txt”?



1 Like

So do I just do
if(command === “test”) {
test.txt ?

No. You appear to be new to Javascript, I would recommend you actually learn the basics first.

The proper way to use the above references would be something like

const MessageAttachment = require('discord.js');

// inside your message event
if (command === 'test') {
files: [
new MessageAttachment('test.txt'),
new MessageAttachment('test2.txt'),
/* assuming you have the message variable 
defined as message, otherwise whatever you've
defined the message variable as.