items part 1
This commit is contained in:
@@ -5,20 +5,18 @@ import type { CommandData } from "./index";
|
||||
import type { User } from "../db";
|
||||
import config from "../config.json";
|
||||
import { get_user } from "../db";
|
||||
import { BotError } from "./error";
|
||||
import { BotError } from "./common/error";
|
||||
|
||||
async function run(interaction: ChatInputCommandInteraction, user: User) {
|
||||
const options = interaction.options;
|
||||
const target = (await options.get("target"))?.user;
|
||||
let embeds = [];
|
||||
let bal_embed = new EmbedBuilder();
|
||||
let bal_target = target ?? interaction.user;
|
||||
let bal_user = target ? await get_user(target.id) : user;
|
||||
if (!bal_user) throw new BotError("Target is not registered"); //must be target
|
||||
bal_embed.setTitle(`${bal_target.tag}'s Balance`);
|
||||
bal_embed.setDescription(`${bal_user.balance} ${ bal_user.balance === 1 ? config.currency : config.currency_plural }`);
|
||||
embeds.push(bal_embed);
|
||||
return await interaction.editReply({ embeds });
|
||||
return await interaction.editReply({ embeds: [ bal_embed ] });
|
||||
}
|
||||
|
||||
const data: CommandData = {
|
||||
|
||||
Reference in New Issue
Block a user