mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-09 06:33:05 -04:00
update translate header design (again, this time consistently)
This commit is contained in:
parent
e2075b8306
commit
c5d49cf0f7
5 changed files with 109 additions and 69 deletions
|
@ -47,7 +47,7 @@ module.exports = {
|
|||
return editOrReply(context, createEmbed("error", context, "Unable to retrieve Google Vision API response."))
|
||||
}
|
||||
|
||||
if(ocr.response.body.status == 1) return editOrReply(context, createEmbed("warning", context, ocr.response.body.text))
|
||||
if(ocr.response.body.status === 1) return editOrReply(context, createEmbed("warning", context, ocr.response.body.text))
|
||||
|
||||
try{
|
||||
let translate = await googleTranslate(context, ocr.response.body.text, targetLanguage, sourceLanguage)
|
||||
|
@ -56,7 +56,7 @@ module.exports = {
|
|||
let toFlag = TRANSLATE_DISPLAY_MAPPINGS[translate.response.body.language.to] || ''
|
||||
|
||||
return editOrReply(context, createEmbed("default", context, {
|
||||
description: `${icon("locale")} ${fromFlag} ${pill(TRANSLATE_LANGUAGES[translate.response.body.language.from || sourceLanguage])} ${icon("arrow_right")} ${toFlag} ${pill(TRANSLATE_LANGUAGES[translate.response.body.language.to])}\n${codeblock("ansi", [translate.response.body.translation.substr(0,4000)])}`,
|
||||
description: `-# ${icon("locale")} ${fromFlag} ${pill(TRANSLATE_LANGUAGES[translate.response.body.language.from || sourceLanguage])} ${icon("arrow_right")} ${toFlag} ${pill(TRANSLATE_LANGUAGES[translate.response.body.language.to])}\n${codeblock("ansi", [translate.response.body.translation.substr(0,4000)])}`,
|
||||
thumbnail: {
|
||||
url: image
|
||||
},
|
||||
|
@ -66,7 +66,7 @@ module.exports = {
|
|||
}
|
||||
}))
|
||||
}catch(e){
|
||||
if(e.response?.body?.status && e.response.body.status == 2) return editOrReply(context, createEmbed("error", context, `Unable to translate text.`))
|
||||
if(e.response?.body?.status && e.response.body.status === 2) return editOrReply(context, createEmbed("error", context, `Unable to translate text.`))
|
||||
console.log(e)
|
||||
return editOrReply(context, createEmbed("error", context, `Something went wrong.`))
|
||||
}
|
||||
|
|
|
@ -181,7 +181,7 @@ module.exports = {
|
|||
let toFlag = TRANSLATE_DISPLAY_MAPPINGS[translate.response.body.language.to] || ''
|
||||
|
||||
return editOrReply(context, createEmbed("default", context, {
|
||||
description: `-# ${icon("subtext_translate")} Translated from ${fromFlag} **${TRANSLATE_LANGUAGES[translate.response.body.language.from || sourceLanguage] || translate.response.body.language.from || args.from}** to ${toFlag} **${TRANSLATE_LANGUAGES[translate.response.body.language.to] || translate.response.body.language.to}**.\n${codeblock("ansi", [translate.response.body.translation])}`,
|
||||
description: `-# ${icon("locale")} ${fromFlag} ${pill(TRANSLATE_LANGUAGES[translate.response.body.language.from || sourceLanguage] || translate.response.body.language.from || "Detected Language")} ${icon("arrow_right")} ${toFlag} ${pill(TRANSLATE_LANGUAGES[translate.response.body.language.to] || translate.response.body.language.to)}\n${codeblock("ansi", [stringwrap(translate.response.body.translation, 1900)])}`,
|
||||
footer: {
|
||||
iconUrl: STATICS.googletranslate,
|
||||
text: `Google Translate • ${context.application.name}`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue