From ce2b789282d5b7c0eb75cc92a3200f0cc7668de8 Mon Sep 17 00:00:00 2001 From: MythEclipse Date: Tue, 2 Jun 2026 22:55:32 +0700 Subject: [PATCH] ``` --- .../src/modules/ai-moderation/textCacheStore.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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;