我正在制作一个平衡系统,并创建了一个给定命令。每当我给某人一些钱(例如 10 美元)时,他们的余额就会显示为“10 美元 [object Promise]”。如何删除“[object Promise]”?
完整的命令代码:
if (command === 'give') {
if (!args[0]) return message.channel.send('how much are you gonna send?')
if (isNaN(args[0])) return message.channel.send('format: xd give [amount] [@user]')
const money = args[0];
const emb = new Discord.MessageEmbed()
.setColor('GRAY')
.setTitle('you gave them the $$')
.setDescription(`you gave ${message.mentions.users.first().username} the $$$$$$ (` + args[0] + ` to be exact)`)
.setTimestamp()
.setFooter('sent to pokimane');
message.channel.send(emb);
const money2 = moneyAmount - args[0];
if (isNaN(money2)) {
Number(money2);
}
moneydb.set(message.author.id, money2);
const uMA = moneydb.get(message.mentions.users.first().id);
const money3 = args[0] + uMA;
moneydb.set(message.mentions.users.first().id, money3);
}
// keyv connection
const moneydb = new Keyv('mysql://[user and pass]@localhost:3306/money');
连数据库最后都有[object promise]