mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-09 06:33:05 -04:00
fixes errors with ctx commands
This commit is contained in:
parent
11d20a8334
commit
d5d5f01cdc
4 changed files with 21 additions and 26 deletions
|
@ -1,6 +1,7 @@
|
|||
const { renderMusicButtons } = require('#utils/buttons');
|
||||
const { createEmbed } = require('#utils/embed');
|
||||
const { acknowledge } = require('#utils/interactions');
|
||||
const { editOrReply } = require('#utils/message');
|
||||
|
||||
const { ApplicationCommandTypes } = require("detritus-client/lib/constants");;
|
||||
|
||||
|
@ -32,7 +33,7 @@ module.exports = {
|
|||
let song = songlink.body.entitiesByUniqueId[songlink.body.entityUniqueId]
|
||||
|
||||
let btns = renderMusicButtons(songlink.body.linksByPlatform)
|
||||
return context.editOrRespond({embeds:[
|
||||
return editOrReply(context, {embeds:[
|
||||
createEmbed("default", context, {
|
||||
author: {
|
||||
name: `${song.title} by ${song.artistName}`.substr(0,1000),
|
||||
|
@ -45,16 +46,14 @@ module.exports = {
|
|||
})
|
||||
], components: btns })
|
||||
}catch(e){
|
||||
return context.editOrRespond({ embeds: [createEmbed("warning", context, "No results found.")] })
|
||||
return editOrReply(context, createEmbed("warning", context, "No results found."))
|
||||
}
|
||||
} else {
|
||||
return context.editOrRespond({ embeds: [createEmbed("warning", context, "No urls found.")] })
|
||||
return editOrReply(context, createEmbed("warning", context, "No urls found."))
|
||||
}
|
||||
}catch(e){
|
||||
console.log(e)
|
||||
await context.editOrRespond({
|
||||
embeds: [createEmbed("error", context, "Unable to look up song url.")]
|
||||
})
|
||||
await editOrReply(context, createEmbed("error", context, "Unable to look up song url."))
|
||||
}
|
||||
},
|
||||
};
|
|
@ -4,6 +4,7 @@ const { getMessageAttachment, validateAttachment } = require('#utils/attachment'
|
|||
const { createEmbed } = require('#utils/embed');
|
||||
const { acknowledge } = require('#utils/interactions');
|
||||
const { codeblock } = require('#utils/markdown');
|
||||
const { editOrReply } = require('#utils/message');
|
||||
const { STATICS } = require('#utils/statics');
|
||||
|
||||
const { ApplicationCommandTypes, MessageFlags } = require("detritus-client/lib/constants");
|
||||
|
@ -31,14 +32,13 @@ module.exports = {
|
|||
} else {
|
||||
delete attachment;
|
||||
}
|
||||
if(!attachment) return context.editOrRespond({ embeds: [createEmbed("warning", context, "No images found.")] })
|
||||
if(!attachment) return editOrReply(context, createEmbed("warning", context, "No images found."))
|
||||
|
||||
let ocr = await googleVisionOcr(context, attachment)
|
||||
|
||||
if(ocr.response.body.status == 1) return context.editOrRespond({ embeds: [createEmbed("warning", context, ocr.response.body.text)] })
|
||||
if(ocr.response.body.status == 1) return editOrReply(context, createEmbed("warning", context, ocr.response.body.text))
|
||||
|
||||
await context.editOrRespond({
|
||||
embeds: [createEmbed("default", context, {
|
||||
await editOrReply(context, createEmbed("default", context, {
|
||||
thumbnail: {
|
||||
url: attachment
|
||||
},
|
||||
|
@ -47,11 +47,10 @@ module.exports = {
|
|||
iconUrl: STATICS.google,
|
||||
text: `Google Cloud Vision • ${context.application.name} • Took ${ocr.timings}s`
|
||||
}
|
||||
})]
|
||||
})
|
||||
}))
|
||||
}catch(e){
|
||||
console.log(e)
|
||||
await context.editOrRespond({
|
||||
await editOrReply(context, {
|
||||
embeds: [createEmbed("error", context, "Unable to perform Optical Character Recognition.")],
|
||||
flags: MessageFlags.EPHEMERAL
|
||||
})
|
||||
|
|
|
@ -62,10 +62,7 @@ module.exports = {
|
|||
}
|
||||
}catch(e){
|
||||
console.log(e)
|
||||
await context.editOrRespond({
|
||||
embeds: [createEmbed("error", context, "Unable to perform Optical Character Recognition.")],
|
||||
flags: MessageFlags.EPHEMERAL
|
||||
})
|
||||
await editOrReply(context, createEmbed("error", context, "Unable to perform Optical Character Recognition."))
|
||||
}
|
||||
},
|
||||
};
|
|
@ -56,7 +56,7 @@ module.exports = {
|
|||
} else {
|
||||
delete attachment;
|
||||
}
|
||||
if(!attachment) return context.editOrRespond({ embeds: [createEmbed("warning", context, "No images found.")] })
|
||||
if(!attachment) return editOrReply(context, createEmbed("warning", context, "No images found."))
|
||||
|
||||
|
||||
let search = await reverseImageSearch(context, attachment)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue