How come my "message.reply" is not working (Discord.JS)


So I am learning discord.Js and I am trying to figure out why my message.reply function is not working. I created an event for the bot to listen to messages and when a message with the content of "hello" is sent it should reply with "hello buddy" here is the code:

require('dotenv').config()
const discord = require('discord.js')
const client = new discord.Client({
    intents: []
    
});


client.login(process.env.TOKEN);


client.on('ready', () => {
    console.log(`${client.user.tag} has logged in`);
});


client.on('message', function(message){
    if(message.content === 'hello') {
        message.reply('hello buddy')
    }
});

The bot in discord has all the permissions required to send messages in the server I am testing it in.

Source: JavaSript – Stack Overflow

November 25, 2021
Category : News
Tags: discord.js | javascript

Leave a Reply

Your email address will not be published. Required fields are marked *

Sitemap | Terms | Privacy | Cookies | Advertising

Senior Software Developer

Creator of @LzoMedia I am a backend software developer based in London who likes beautiful code and has an adherence to standards & love's open-source.