我正在使用discord.js v13构建这个不和谐的机器人,每次我运行我的代码(我完全没有从https://www.youtube.com/watch?v=JMmUW4d3Noc&t=614s中窃取)
这是我的代码: Package.json
"name": "Ceeby",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"discord.js": "^13.6.0",
"dotenv": "^16.0.0"
}
}Index.ts
import DiscordJS, { Intents, Message } from 'discord.js'
import dotenv from 'dotenv'
dotenv.config()
const client = new DiscordJS.Client({
intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MESSAGES,
]
})
client.on("ready", () => {
console.log("Ceeby Is Active")
})
client.on('messageCreate', (Message) =>{
if(Message.content === 'ping'){
Message.reply({
content: 'pong',
})
}
})
client.login(process.env.TOKEN).ENV文件
TOKEN=<THIS IS MY TOKEN HERE>我已经试过两次了,重新启动,重新安装所有的东西,但仍然是同样的问题。这是一个错误:“error:无法找到模块”节点:events“需要堆栈:
Mena\Desktop\Ceeby\node_modules\discord.js\src\client\BaseClient.js
发布于 2022-02-09 06:04:07
Discord.js V13需要一个大于16.9.0的节点版本,并且您正在运行一个比该版本更早的节点:事件是在节点V16+中引入的(不确定到底是哪个) https://github.com/discordjs/discord.js

https://stackoverflow.com/questions/71040550
复制相似问题