diff --git a/main.cjs b/main.cjs index a845787..1b4362e 100644 --- a/main.cjs +++ b/main.cjs @@ -206,23 +206,24 @@ function getMatchingPhrase(inputString, targetCharacter) { } checkString = checkString.replace(/[^a-zA-Z0-9]/g, ''); checkLoop(message, checkString); - (async () => { // Does the message have an attachment? Check the attachment with OCR console.log(message.attachments); message.attachments.forEach(i => { if (i.contentType.includes("image")) { - const worker = await createWorker('eng'); + (async () => { + const worker = await createWorker('eng'); const ret = await worker.recognize(i.proxyURL); console.log("OCR Results: " + ret.data.text); checkString = ret.data.text; await worker.terminate(); + })(); if (checkLoop(message, checkString)) { return; } checkString = checkString.replace(/[^a-zA-Z0-9]/g, ''); checkLoop(message, checkString); } - })(); + })(); } /*