Accessing direct messages?
Hi I am trying to see whenever my bot was DM'ed and then send the dm to myself , the first part I was testing for this was just alerting when a DM wa receieved but for some reason its not working? My code:
const { Client, IntentsBitField, Message, InteractionCollector, DMChannel } = require('discord.js');
require('dotenv').config()
const client = new Client({
intents: [
IntentsBitField.Flags.Guilds,
IntentsBitField.Flags.GuildMembers,
IntentsBitField.Flags.GuildMessages,
IntentsBitField.Flags.MessageContent,
]
});
client.on('messageCreate', message => {
if (message.channel.type === 1) {
console.log('Dm recieved!');
}
});