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

@@ -19,6 +19,7 @@ import { existsSync } from "fs";
import { LootType, EffectType } from "@shared/lib/constants";
import type { LootTableItem } from "@shared/lib/types";
import { getRarityConfig, defaultName, stripQuery } from "@shared/lib/rarity";
import { SHOP_CUSTOM_IDS } from "./economy.types";
export function getShopListingMessage(
item: {
@@ -100,7 +101,7 @@ export function getShopListingMessage(
// Create buy button (used in either main or loot container)
const buyButton = new ButtonBuilder()
.setCustomId(`shop_buy_${item.id}`)
.setCustomId(SHOP_CUSTOM_IDS.BUY(item.id))
.setLabel(`Purchase for ${item.price} 🪙`)
.setStyle(ButtonStyle.Success)
.setEmoji("🛒");