if (message.content.startsWith(prefix + “give”)) {
let member = message.guild.member(message.mentions.users.first());
if (!member) return;
const selectedAmount = args.slice(1).join(’ ')
var idUser1 = message.author.id;
var idGuild1 = message.guild.id;
var idBoth1 = idUser1 + idGuild1;var idUser2 = member.id;
var idBoth2 = idUser2 + idGuild1;
//if (idUser1 === idUser2) return message.channel.send(You can't give that to yourself, you already have that amount at yourself.
);
setTimeout(function() {
if (selectedAmount > cashFile[idBoth1].wallet) {
message.reply(“You don’t have that much in your wallet!”)
return;
} else {
message.channel.send(Gave ${selectedAmount} to ${member.user.tag}
)
if (cashFile[idBoth2].wallet === 0) {
cashFile[idBoth2].wallet += selectedAmount
} else {
cashFile[idBoth2].wallet += selectedAmount
}
cashFile[idBoth1].wallet -= selectedAmount
fs.writeFile(“./cash.json”, JSON.stringify(cashFile), err => {
if (err) console.log(err);
})
}
}, 5000)
}
{“207557174660956160479268202866540564”:{“wallet”:0,“bank”:100},“505135250242928650479268202866540564”:{“wallet”:0,“bank”:10}}
This is what my code is, the lowest part is the json file, however when it gives the currency TO the user it makes the “wallet” change to:
“wallet”:“0100”
I still cannot find a fix to this and getting/finding a fix to this would allow me to enabled 3 commands.