I'm getting this error with my discord bot... This is my code: const { createWorker } = require('tesseract.js'); const { Client, GatewayIntentBits } = require('discord.js'); const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent] });
// Create and configure a worker instance const worker = createWorker(); client.on('ready', () => { console.log(`Logged in as ${client.user.tag}`); }); client.on('messageCreate', async (message) => { // Add async here if (message.author.bot) return; console.log(`Received a message from ${message.author.username}: ${ message.content}`); if (message.attachments.size > 0 && message.attachments.first().url) { const imageUrl = message.attachments.first().url; console.log(`Received an image from ${message.author.username}: ${ imageUrl}`); // Process the image with Tesseract OCR try { await worker.load(); await worker.loadLanguage('es'); // Replace 'eng' with the appropriate language code await worker.initialize('es'); const { data: { text } } = await worker.recognize(imageUrl); console.log('Extracted text:', text); await worker.terminate(); // Send the extracted text as a message in the same channel message.channel.send(`Extracted text: ${text}`); } catch (error) { console.error('Error occurred during OCR:', error); message.channel.send(`Sorry, something went wrong. Please try again later.`); } } }); -- You received this message because you are subscribed to the Google Groups "tesseract-ocr" group. To unsubscribe from this group and stop receiving emails from it, send an email to tesseract-ocr+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/tesseract-ocr/015a43b1-d54b-4457-84f4-29c501334c6en%40googlegroups.com.