亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

類型錯誤:無法讀取未定義的不和諧的屬性“名稱.js命令處理程序

類型錯誤:無法讀取未定義的不和諧的屬性“名稱.js命令處理程序

臨摹微笑 2022-08-27 14:09:03
好吧,所以我得到了一個錯誤,這個工作就在昨天,它突然壞了.....現在這是錯誤/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));};
查看完整描述

2 回答

?
紫衣仙女

TA貢獻1839條經驗 獲得超15個贊

好的,錯誤是我的項目由于某種原因沒有保存,所以我搞砸了evrything很好,但我只需要讓一切都再次保存。


查看完整回答
反對 回復 2022-08-27
?
千巷貓影

TA貢獻1829條經驗 獲得超7個贊

看起來您可能沒有定義 name 變量,請嘗試在代碼之前定義它,因為它在錯誤中返回未定義。


查看完整回答
反對 回復 2022-08-27
  • 2 回答
  • 0 關注
  • 102 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號