monorepo/apps/bot/.sapphire/templates/interaction-handlers/select-menu-interaction-handler.ts
2024-12-09 12:01:58 +00:00

21 lines
816 B
TypeScript

import { ApplyOptions } from '@sapphire/decorators';
import { InteractionHandler, InteractionHandlerTypes } from '@sapphire/framework';
import type { StringSelectMenuInteraction } from 'discord.js';
@ApplyOptions<InteractionHandler.Options>({
interactionHandlerType: InteractionHandlerTypes.SelectMenu
})
export class MenuHandler extends InteractionHandler {
public override async run(interaction: StringSelectMenuInteraction) {
await interaction.reply({
// Remember how we can have multiple values? Let's get the first one!
content: `You selected: ${interaction.values[0]}`
});
}
public override parse(interaction: StringSelectMenuInteraction) {
if (interaction.customId !== 'my-echo-select') return this.none();
return this.some();
}
}