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:
@@ -3,6 +3,7 @@ import { inventoryService } from "@shared/modules/inventory/inventory.service";
|
||||
import { getLootboxResultMessage } from "./inventory.view";
|
||||
import type { ItemUsageData } from "@shared/lib/types";
|
||||
import { getGuildConfig } from "@shared/lib/config";
|
||||
import { INVENTORY_CUSTOM_IDS } from "./inventory.types";
|
||||
|
||||
export interface InventoryState {
|
||||
ownerId: string;
|
||||
@@ -25,7 +26,7 @@ export function parseInventoryCustomId(customId: string): { action: string; view
|
||||
* Checks if a custom ID belongs to the inventory system.
|
||||
*/
|
||||
export function isInventoryInteraction(customId: string): boolean {
|
||||
return customId.startsWith("inv_");
|
||||
return customId.startsWith(INVENTORY_CUSTOM_IDS.PREFIX);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user