28 lines
889 B
JavaScript
28 lines
889 B
JavaScript
const { SlashCommandBuilder } = require('discord.js');
|
|
const { DebugBuilder } = require("../utilities/debugBuilder");
|
|
const log = new DebugBuilder("server", "balance");
|
|
|
|
const { checkBalance } = require("../controllers/accountController");
|
|
|
|
module.exports = {
|
|
data: new SlashCommandBuilder()
|
|
.setName('balance')
|
|
.setDescription('Check your balance of AI tokens'),
|
|
example: "balance",
|
|
isPrivileged: false,
|
|
requiresTokens: false,
|
|
defaultTokenUsage: 0,
|
|
deferInitialReply: false,
|
|
async execute(interaction) {
|
|
try{
|
|
checkBalance(interaction.member.id, async (err, balance) => {
|
|
if (err) throw err;
|
|
|
|
await interaction.reply({ content: `${interaction.member.user}, you have ${balance} tokens remaining`, ephemeral: true })
|
|
})
|
|
}catch(err){
|
|
log.ERROR(err)
|
|
await interaction.reply(`Sorry ${interaction.member.user}, something went wrong`);
|
|
}
|
|
}
|
|
}; |