#messageCreate isn't firing when bot receives a DM

30 messages · Page 1 of 1 (latest)

frank forge
#

I'm having the same problem. It responds to messages in servers but not DMs. I've declared the partials and intents:

    partials:
      - Message
      - Channel
      - Reaction
    intents:
      - DirectMessages
      - DirectMessageReactions
      - GuildMessages
      - GuildMessageReactions
      - Guilds
      - MessageContent
#

it was working fine in v13 but now in v14 it doesn’t

dull sluice
trail tangle
#

v13 uses screaming snake case strings as partials, v14 switched that to enums

frank forge
#

yeah I had to change these to match the case of v14 but like I said I could at least get it to work in v13

quartz bone
frank forge
#

Why is this thread archived already? It’s only been an hour since the last message.

When I have a bit more time later today, I’ll answer Qjuh’s question. I can’t right now, I just wanted to express my confusion over this being archived so quickly

frank forge
# quartz bone And how do you map that yaml to the ClientOptions?

Here's the full object that I pass to Client's constructor, in JavaScript:

{
  partials: [ 'Message', 'Channel', 'Reaction' ],
  intents: [
    'DirectMessages',
    'DirectMessageReactions',
    'GuildMessages',
    'GuildMessageReactions',
    'Guilds',
    'MessageContent'
  ],
  allowedMentions: { repliedUser: false }
}
#

I know this is going through because if I remove MessageContent from the intents list it stops responding on servers too

trail tangle
#

you are using strings instead of the Partials enum

trail tangle
frank forge
trail tangle
#

no idea how you pass the yaml file but you can access enum members at runtime

#

enums are just objects in js

frank forge
#

No I get that. But the config is part of a larger YAML file, it has been for a long time, I just use a library to convert the YAML to a JS object and then pass that off to the Client constructor

#

Why is it that intents can be strings but partials can't anymore?

trail tangle
#

because intents are a bitfield which resolves the input while partials is a plain array

frank forge
#

ah

rain badger
#

The bot used to respond to commands, even if the channel was a DM. Now it doesn't even fire the messageCreate event. Does anybody know how to fix this?

surreal aurora
#

you need the MessageContent and DirectMessages intent as well as the CHANNEL partial enabled

rain badger
#

How do I add partials to the client?

surreal aurora
#

partials key, quite verbosely named

rain badger
#

Are partials a new update? In the past week I have been able to receive bot DMs.

naive yarrow
#

I believe partials were introduced in v12

rain badger
#

Also, checking the channel.type === 'dm' isn't working anymore?

spring tulip
#

Import the ChannelType enum and use ChannelType.DM

rain badger
#

Okay