error handling for emojimix

This commit is contained in:
derpystuff 2023-06-11 01:05:16 +02:00
parent 2d57a75e9b
commit 7573b38c97

View file

@ -92,19 +92,23 @@ module.exports = {
// Emoji Mixing
if(emoji.length >= 2){
let em = await emojiKitchen(emoji)
if(!em.body.results[0]){
for(const em of emoji){
try{
await emojiKitchen([em])
}catch(e){
return editOrReply(context, createEmbed("warning", context, `Unsupported Emoji (${em})`))
try{
let em = await emojiKitchen(emoji)
if(!em.body.results[0]){
for(const em of emoji){
try{
await emojiKitchen([em])
}catch(e){
return editOrReply(context, createEmbed("warning", context, `Unsupported Emoji (${em})`))
}
}
return editOrReply(context, createEmbed("error", context, "Combination not supported."))
}
return editOrReply(context, createEmbed("error", context, "Combination not supported."))
return editOrReply(context, createEmbed("image", context, { url: em.body.results[0].url }))
}catch(e){
return editOrReply(context, createEmbed("error", context, "Unable to mix emoji."))
}
return editOrReply(context, createEmbed("image", context, { url: em.body.results[0].url }))
}
// Regular Emoji Handling