From db0c0fdf7314890569836046cdc36cb704f01aa2 Mon Sep 17 00:00:00 2001 From: ChrisChrome Date: Thu, 17 Aug 2023 18:37:15 -0600 Subject: [PATCH] Maybe thisll work --- commands.json | 16 +++++++++++++++- index.js | 4 +++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/commands.json b/commands.json index 3ae6074..205851a 100644 --- a/commands.json +++ b/commands.json @@ -40,7 +40,21 @@ { "name": "leaderboard", "description": "Cactus coins leaderboard", - "type": 1 + "type": 1, + "options": [ + { + "name": "type", + "description": "Optional leaderboard type", + "type": 3, + "required": false, + "choices": [ + { + "name": "Inverse", + "value": "ASC" + } + ] + } + ] }, { "name": "transfer", diff --git a/index.js b/index.js index cc289f4..492c21f 100644 --- a/index.js +++ b/index.js @@ -105,7 +105,9 @@ client.on("interactionCreate", async interaction => { }); break; case "leaderboard": - await db.all(`SELECT * FROM points ORDER BY points DESC`, async (err, rows) => { + // Get the type option, if its "inverted" then order by points ASC, if its not set then order by points DESC + let type = interaction.options.getString("type") || "DESC"; + await db.all(`SELECT * FROM points ORDER BY points ${type}`, async (err, rows) => { if (err) { console.error(err); }