Create simple inventory list #120
2 changed files with 20 additions and 1 deletions
17
src/buttonEvents/Inventory.ts
Normal file
17
src/buttonEvents/Inventory.ts
Normal 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 ],
|
||||
});
|
||||
}
|
||||
}
|
|
@ -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());
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue