2017-08-19 4 views
0
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'); 

私は不和のチャットで何かを言うと、私はコンソールでエラー "ReferenceError:ユーザーは定義されていません。"Discord.jsのuser.botが定義されていませんか?

答えて

1

驚くほど十分にuserを定義していないため、エラーReferenceError: user is not defined.が発生しています。

client.on('message', message => { 
    let user = message.author; 
    if (!user.bot) { 
     message.delete() 
      .then(message.reply('nope.')); 
    } 
}); 
+0

ええと、ウェブサイトのドキュメントには、ユーザーを定義する必要があるとは言えませんでした。助けてくれてありがとう:D –

関連する問題