Maybe thisll work
This commit is contained in:
parent
5b96a8dc7a
commit
db0c0fdf73
|
@ -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",
|
||||||
|
|
4
index.js
4
index.js
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue