Yup
This commit is contained in:
parent
db0c0fdf73
commit
a039af4630
11
index.js
11
index.js
|
@ -107,6 +107,15 @@ client.on("interactionCreate", async interaction => {
|
||||||
case "leaderboard":
|
case "leaderboard":
|
||||||
// Get the type option, if its "inverted" then order by points ASC, if its not set then order by points DESC
|
// 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";
|
let type = interaction.options.getString("type") || "DESC";
|
||||||
|
// Switch type for the header of the embed
|
||||||
|
switch (type) {
|
||||||
|
case "DESC":
|
||||||
|
header = "Leaderboard";
|
||||||
|
break;
|
||||||
|
case "ASC":
|
||||||
|
header = "Inverted Leaderboard";
|
||||||
|
break;
|
||||||
|
}
|
||||||
await db.all(`SELECT * FROM points ORDER BY points ${type}`, async (err, rows) => {
|
await db.all(`SELECT * FROM points ORDER BY points ${type}`, async (err, rows) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
@ -127,7 +136,7 @@ client.on("interactionCreate", async interaction => {
|
||||||
}
|
}
|
||||||
interaction.reply({
|
interaction.reply({
|
||||||
embeds: [{
|
embeds: [{
|
||||||
title: "Leaderboard",
|
title: header,
|
||||||
description: leaderboard.join("\n"),
|
description: leaderboard.join("\n"),
|
||||||
color: 0x00ff00
|
color: 0x00ff00
|
||||||
}]
|
}]
|
||||||
|
|
Loading…
Reference in a new issue