Skip to content

Commit

Permalink
added /leaderboard (initial)
Browse files Browse the repository at this point in the history
  • Loading branch information
vb2007 committed Jul 27, 2024
1 parent 17b461d commit 49c67b8
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions commands/economy/leaderboard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
const { EmbedBuilder, SlashCommandBuilder } = require("discord.js");
const db = require("../../db");
const { logToFileAndDatabase } = require("../../logger");

module.exports = {
data: new SlashCommandBuilder()
.setName("leaderboard")
.setDescription("Check the users with the most money on the server.")
.addIntegerOption(option =>
option
.setName("amount")
.setDescription("The amount of top users to display.")
.setRequired(false)
)
.setDMPermission(false),
async execute(interaction) {
if(!interaction.inGuild()) {
var replyContent = "You can only check a member's balance in a server.";
}
else {

var embedReply = new EmbedBuilder({
color: 0x5F0FD6,
title: "Server leaderboard.",
description: replyContent,
timestamp: new Date().toISOString(),
footer: {
text: `Requested by: ${interaction.user.username}`,
icon_url: interaction.user.displayAvatarURL({ dynamic: true })
}
});

await interaction.reply({ embeds: [embedReply] });

//logging
const response = JSON.stringify(embedReply.toJSON());
await logToFileAndDatabase(interaction, response);
}
}
}

0 comments on commit 49c67b8

Please sign in to comment.