From 9a4c0815ad6a20cb54510b46b5620fb63d68f700 Mon Sep 17 00:00:00 2001 From: ChrisChrome Date: Sun, 13 Aug 2023 22:03:13 -0600 Subject: [PATCH] Whoops --- index.js | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/index.js b/index.js index ad5adb8..2a1d486 100644 --- a/index.js +++ b/index.js @@ -424,20 +424,12 @@ client.on("interactionCreate", async interaction => { } } // Check if they're in debt, if they are dont let them play - await db.get(`SELECT * FROM points WHERE id = '${interaction.user.id}'`, async (err, row) => { - if (err) { - console.error(err); - return interaction.reply({ - content: "An error occurred.", - ephemeral: true - }); - } - - if (row && row.points < 0) return interaction.reply({ - content: "You are in debt, you cannot play games until you pay it off.", - ephemeral: true - }); + balance = await checkPoints(interaction.user); + if (balance < 0) return interaction.reply({ + content: "You are in debt, you cannot play games until you are out of debt.", + ephemeral: true }); + let result = await playGame(interaction.options.getString("game")); await checkAndModifyPoints(interaction.user, result.difference); if (!gameCooldowns[interaction.user.id]) gameCooldowns[interaction.user.id] = {};