I am trying to build a small Discord bot, but it can’t read/acces messages.
The bot has all permissions, but I had to initialise the client like this
const Client = new Discord.Client({intents: ["AutoModerationConfiguration"]});
because else the Bot would crash.
const Discord = require("discord.js");
const client = new Discord.Client();
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});
client.on('message', msg => {
console.log('Message received')
if (msg.content === 'ping') {
msg.reply('Pong!');
}
});
Client.login('Token');
I added code that would log any sent messages, even if they aren’t a command, but the Bot doesn’t log anything.
Do I need to initialise the client in a different way?