Create list effects command #412
2 changed files with 35 additions and 0 deletions
33
src/buttonEvents/Effects.ts
Normal file
33
src/buttonEvents/Effects.ts
Normal file
|
@ -0,0 +1,33 @@
|
|||
import {ButtonInteraction} from "discord.js";
|
||||
import {ButtonEvent} from "../type/buttonEvent";
|
||||
import EffectHelper from "../helpers/EffectHelper";
|
||||
|
||||
export default class Effects extends ButtonEvent {
|
||||
public override async execute(interaction: ButtonInteraction) {
|
||||
const action = interaction.customId.split(" ")[1];
|
||||
|
||||
switch (action) {
|
||||
case "list":
|
||||
await this.List(interaction);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private async List(interaction: ButtonInteraction) {
|
||||
const pageOption = interaction.customId.split(" ")[2];
|
||||
|
||||
const page = Number(pageOption);
|
||||
|
||||
if (!page) {
|
||||
await interaction.reply("Page option is not a valid number");
|
||||
return;
|
||||
}
|
||||
|
||||
const result = await EffectHelper.GenerateEffectEmbed(interaction.user.id, page);
|
||||
|
||||
await interaction.update({
|
||||
embeds: [ result.embed ],
|
||||
components: [ result.row ],
|
||||
});
|
||||
}
|
||||
}
|
|
@ -26,6 +26,7 @@ import Droprarity from "./commands/stage/droprarity";
|
|||
|
||||
// Button Event Imports
|
||||
import Claim from "./buttonEvents/Claim";
|
||||
import EffectsButtonEvent from "./buttonEvents/Effects";
|
||||
import InventoryButtonEvent from "./buttonEvents/Inventory";
|
||||
import MultidropButtonEvent from "./buttonEvents/Multidrop";
|
||||
import Reroll from "./buttonEvents/Reroll";
|
||||
|
@ -65,6 +66,7 @@ export default class Registry {
|
|||
|
||||
public static RegisterButtonEvents() {
|
||||
CoreClient.RegisterButtonEvent("claim", new Claim());
|
||||
CoreClient.RegisterButtonEvent("effects", new EffectsButtonEvent());
|
||||
CoreClient.RegisterButtonEvent("inventory", new InventoryButtonEvent());
|
||||
CoreClient.RegisterButtonEvent("multidrop", new MultidropButtonEvent());
|
||||
CoreClient.RegisterButtonEvent("reroll", new Reroll());
|
||||
|
|
Loading…
Reference in a new issue