Implement OCR
This commit is contained in:
parent
5f77c74e4a
commit
90f3bbb037
6
main.cjs
6
main.cjs
@ -208,10 +208,10 @@ function getMatchingPhrase(inputString, targetCharacter) {
|
|||||||
checkLoop(message, checkString);
|
checkLoop(message, checkString);
|
||||||
(async () => {
|
(async () => {
|
||||||
// Does the message have an attachment? Check the attachment with OCR
|
// Does the message have an attachment? Check the attachment with OCR
|
||||||
console.log(message.attachment);
|
console.log(message.attachments);
|
||||||
if (message.attachment.contentType.contains("image")) {
|
if (message.attachments.contentType.contains("image")) {
|
||||||
const worker = await createWorker('eng');
|
const worker = await createWorker('eng');
|
||||||
const ret = await worker.recognize(message.attachment.proxyURL);
|
const ret = await worker.recognize(message.attachments.proxyURL);
|
||||||
console.log("OCR Results: " + ret.data.text);
|
console.log("OCR Results: " + ret.data.text);
|
||||||
checkString = ret.data.text;
|
checkString = ret.data.text;
|
||||||
await worker.terminate();
|
await worker.terminate();
|
||||||
|
Loading…
Reference in New Issue
Block a user