mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-25 14:21:41 +02:00
No text fallback in ocr
This commit is contained in:
@@ -35,6 +35,7 @@ module.exports = class OcrCommand extends Command {
|
|||||||
const { data: { text } } = await worker.recognize(image);
|
const { data: { text } } = await worker.recognize(image);
|
||||||
await worker.terminate();
|
await worker.terminate();
|
||||||
await reactIfAble(msg, this.client.user, SUCCESS_EMOJI_ID, '✅');
|
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) {
|
if (text.length > 2000) {
|
||||||
return msg.reply('The result was over 2000 characters, so here\'s a TXT file.', {
|
return msg.reply('The result was over 2000 characters, so here\'s a TXT file.', {
|
||||||
files: [{ attachment: Buffer.from(text), name: 'ocr.txt' }]
|
files: [{ attachment: Buffer.from(text), name: 'ocr.txt' }]
|
||||||
|
|||||||
Reference in New Issue
Block a user