[英]Discord.js + Node.js: SyntaxError: Unexpected token '{'
let user = message.mentions.users.first();
if (message.mentions.users.size < 1) return message.reply('Вы должны упомянуть кого-нибудь, чтобы выдать АРы.').catch(console.error);
mcash[${user.id}, ${message.guild.id}].mcash++;
fs.writeFile("./usercash.json", JSON.stringify(mcash), err => {
if(err) throw err;
});
member.roles.cache.has('899099537979899924');
member.roles.cache.some(role => role.name === 'Банкир');
let pcash = args.slice(1).join(" ");
if(!pcash) pcash = "Не указана"
const embed = new Discord.MessageEmbed()
.setDescription('Пополнение из банка:', alert(mcash))
.setThumbnail('https://media.discordapp.net/attachments/899085238955806742/899102776263573574/200.png?width=180&height=180')
message.author.send( {embeds:[embed] });
}});
The code must retain the amount entered along with the mention.
代码必须保留与提及一起输入的金额。 Further, the value that was written earlier was added to the variable, but an error is displayed.
此外,先前写入的值已添加到变量中,但会显示错误。
mcash[${user.id}, ${message.guild.id}].mcash++;
The usage of ${}
only function inside of a template literal , the use of it isn't needed here, so it can be changed to: ${}
的用法只在模板字面量内部起作用,这里不需要使用它,所以可以改为:
mcash[user.id, message.guild.id].mcash++;
Note: the whole function is not given, this may be only a portion of the solution.注意:没有给出整个函数,这可能只是解决方案的一部分。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.