Implement OCR
This commit is contained in:
parent
90f3bbb037
commit
0667dd70d8
2
main.cjs
2
main.cjs
@ -209,7 +209,7 @@ function getMatchingPhrase(inputString, targetCharacter) {
|
|||||||
(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.attachments);
|
console.log(message.attachments);
|
||||||
if (message.attachments.contentType.contains("image")) {
|
if (message.attachments.contentType.includes("image")) {
|
||||||
const worker = await createWorker('eng');
|
const worker = await createWorker('eng');
|
||||||
const ret = await worker.recognize(message.attachments.proxyURL);
|
const ret = await worker.recognize(message.attachments.proxyURL);
|
||||||
console.log("OCR Results: " + ret.data.text);
|
console.log("OCR Results: " + ret.data.text);
|
||||||
|
Loading…
Reference in New Issue
Block a user