|
|
|
@ -7,17 +7,15 @@ const command = {
|
|
|
|
|
if (!splitted[2] || !splitted[3]) {
|
|
|
|
|
await client.say(
|
|
|
|
|
msg.channelName,
|
|
|
|
|
`${msg.displayName}, needed <source country code> <target country code> <text to be translated>`
|
|
|
|
|
`${msg.displayName}, needed <target country code> <text to be translated>`
|
|
|
|
|
);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const data = await fetch(
|
|
|
|
|
`https://lingva.ml/api/v1/${encodeURIComponent(
|
|
|
|
|
`https://lingva.ml/api/v1/auto/${encodeURIComponent(
|
|
|
|
|
splitted[2]
|
|
|
|
|
)}/${encodeURIComponent(splitted[3])}/${encodeURIComponent(
|
|
|
|
|
splitted.slice(4).join(" ")
|
|
|
|
|
)}`
|
|
|
|
|
)}/${encodeURIComponent(splitted.slice(3).join(" "))}`
|
|
|
|
|
)
|
|
|
|
|
.then((res) => res.json())
|
|
|
|
|
.catch((err) => console.error("Error with translating: " + err.message));
|
|
|
|
@ -34,8 +32,8 @@ const command = {
|
|
|
|
|
await client.say(
|
|
|
|
|
msg.channelName,
|
|
|
|
|
`${msg.displayName}, Translation of ${splitted
|
|
|
|
|
.slice(4)
|
|
|
|
|
.join(" ")} to lang ${splitted[3]}: '${data.translation}'`
|
|
|
|
|
.slice(3)
|
|
|
|
|
.join(" ")} to lang ${splitted[2]}: '${data.translation}'`
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|