Maybe thisll work

This commit is contained in:
Christopher Cookman 2023-08-17 18:37:15 -06:00
parent 5b96a8dc7a
commit db0c0fdf73
Signed by: ChrisChrome
GPG key ID: A023A26E42C33A42
2 changed files with 18 additions and 2 deletions

View file

@ -40,7 +40,21 @@
{ {
"name": "leaderboard", "name": "leaderboard",
"description": "Cactus coins 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", "name": "transfer",

View file

@ -105,7 +105,9 @@ client.on("interactionCreate", async interaction => {
}); });
break; break;
case "leaderboard": 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) { if (err) {
console.error(err); console.error(err);
} }