diff --git a/src/buttonEvents/Inventory.ts b/src/buttonEvents/Inventory.ts new file mode 100644 index 0000000..f1fc2ea --- /dev/null +++ b/src/buttonEvents/Inventory.ts @@ -0,0 +1,17 @@ +import { ButtonInteraction } from "discord.js"; +import { ButtonEvent } from "../type/buttonEvent"; +import InventoryHelper from "../helpers/InventoryHelper"; + +export default class Inventory extends ButtonEvent { + public override async execute(interaction: ButtonInteraction) { + const userid = interaction.customId.split(' ')[1]; + const page = interaction.customId.split(' ')[2]; + + const embed = await InventoryHelper.GenerateInventoryPage(interaction.user.username, userid, Number(page)); + + 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 fc14bdb..679c70e 100644 --- a/src/registry.ts +++ b/src/registry.ts @@ -1,4 +1,5 @@ import { CoreClient } from "./client/client"; +import { Environment } from "./constants/Environment"; // Global Command Imports import About from "./commands/about"; @@ -13,8 +14,8 @@ import Droprarity from "./commands/stage/droprarity"; // Button Event Imports import Claim from "./buttonEvents/Claim"; +import InventoryButtonEvent from "./buttonEvents/Inventory"; import Reroll from "./buttonEvents/Reroll"; -import { Environment } from "./constants/Environment"; export default class Registry { public static RegisterCommands() { @@ -36,6 +37,7 @@ export default class Registry { public static RegisterButtonEvents() { CoreClient.RegisterButtonEvent('claim', new Claim()); + CoreClient.RegisterButtonEvent('inventory', new InventoryButtonEvent); CoreClient.RegisterButtonEvent('reroll', new Reroll()); } } \ No newline at end of file