2017-12-27 9 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"); 

저는 node.js 초보입니다.Discord.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"); 

희망이 있습니다.