No text fallback in ocr

This commit is contained in:
Dragon Fire
2020-11-09 15:03:13 -05:00
parent 7fc2b8b030
commit c98492f405
+1
View File
@@ -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' }]