diff --git a/services/discord-gateway/src/modules/ai-moderation/textCacheStore.ts b/services/discord-gateway/src/modules/ai-moderation/textCacheStore.ts index 25e7778..8db6e8f 100644 --- a/services/discord-gateway/src/modules/ai-moderation/textCacheStore.ts +++ b/services/discord-gateway/src/modules/ai-moderation/textCacheStore.ts @@ -285,9 +285,10 @@ export async function computeImagePhash( buffer: Buffer, ): Promise { try { - // Dynamic import to avoid issues if imghash native bindings aren't available - const imghashModule = await import("imghash"); - const hashFn = imghashModule.default?.hash ?? imghashModule.hash; + // Dynamic import — imghash is ESM with a default export containing { hash, hashRaw, ... } + const imghashModule: { default?: { hash?: (buf: Buffer) => Promise } } = + await import("imghash"); + const hashFn = imghashModule.default?.hash; if (typeof hashFn !== "function") return null; const hash = await hashFn(buffer); return hash;