[英]Discord.js | When I attempt to run my Discord.js command, it will spit out an error “Cannot read property 'execute' of undefined”
[英]node . when i press run nothing happens (discord.js)
为什么它不起作用? 我尝试重新安装应用程序并重新安装 npm install discord.js 并且我仍然面临它?
当我按下节点时,没有任何反应:
索引.js
const { Client, Intents } = require('discord.js');
const { token, prefix } = require('./config.json');
const client = new Client({
intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MESSAGES,
]
});
client.on('ready', () => {
console.log('the bot is ready')
})
client.on('messageCreate', message => {
if (message.content === prefix + 'hi') {
message.reply('hello')
}
})
client.login(token);
配置文件
{
"token": "TOKEN",
"prefix": "$"
}
这可能是因为您没有在 config.json 中提供有效的机器人令牌,我是对的,还是您在令牌字段中键入 TOKEN 来编辑它。
这是我目前能找到的唯一问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.