discord.js message event code example

Example 1: discord.js listen for message

const Discord = require('discord.js');
const client = new Discord.Client();

client.on('message', message => {});

client.login(process.env.TOKEN);

Example 2: events.js:174 error discord.js

rm -rf node_modules
rm package-lock.json yarn.lock
npm cache clear --force
npm install

Example 3: discord js message

client.on("message", message => {
    if (message.content.toLowerCase() === 'Hello') {
        message.channel.send("**Hey! What's Up?**")
    }
})
// This Will Print "Hey! What's Up?" When Someone Says "Hello" //