'Discord bot wont respond to messages sent in dms
I have setup all of the required intents including DIRECT_MESSAGES
though the client messageCreate event doesn't appear to be picking up the command and responded now I checked the bot and the command does indeed work in the guild but for some reason not in dms.
My code block
client.on('messageCreate', (message) => {
if (message.author.bot) return;
const msg = message
const args = message.content.slice(1).split(/ +/)
const args2 = message.content.split(/ +/)
if (msg.content.toLowerCase() === '!resetverify') {
if (!message.author.id === '853322763930828800') return
db.set("verifyTicketAmount", 0)
message.reply('Cleared')
}
})
Solution 1:[1]
Make sure you have the right intents, I personally use the "all intents" like below
const bot = new Client({
intents: 131071,
partials: ['CHANNEL', 'GUILD_MEMBER', 'GUILD_SCHEDULED_EVENT', 'MESSAGE', 'REACTION', 'USER']
})
You can see all the intents here: Intents
or use 131071 for all of them
Updated intents include all new intents, 32767 no longer includes all of them
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |