import type { WaterMeService } from "@avocadi/bot-core/features/water-me/water-me.service"; import { ActionRowBuilder, ButtonBuilder, type ButtonInteraction, ButtonStyle, type ChatInputCommandInteraction, } from "discord.js"; import { waterMeService } from "./water-me.service"; class WaterMeController { waterMeService: WaterMeService; constructor() { this.waterMeService = waterMeService; } async handleInteraction( interaction: ButtonInteraction | ChatInputCommandInteraction, ) { const result = this.waterMeService.waterMe(); const moreButton = new ButtonBuilder() .setCustomId("moreWater") .setLabel("mehr") .setStyle(ButtonStyle.Secondary); const row = new ActionRowBuilder().addComponents(moreButton); if (interaction.isChatInputCommand()) { await interaction.reply({ content: result.reply, components: [row], }); } else if (interaction.isButton()) { await interaction.reply({ content: result.reply, }); } } } export const waterMeController = new WaterMeController();