Reputation: 19
const Discord = require('discord.js');
const client = new Discord.Client();
client.on('ready', () => {
console.log('Succesfully contacted the server.');
});
client.on('message', message => {
if (!user.bot) {
message.delete()
.then(message.reply('nope.'));
}
});
client.login('Nope');
When I say something in discord chat I get the error in the console "ReferenceError: user is not defined."
Upvotes: 0
Views: 4597
Reputation: 638
You're getting the error ReferenceError: user is not defined.
because you haven't defined user
, surprisingly enough.
client.on('message', message => {
let user = message.author;
if (!user.bot) {
message.delete()
.then(message.reply('nope.'));
}
});
Upvotes: 2