'discord js v13 message reply don't work (prefix)

I was making discord bot that reply the user word with prefix. example the user said !Hello the bot will reply with Hello

The error was (node:11208) DeprecationWarning: The message event is deprecated. Use messageCreate instead (Use node --trace-deprecation ... to show where the warning was created)

So I changed the code message to messageCreate but the bot didn't reply either and have no error in the console log what should I change the code of my script?

this is the source code prefix is ! (It is in the config.json)

index.js

const {Client,Intents,Collection} = require("discord.js");
const client = new Client ({intents:[Intents.FLAGS.GUILDS,Intents.FLAGS.GUILD_MESSAGES,Intents.FLAGS.GUILD_MEMBERS]})
const fs = require("fs");
const { token, prefix } = require("./config.json");
client.commands = new Collection();


const commandFiles = fs.readdirSync("./commands").filter((file) => file.endsWith(".js")); 

 var data = []
for(const file of commandFiles) {
    const command = require(`./commands/${file}`);  
    client.commands.set(command.name, command);
     data.push({name:command.name,description:command.description,options:command.options});

}

client.once('ready', async () =>{ 
    console.log(`Logged in as ${client.user.tag}`)
    // await client.guilds.cache.get('874178319434801192')?.commands.set(data)

    setInterval(() => {
        const statuses = [
            'mimc!',
            'wtf',
            'prefix = !'
        ]
        const status = statuses[Math.floor(Math.random()*statuses.length)] 
        client.user.setActivity(status, {type: "PLAYING"})
    }, 10000) 

});

client.on("messageCreate", (message) =>{ 
    if(!message.content.startsWith(prefix) || message.author.bot) return;

    const args = message.content.slice(prefix.length).trim().split(/ +/); 
    const command = args.shift(); 

    if(!client.commands.has(command)) return;

    try{ 
        client.commands.get(command).execute(message, args);
    }
    catch(error){
        console.error(error);
    }

});

client.login(token)

Hello.js (in the folder of commands)

module.exports = {
name: "Hello",
description: "Say Hi",
execute(message) {
    return message.channel.send(`${message.author}, Hello.`)
},
};


Solution 1:[1]

The code of index.js (or main file) goes by:


  const {Client, Intents, MessageEmbed, Presence, Collection, Interaction}= require ('discord.js')
const client = new Client({intents:[Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES]})
const TOKEN = ''// get your TOKEN!
const PREFIX = '!'
const fs = require('fs')

    client.commands = new Collection();
    const commandFiles = fs.readdirSync('commands').filter(file => file.endsWith('.js'));

    for (const file of commandFiles) {
    const command = require(`./commands/${file}`);
    client.commands.set(command.name, command);
    }
    
    client.on('ready', ()=> {
   console.log('? I am online!!')
   client.user.setActivity('A GAME ', {type: ('PLAYING')})
   client.user.setPresence({
       status: 'Online'
        })
      }) 

    client.on('message', message => {
        if(!message.content.startsWith(PREFIX)|| message.author.bot) return 
        const arg = message.content.slice(PREFIX.length).split(/ +/)
        const command= arg.shift().toLowerCase()
        if (command === 'ping'){
            client.commands.get('ping').execute(message,arg)

        }
       
   })
  
client.login(TOKEN)

After making a folder commands, add a new .js file, and name it as ping.js The code for ping.js goes by -



module.exports={
   name:'ping', 
   execute(message, arg){
       message.reply('hello!!')
   }
}

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1