import { InteractionHandler, InteractionHandlerTypes } from '@sapphire/framework';
import { ActionRowBuilder, ButtonInteraction, StringSelectMenuBuilder } from 'discord.js';
import { categoryEmbed } from '../../ui/contract/embedsContractSource';
import { categoryMenu } from '../../ui/contract/menusContractSource';
export class ActivateContract extends InteractionHandler {
public constructor(ctx: InteractionHandler.LoaderContext, options: InteractionHandler.Options) {
super(ctx, {
...options,
interactionHandlerType: InteractionHandlerTypes.Button
});
}
public override parse(interaction: ButtonInteraction) {
if (interaction.customId !== 'activate-button') return this.none();
return this.some();
}
public async run(interaction: ButtonInteraction) {
const row = new ActionRowBuilder<StringSelectMenuBuilder>().addComponents(categoryMenu);
await interaction.update({
embeds: [categoryEmbed],
components: [row],
});
}
}
export default ActivateContract;
import { InteractionHandler, InteractionHandlerTypes } from '@sapphire/framework';
import { ActionRowBuilder, ButtonInteraction, StringSelectMenuBuilder } from 'discord.js';
import { categoryEmbed } from '../../ui/contract/embedsContractSource';
import { categoryMenu } from '../../ui/contract/menusContractSource';
export class ActivateContract extends InteractionHandler {
public constructor(ctx: InteractionHandler.LoaderContext, options: InteractionHandler.Options) {
super(ctx, {
...options,
interactionHandlerType: InteractionHandlerTypes.Button
});
}
public override parse(interaction: ButtonInteraction) {
if (interaction.customId !== 'activate-button') return this.none();
return this.some();
}
public async run(interaction: ButtonInteraction) {
const row = new ActionRowBuilder<StringSelectMenuBuilder>().addComponents(categoryMenu);
await interaction.update({
embeds: [categoryEmbed],
components: [row],
});
}
}
export default ActivateContract;