begin rewriting first services to be domain agnostic

more rewrites
This commit is contained in:
2026-02-17 22:42:36 +01:00
parent b3766b9584
commit 071fe2f891
45 changed files with 915 additions and 521 deletions

View File

@@ -0,0 +1,41 @@
import type { WaterMeService } from "@avocadi/bot-core/features/water-me/water-me.service";
import {
ActionRowBuilder,
ButtonBuilder,
ButtonStyle,
type CacheType,
type Interaction,
} from "discord.js";
import { waterMeService } from "./water-me.service";
class WaterMeController {
waterMeService: WaterMeService;
constructor() {
this.waterMeService = waterMeService;
}
async handleInteraction(interaction: Interaction<CacheType>) {
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();