this isn't working for me, check my code
const client = new discord.Client({
closeTimeout: 3_000 ,
waitGuildTimeout: 15_000,
intents: [
discord.GatewayIntentBits.Guilds,
discord.GatewayIntentBits.GuildMembers,
discord.GatewayIntentBits.GuildBans,
discord.GatewayIntentBits.GuildVoiceStates,
discord.GatewayIntentBits.GuildPresences,
discord.GatewayIntentBits.GuildMessages,
discord.GatewayIntentBits.GuildMessageTyping,
discord.GatewayIntentBits.MessageContent,
discord.GatewayIntentBits.DirectMessages,
discord.GatewayIntentBits.MessageContent,
discord.GatewayIntentBits.DirectMessageTyping
],
});
client.on("messageCreate", async message => {
if (!message.author.bot && message.channel.type === 'DM') {
await message.reply('Hello world!');
}
});
#discord message problem
5 messages · Page 1 of 1 (latest)
• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.
To receive direct message events on "messageCreate" with your bot, you will need:
• The DirectMessages gateway intent
• The Channel partial setting
I want if someone sends a message to the bot via dm, the bot can respond to it