adds /translate

This commit is contained in:
bignutty 2024-11-05 22:01:09 +01:00
parent e8312f0b32
commit 064845b307
7 changed files with 147 additions and 2 deletions

View file

@ -0,0 +1,35 @@
const { TRANSLATE_LANGUAGES } = require("#constants");
const { getLanguagesFromAny } = require("#utils/translate");
module.exports = async (context)=>{
let choices = [];
if(context.value){
choices = getLanguagesFromAny(context.value)
} else {
// Default language suggestions
choices = [
"en",
"de",
"fr",
"es",
"pt-PT",
"no",
"fi",
"sv",
"it",
"ja",
"ru",
"ar",
"he",
"tr",
"hi",
"zh-CN",
"zh-TW",
]
}
return context.respond({ choices: choices.splice(0, 20).map((l)=>({
name: TRANSLATE_LANGUAGES[l],
value: l
}))});
}