mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-08 06:03:04 -04:00
Error message for ocr, fix attachment lookup
This commit is contained in:
parent
c384cb8022
commit
2ea818f30f
3 changed files with 15 additions and 6 deletions
|
@ -18,7 +18,7 @@ module.exports = {
|
|||
const { message } = args;
|
||||
|
||||
let attachment = getMessageAttachment(message)
|
||||
if(attachment && validateAttachment(attachment)){
|
||||
if(attachment && validateAttachment(attachment, "image")){
|
||||
attachment = attachment.url
|
||||
} else {
|
||||
delete attachment;
|
||||
|
@ -27,12 +27,14 @@ module.exports = {
|
|||
|
||||
let ocr = await googleVisionOcr(context, attachment)
|
||||
|
||||
if(ocr.response.body.text.length == 0) return context.editOrRespond({ embeds: [createEmbed("warning", context, "No text detected.")], flags: MessageFlags.EPHEMERAL })
|
||||
|
||||
await context.editOrRespond({
|
||||
embeds: [createEmbed("default", context, {
|
||||
thumbnail: {
|
||||
url: attachment
|
||||
},
|
||||
description: codeblock("ansi", [ocr.response.body.text]),
|
||||
description: codeblock("ansi", ["" + ocr.response.body.text]),
|
||||
footer: {
|
||||
iconUrl: STATICS.google,
|
||||
text: `Google Cloud Vision • ${context.application.name} • Took ${ocr.timings}s`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue