错误“ const Discord = require(discord.js)^ ReferenceError:未定义discord”"/>
错误“ const Discord = require(discord.js)^ ReferenceError:未定义discord”
你好,所以我收到一个奇怪的错误,说这“ const Discord = require(discord.js) ^ReferenceError:未定义不和谐”这是我编写的代码,我是否在那里输入错误?
const Discord = require(discord.js)
const Client = new Discord.Client
const prefix = "/";
Client.on('ready', ()=>{
console.log('Bot is online.');
})
Client.on('message', (Message)=>{
if(!Message.content.startsWith(prefix)) return;
if(Message.content.startsWith(prefix + "hello")){
Message.channel.send("Hello.")
}
})
Client.login("<Token Here>");
回答如下:[导入/要求任何内容时,您必须将其作为字符串传递。您基本上试图将其作为变量传递。const Discord = require('discord.js')
更多推荐
错误“ const Discord = require(discord.js)^ ReferenceError:未定义discord”
发布评论