Add inventory button event

This commit is contained in:
Ethan Lane 2023-12-20 18:37:06 +00:00
parent 95ed90b916
commit bbe8f0d4d8
2 changed files with 20 additions and 1 deletions

View file

@ -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 ],
});
}
}

View file

@ -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());
}
}