From c98492f4057d4f9bbd353bcaf69e0b7073000b3d Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Mon, 9 Nov 2020 15:03:13 -0500 Subject: [PATCH] No text fallback in ocr --- commands/analyze/ocr.js | 1 + 1 file changed, 1 insertion(+) diff --git a/commands/analyze/ocr.js b/commands/analyze/ocr.js index dc70487d..f2db97d0 100644 --- a/commands/analyze/ocr.js +++ b/commands/analyze/ocr.js @@ -35,6 +35,7 @@ module.exports = class OcrCommand extends Command { const { data: { text } } = await worker.recognize(image); await worker.terminate(); await reactIfAble(msg, this.client.user, SUCCESS_EMOJI_ID, '✅'); + if (!text) return msg.reply('There is no text in this image.'); if (text.length > 2000) { return msg.reply('The result was over 2000 characters, so here\'s a TXT file.', { files: [{ attachment: Buffer.from(text), name: 'ocr.txt' }]