From 95ed90b916e0778c19e88bfc78319384a3dd566e Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Wed, 20 Dec 2023 18:33:07 +0000 Subject: [PATCH] Create inventory command --- src/client/client.ts | 6 +----- src/commands/inventory.ts | 6 ++++++ src/registry.ts | 2 ++ 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/client/client.ts b/src/client/client.ts index 5dee253..85ef43e 100644 --- a/src/client/client.ts +++ b/src/client/client.ts @@ -84,11 +84,7 @@ export class CoreClient extends Client { console.log(`Registered Events: ${CoreClient._eventItems.flatMap(x => x.EventType).join(", ")}`); console.log(`Registered Buttons: ${CoreClient._buttonEvents.flatMap(x => x.ButtonId).join(", ")}`); - const page = await InventoryHelper.GenerateInventoryPage('125776189666230272', 0); - - console.log(page); - - // await super.login(process.env.BOT_TOKEN); + await super.login(process.env.BOT_TOKEN); } public static RegisterCommand(name: string, command: Command, environment: Environment = Environment.All, serverId?: string) { diff --git a/src/commands/inventory.ts b/src/commands/inventory.ts index 37b23c8..047a898 100644 --- a/src/commands/inventory.ts +++ b/src/commands/inventory.ts @@ -1,5 +1,6 @@ import { CommandInteraction, SlashCommandBuilder } from "discord.js"; import { Command } from "../type/command"; +import InventoryHelper from "../helpers/InventoryHelper"; export default class Inventory extends Command { constructor() { @@ -11,6 +12,11 @@ export default class Inventory extends Command { } public override async execute(interaction: CommandInteraction) { + const embed = await InventoryHelper.GenerateInventoryPage(interaction.user.username, interaction.user.id, 0); + await interaction.reply({ + embeds: [ embed.embed ], + components: [ embed.row ], + }); } } \ No newline at end of file diff --git a/src/registry.ts b/src/registry.ts index e602198..fc14bdb 100644 --- a/src/registry.ts +++ b/src/registry.ts @@ -4,6 +4,7 @@ import { CoreClient } from "./client/client"; import About from "./commands/about"; import Drop from "./commands/drop"; import Gdrivesync from "./commands/gdrivesync"; +import Inventory from "./commands/inventory"; import Resync from "./commands/resync"; // Test Command Imports @@ -21,6 +22,7 @@ export default class Registry { CoreClient.RegisterCommand('about', new About()); CoreClient.RegisterCommand('drop', new Drop()); CoreClient.RegisterCommand('gdrivesync', new Gdrivesync()); + CoreClient.RegisterCommand('inventory', new Inventory()); CoreClient.RegisterCommand('resync', new Resync()); // Test Commands