繁体   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