my discord.js bot has version 13.1.0, and my node's version is 16.7.0. I entered these commands in the terminal : npm init
to create package.json and npm install discord.js
to install discord package.
I writed the code in index.js, and I created config.json to put the token there.
When I run then the code it shows me 'Ready!' in the console and being online in Discord. I also can change the status and the activity of the bot without a problem. The problem here is the bot doesn't send or reply to a message.
Here's the code bellow
const { Client, Intents } = require('discord.js');
const { token } = require('./config.json');
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });
client.once('ready', () => {
console.log('Ready!');
});
client.on ('messageCreate', (message) => {
if (message.content === 'hello') {
message.reply('Hello')
};
});
client.login(token);
this's config.json's code just in case.
{
"token": "my_bot_token!"
}