我無法讓它工作。這是我的主文件:const fs = require('fs'); bot.commands = new Discord.Collection(); const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js')); for(const file of commandFiles) { const command = require(./commands/${file}); bot.commands.set(command.name, command); } if (message.content == 'ping' || message.content == 'Ping') { //message.channel.send('Pong'); bot.commands.get('ping').execute(message);和我的文件平.js:module.exports = { name: 'test', description: "Tester ting", execute(message, args) { message.channel.send("STOR TEST") }}我收到此錯誤:UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'execute' of undefined我試圖讓我的機器人來拯救我:-)
迪克機器人。JS 無法讀取未定義的屬性“執行”
慕森卡
2022-09-29 15:24:50