嗨,我得到了一个奇怪的错误,上面写着"const Discord = require(discord.js) ^ ReferenceError: discord is not defined“,这是我写的代码,有没有我放进去的错误?
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>");发布于 2020-09-01 18:28:06
你忘记了“or”in:
const Discord = require(discord.js)所以试试吧:
const Discord = require("discord.js");发布于 2020-08-26 20:24:26
在常量语法中定义某些内容时,必须始终使用“或”。
发布于 2020-05-14 10:29:53
试试这个:
const Discord = require('discord.js')https://stackoverflow.com/questions/61788232
复制相似问题