2024-06-01 14:47:21 +01:00
|
|
|
import { CommandInteraction, EmbedBuilder, SlashCommandBuilder } from "discord.js";
|
|
|
|
import { Command } from "../type/command";
|
|
|
|
import User from "../database/entities/app/User";
|
|
|
|
import EmbedColours from "../constants/EmbedColours";
|
|
|
|
|
|
|
|
export default class Balance extends Command {
|
|
|
|
constructor() {
|
|
|
|
super();
|
|
|
|
|
|
|
|
this.CommandBuilder = new SlashCommandBuilder()
|
2024-06-03 18:43:18 +01:00
|
|
|
.setName("balance")
|
|
|
|
.setDescription("Get your currency balance");
|
2024-06-01 14:47:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public override async execute(interaction: CommandInteraction) {
|
|
|
|
const user = await User.FetchOneById(User, interaction.user.id);
|
|
|
|
|
2024-06-03 18:43:18 +01:00
|
|
|
const userBalance = user != null ? user.Currency : 0;
|
2024-06-01 14:47:21 +01:00
|
|
|
|
|
|
|
const embed = new EmbedBuilder()
|
|
|
|
.setColor(EmbedColours.Ok)
|
|
|
|
.setTitle("Balance")
|
|
|
|
.setDescription(`You currently have **${userBalance} currency**!`)
|
|
|
|
.setFooter({ text: interaction.user.username, iconURL: interaction.user.avatarURL() ?? undefined });
|
|
|
|
|
|
|
|
await interaction.reply({ embeds: [ embed ]});
|
|
|
|
}
|
|
|
|
}
|