简体   繁体   English

Discord bot 不会响应在 dms 中发送的消息

[英]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.我已经设置了所有必需的意图,包括DIRECT_MESSAGES虽然客户端 messageCreate 事件似乎没有接收命令并响应现在我检查了机器人并且该命令确实在公会中工作,但由于某种原因不在 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')
    }
  })

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你可以在这里看到所有的意图: Intents

or use 131071 for all of them或全部使用 131071

Updated intents include all new intents, 32767 no longer includes all of them更新的意图包括所有新的意图,32767 不再包括所有新的意图

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM