好吧,所以我得到了一个错误,这个工作就在昨天,它突然坏了.....现在这是错误/app/handlers/command.js:8 bot.commands.set(pull.config.name, pull); ^TypeError: Cannot read property 'name' of undefinedat load (/app/handlers/command.js:8:42)at /app/handlers/command.js:12:75 at Array.forEach (<anonymous>)at module.exports (/app/handlers/command.js:12:62)at /app/index.js:16:72 at Array.forEach (<anonymous>)at Object.<anonymous> (/app/index.js:16:33) at Module._compile (internal/modules/cjs/loader.js:759:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10) at Module.load (internal/modules/cjs/loader.js:628:32)每个命令打开时显示module.exports = {config: {name: "command name"现在这里是命令处理程序中的代码const { readdirSync } = require("fs")module.exports = (bot) => { const load = dirs => { const commands = readdirSync(`./commands/${dirs}/`).filter(d => d.endsWith('.js')); for (let file of commands) { let pull = require(`../commands/${dirs}/${file}`); bot.commands.set(pull.config.name, pull); if (pull.config.aliases) pull.config.aliases.forEach(a => bot.aliases.set(a, pull.config.name)); }; }; ["currency", "fun", "holiday", "info", "moderation"].forEach(x => load(x));};
添加回答
举报
0/150
提交
取消