This's my code below, I have tried enabling Intents from the developer portal, and I've checked the channel permissions, and my node version is running on v16.14.2, and still, it doesn't send any messages for some reason.
const { Client, Intents } = require("discord.js");
const { token } = require("./config.json");
const client = new Client({
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MEMBERS, Intents.FLAGS.DIRECT_MESSAGE_REACTIONS, Intents.FLAGS.GUILD_MESSAGES],
});
client.on("ready", () => {
console.log("Ready");
});
client.on("messageCreate", (message) => {
if (message === "ping") {
message.reply({
content: "pong",
});
}
});
client.login(token);
CodePudding user response:
You are comparing an object with a string, the error is in your if() statement:
if(message.content=='ping'){
message.reply('pong')
}