Fixed the 'balance' command

This commit is contained in:
ION606
2022-04-19 11:28:49 -04:00
parent e824977282
commit a7b909a015
3 changed files with 4 additions and 10 deletions
+1
View File
@@ -1,3 +1,4 @@
node_modules node_modules
config.json config.json
.env .env
.sqlite
+2 -9
View File
@@ -104,16 +104,9 @@ module.exports = {
} }
} }
} else if (command === 'balance') { } else if (command === 'balance') {
//BROKEN PLEASE FIX!!!
const target = message.author; const target = message.author;
let user = currency.get(target.id); currency.add(target.id, 0); //Make sure there's something
return message.reply(`${target.tag} has \$${currency.getBalance(target.id)}`);
//let user = await Users.findOne({ where: { user_id: message.author.id } });
if (!user) {
const newUser = await Users.create({ user_id: user, balance: 0 });
currency.set(target.id, newUser);
} else { console.log(user); }
return message.reply(`${target.tag} has \$${currency.getBalance(target)}`);
} else if (command === 'inventory') { } else if (command === 'inventory') {
const target = message.author; const target = message.author;
const user = await Users.findOne({ where: { user_id: target.id } }); const user = await Users.findOne({ where: { user_id: target.id } });
BIN
View File
Binary file not shown.