ChainsawXIV
ChainsawXIV
DIdiscord.js - Imagine ❄
Created by ChainsawXIV on 1/16/2025 in #djs-questions
messageCreate isn't firing
I'm not getting messageCreate triggers when a message is sent in a chat channel. To cover items from similar questions: - I've triple-checked my intents (see below) - I've got the "partials" thing in the code - The bot is in the server (/commands work) - The bot has access to all (one) channels - Perms are properly set in the bot portal Relevant Code:
// create a new Client instance
const discord_client = new Client({
intents: [
GatewayIntentBits.DirectMessages,
GatewayIntentBits.DirectMessageReactions,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.DirectMessageTyping,
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMessageTyping,
GatewayIntentBits.MessageContent,
],
partials: [
Partials.Message,
Partials.Channel,
]
});

// listen for the client to be ready
discord_client.once(Events.ClientReady, (c) => {
console.log(`Ready! Logged in as ${c.user.tag}`);
});

// listen for general chat and respond
discord_client.on(Events.MessageCreate, async interaction => {
console.log(`Responding to chat in ${interaction.channelId}`);
});
// create a new Client instance
const discord_client = new Client({
intents: [
GatewayIntentBits.DirectMessages,
GatewayIntentBits.DirectMessageReactions,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.DirectMessageTyping,
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMessageTyping,
GatewayIntentBits.MessageContent,
],
partials: [
Partials.Message,
Partials.Channel,
]
});

// listen for the client to be ready
discord_client.once(Events.ClientReady, (c) => {
console.log(`Ready! Logged in as ${c.user.tag}`);
});

// listen for general chat and respond
discord_client.on(Events.MessageCreate, async interaction => {
console.log(`Responding to chat in ${interaction.channelId}`);
});
The log from the ClientReady event is seen as expected, but the log from MessageCreate never shows up at all. Unless I'm totally understanding things, I should see that log every time someone writes something in the server where the bot is present, right?
25 replies