#messageCreate event not firing after adding the interactionCreate event.

1 messages · Page 1 of 1 (latest)

sharp edge
#

Extra relevant information:

No intent changes between now and the old version.

Client constructor:

const myIntents = new Intents(
    Intents.FLAGS.GUILDS,
    Intents.FLAGS.GUILD_MESSAGES,
    Intents.FLAGS.DIRECT_MESSAGES,
    Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
    Intents.FLAGS.DIRECT_MESSAGE_REACTIONS
);

const client = new Client({ intents: myIntents, partials: ["CHANNEL"] });

Event code attached.
The console.log('DEBUG') also never triggers, despite the fact in my understanding it should be popping every time a message is sent in a server it is in.

client.once('ready', () => {
    // Triggers normally
});

client.on('interactionCreate', async interaction => {
    // Triggers normally
});

client.on('messageCreate', async message => {
    console.log('DEBUG'); // Never triggered for some reason????
    // Other code (Also never triggered)
});

client.on("error", (e) => console.error(e));
client.on("warn", (e) => console.warn(e));
process.on('unhandledRejection', (e) => console.error(e));

console.log(client) // When logging the client, it shows they are attached as expected

client.login(config.token);
cerulean galleon
#

do u havemessage content intent in dev portal?

sharp edge
#

Yes, but that doesn't go into effect until April 30th, so it doesn't affect stuff right now.

cerulean galleon
#

you stillneedit rn

sharp edge
#

No I wouldn't. And again, it is enabled.

cerulean galleon
#

does removing the interactionCreate event make messageCreate work?

sharp edge
#

I don't believe so. Let me test again to be sure.

cerulean galleon
#

alright

sharp edge
#

@cerulean galleon Just made sure, it does not.

sharp edge
#

Any ideas?

tawdry palm
sharp edge
weak domeBOT
#

Tag suggestion for @sharp edge from @tawdry palm:
Please add the following code to your code base outside of any other event listeners and provide the full log output relevant to your issue.

client
    .on("debug", console.log)
    .on("warn", console.log)

• Note: if you initialize your Client as bot or other identifiers you need to use these instead of client
• If the output is too long to post consider using a bin instead: gist | hasteb.in | sourceb.in | hastebin

sharp edge
#

If you'd read the event code snippet you'd know I already have those...

#

No errors or anything are output. Just the debug statement (and the code after it) is never triggered.

tawdry palm
#

Would be better as a code block or sourcebin

sharp edge
#

Yeah that's my probably my bad. Will update it to a code block in a sec

#

There updated it ^^

#

@tawdry palm AFK for now, dump whatever you think I should try and I'll ping you when I'm back ^^

tawdry palm
#

@sharp edge the only intent you get is GUILDS

#

The intents are supposed to be in an array

#
const myIntents = new Intents([
    Intents.FLAGS.GUILDS,
    Intents.FLAGS.GUILD_MESSAGES,
    Intents.FLAGS.DIRECT_MESSAGES,
    Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
    Intents.FLAGS.DIRECT_MESSAGE_REACTIONS
]);
sharp edge
scarlet crescent
#

I have the same issue

#

My /events/messageCreate.js file:

module.exports = (client, message) => {
  console.log('test')
};

My index.js file:

/** Registering Events -- Start */
const events = fs
  .readdirSync("./events")
  .filter((file) => file.endsWith(".js"));
for (const file of events) {
  const eventName = file.split(".")[0];
  const event = require(`./events/${file}`);
  client.on(eventName, event.bind(null, client));
}
/** Registering Events -- End */
scarlet crescent
sharp edge
#

Don't have it. Again though, it worked on the old version, so unless there were breaking changes that somehow didn't get into the patch notes...

scarlet crescent
#

I am also confused

sharp edge
#

(Old version being 13.x.x)

scarlet crescent
#

Mine was working yesterday

#

it somehow broke

sharp edge
#

Do you want to make another message in #djs-help-v14? Don't want to make it look like I'm being spammy

#

Oh that's strange then. Check your email, did Discord send anything about your token being reset?

scarlet crescent
#

no, my bot is working

#

just messageCreate isnt

#

interactions are as fine as they can be

sharp edge
#

Huh strange

#

Welllll looks like it's more or less the same problem I'm having so it might be related

scarlet crescent
#
/** Registering Events -- Start */
const events = fs
  .readdirSync("./events")
  .filter((file) => file.endsWith(".js"));
for (const file of events) {
  const eventName = file.split(".")[0];
  const event = require(`./events/${file}`);
  client.on(eventName, event.bind(null, client));
}
/** Registering Events -- End */
#

I might me doing something wrong here

#

but this same was working yesterday

#

so idk

sharp edge
#

Have you restarted your bot/made any changes anywhere since it broke?

scarlet crescent
#

yes

#

I did

#

I removed the code that registered message commands

#

but that cannot break anything

#

or shouldnt atleast

sharp edge
#

If you have git or anything like that, maybe try going back to old version and see if the issue continues?

scarlet crescent
#

I do but I dont use git tags

sharp edge
#

If it doesn't maybe we can both look at the changes we've made and try to find something in common

scarlet crescent
#

I can try to revert to an older git commit

scarlet crescent
#

maybe my event handler is broken?

#

oh wait

sharp edge
#

One sec my repository is public, I'll grab the commit that broke it

scarlet crescent
#

jesus christ

#

I realised

sharp edge
#

I don't use a event handler and it's still broken. Not sure

scarlet crescent
#

My bot didnt have any kind of permissions other than the slash command

#

like even thought it has message intent

#

but it didnt have permissions in my server to view specific channels

#

I could use slash commands but couldnt use the collectors

#

omg

sharp edge
#

Oh

#

Yeah that's kinda important

scarlet crescent
#

mine is working now, yay

sharp edge
#

Great

#

Weeelll cya then

#

..I'll stay here, suffering in debug land

scarlet crescent
#

Good luck man, debugging can be hard at times

sharp edge
#

Ty

scarlet crescent
#

I spent hours yesterday on this, today woke up and instantly figured out the problem.
So my suggestion, take some rest!

sharp edge
#

Problem is I've worked on it (on and off, like 1h 30m each) for 2 days now

#

But it is getting late, so I'll take your advice :)

#

Night!