I’m experiencing an issue with my Discord bot created with Node.js. The bot shows as online in my server, yet it doesn’t respond to any of my messages. I’ve spent a lot of time trying to identify the problem.
Here’s my current code:
const express = require("express");
const app = express();
app.listen(4000, () => {
console.log("Application is running smoothly!");
});
const Discord = require("discord.js");
const client = new Discord.Client({intents: ["GUILDS", "GUILD_MESSAGES"]});
client.on("messageCreate", message => {
if(message.content.toLowerCase() === "hello") {
message.channel.send("hi there!");
}
});
client.login(process.env.BOT_TOKEN);
I can see the bot is connected in my Discord server, but typing “hello” doesn’t yield any response. The console indicates that the server is functioning without any errors. What could be the reason behind this issue? Any advice would be greatly appreciated because I’m at a loss.
I encountered this exact problem when I first migrated to discord.js v14. The issue is with your intents configuration - you’re using the old string format instead of the new IntentsBitField format. Replace your client initialization with:
const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent]
});
The crucial part is adding MessageContent intent, which became mandatory for reading message content in newer versions. Without it, your bot can see messages but cannot access their actual content, making your condition check fail silently. This caught me off guard too since the bot appears online but just ignores everything.
Had a similar frustrating experience where my bot was online but completely unresponsive. Beyond the intent issues others mentioned, check if your bot actually has permission to read messages in the specific channel you’re testing. Even with correct intents in code and developer portal, channel-level permissions can block message access. Also verify your bot token hasn’t expired or been regenerated recently. One thing that helped me debug was adding a console.log inside the messageCreate event to see if it’s even firing - if nothing logs when you send messages, then it’s definitely an intent or permission problem rather than your message handling logic.
yup, ran into the same issue! you need to enable the MessageContent intent in the discord developer portal for your bot. just changing the code isn’t enough if that’s not set up. double-check your settings, it can be a real hassle.