remove "text-based-feature" improve messages service interface implement more features for fluxer
44 lines
1.0 KiB
TypeScript
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();
|