Files
bot/adapters/discord/src/features/water-me/water-me.controller.ts
enricobuehler 0a460800b6 refactor water me service
remove "text-based-feature"
improve messages service interface
implement more features for fluxer
2026-02-18 18:38:09 +01:00

44 lines
1.0 KiB
TypeScript

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<ButtonBuilder>().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();