refactor: centralize custom interaction IDs into constants

Replace all hardcoded custom ID strings with module-level constants.
Each module now has *_CUSTOM_IDS in its types file, using functions
for dynamic IDs and PREFIX for startsWith matching.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
syntaxbullet
2026-04-02 11:36:35 +02:00
parent 70d59a091a
commit 3c256ba0b2
27 changed files with 238 additions and 132 deletions

View File

@@ -1,3 +1,8 @@
export const PRUNE_CUSTOM_IDS = {
CONFIRM: "confirm_prune",
CANCEL: "cancel_prune",
} as const;
export interface PruneOptions {
amount?: number;
userId?: string;

View File

@@ -1,5 +1,5 @@
import { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, Colors } from "discord.js";
import type { PruneResult, PruneProgress } from "./prune.types";
import { PRUNE_CUSTOM_IDS, type PruneResult, type PruneProgress } from "./prune.types";
/**
* Creates a confirmation message for prune operations
@@ -25,12 +25,12 @@ export function getConfirmationMessage(
.setTimestamp();
const confirmButton = new ButtonBuilder()
.setCustomId("confirm_prune")
.setCustomId(PRUNE_CUSTOM_IDS.CONFIRM)
.setLabel("Confirm")
.setStyle(ButtonStyle.Danger);
const cancelButton = new ButtonBuilder()
.setCustomId("cancel_prune")
.setCustomId(PRUNE_CUSTOM_IDS.CANCEL)
.setLabel("Cancel")
.setStyle(ButtonStyle.Secondary);