簡體   English   中英

類型錯誤:makeUser 不是 function discord js V12

[英]TypeError: makeUser is not a function discord js V12

(node:9436) UnhandledPromiseRejectionWarning: TypeError: makeUser is not a function
您好,我嘗試為該人執行該命令時自動在名為 users.json 的 cfg 中添加 1 行創建一個命令,但這給了我這個錯誤。 同樣,當我將我的機器人更新為 discord.js V12 時,我收到了一個錯誤: TypeError: makeUser is not a function
這是代碼的一部分:

if (!config.servers.servidores.includes(args[4])) {
console.log(yellow + "[" + moment.tz("America/Sao_Paulo").format('HH:mm A') + "] " + red + `[DB]` + reset + ` ${msg.author.username} ` + l7yellow + `->` +  lightred + ` Configuração Errada` + reset + ` Status: ` + red + `Servidor` + reset)
const metodoembed = new Discord.RichEmbed()
  .setColor("#ff0000")
  .setTitle("Database Editor -> Atom")
  .setDescription("An `error` was identified when\nmodifying the database.")
  .addField('**Type:**', '```http\n' + 'Server' + '```', true)
  .addField('Solution:', 'Check the available\nservers in the database', true)
  .setThumbnail(`${msg.author.displayAvatarURL}`)
  .setTimestamp()
  .setFooter(`${msg.author.username}`, `${msg.author.displayAvatarURL}`);
return msg.channel.send(metodoembed); }
//
function updategive(file, json) {
  fs.writeFile(file, JSON.stringify(json, null, 2), "utf8", function(err) {
    console.log(purple + "[" + reset + moment.tz("America/Sao_Paulo").format('HH:mm A') + purple + "] " + `[🧮] Banco de Dados atualizado.`);
  });
}
if (!users[person]) {
  makeUser(person);
}
users[person].attackTime = time;
users[person].concurrents = conc;
users[person].servers = servers;
users[person].expire = moment(expire).unix();
updategive("users.json", users);
return msg.channel.send(responsegive);

}

此行中發生錯誤:

if (!users[person]) {
  makeUser(person);
}

您好,您似乎使用的是不存在的 function。 創建一個名為makeUser和參數user的 function 。 所以它應該看起來像這樣function makeUser(user) {...}

此外,如果您使用的是 discord.js v12,請確保將RichEmbed替換為MessageEmbed

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM