![](/img/trans.png)
[英]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.