[fix] fix translation

This commit is contained in:
kwaroran
2023-11-14 18:07:37 +09:00
parent 244febc911
commit de3c0ccb1a

View File

@@ -140,6 +140,10 @@ async function translateMain(text:string, arg:{from:string, to:string, host:stri
}
if((!res[0]) || res[0].length === 0){
return text
}
const result = (res[0].map((s) => s[0]).filter(Boolean).join('') as string).replace(/\* ([^*]+)\*/g, '*$1*').replace(/\*([^*]+) \*/g, '*$1*');
return result
}