2017-12-27 2 views
0
const Discord = require('discord.js'); 
const testBot = new Discord.Client(); 
const config = require("./config.json"); 
const args = message.content.slice(prefix.length).trim().split(/ +/g); 
const command = args.shift().toLowerCase(); 


testBot.on("message", (message) => { 

    if(command === 'help') { 
     message.channel.send('ok'); 
     } else 
     if (command === 'hey') { 
     message.channel.send('yes?'); 
     } 

}); 

testBot.on('ready',() => { 
    console.log('I am ready!'); 
}) 


testBot.login("Secret"); 

が定義されていません。Discord.jsメッセージは私がNode.jsの初心者だ

このエラーはこれです。 'ReferenceError:メッセージが定義されていません'どうすれば修正できますか?

ありがとうございます。

答えて

0

は、私はあなたがこのような何かを試すことができますあなたの変数のメッセージがまだ

宣言されていないので、それはあると思いますか?

const Discord = require('discord.js'); 
const testBot = new Discord.Client(); 
const config = require("./config.json"); 

testBot.on("message", (message) => { 
    const args = message.content.slice(prefix.length).trim().split(/ +/g); 
    const command = args.shift().toLowerCase(); 
    if(command === 'help') { 
     message.channel.send('ok'); 
     } else 
     if (command === 'hey') { 
     message.channel.send('yes?'); 
     } 
}); 

testBot.on('ready',() => { 
    console.log('I am ready!'); 
}) 


testBot.login("Secret"); 

希望します。

関連する問題