Implement OCR
This commit is contained in:
parent
c6c9337e8b
commit
e36007ef50
10
main.cjs
10
main.cjs
@ -210,13 +210,13 @@ function getMatchingPhrase(inputString, targetCharacter) {
|
|||||||
console.log(message.attachments);
|
console.log(message.attachments);
|
||||||
message.attachments.forEach(i => {
|
message.attachments.forEach(i => {
|
||||||
if (i.contentType.includes("image")) {
|
if (i.contentType.includes("image")) {
|
||||||
(async () => {
|
//(async () => {
|
||||||
const worker = await createWorker('eng');
|
const worker = createWorker('eng');
|
||||||
const ret = await worker.recognize(i.proxyURL);
|
const ret = worker.recognize(i.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();
|
worker.terminate();
|
||||||
})();
|
//})();
|
||||||
console.log("Checking OCR contents...");
|
console.log("Checking OCR contents...");
|
||||||
if (checkLoop(message, checkString)) {
|
if (checkLoop(message, checkString)) {
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user