R.I.P. .translate, may you return another day

This commit is contained in:
Alyxia Sother 2021-11-03 13:52:39 +01:00
parent 78f3490003
commit 69a8452574
No known key found for this signature in database
GPG key ID: 355968D14144B739
4 changed files with 11 additions and 806 deletions

762
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -27,7 +27,6 @@
"onion-lasers": "npm:onion-lasers-v13@^2.1.0",
"pet-pet-gif": "^1.0.9",
"relevant-urban": "^2.0.0",
"translate-google": "^1.5.0",
"weather-js": "^2.0.0"
},
"devDependencies": {

View file

@ -1,45 +0,0 @@
import {Command, NamedCommand, RestCommand} from "onion-lasers";
import translate from "translate-google";
export default new NamedCommand({
description: "Translates your input.",
usage: "<lang ID> <input>",
run: "You need to specify a language to translate to.",
any: new Command({
run: "You need to enter some text to translate.",
any: new RestCommand({
async run({send, args}) {
const lang = args[0];
const input = args.slice(1).join(" ");
translate(input, {
to: lang
})
.then((res) => {
send({
embeds: [
{
title: "Translation",
fields: [
{
name: "Input",
value: `\`\`\`${input}\`\`\``
},
{
name: "Output",
value: `\`\`\`${res}\`\`\``
}
]
}
]
});
})
.catch((error) => {
console.error("[translate]", error);
send(
`${error}\nPlease use the following list: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes`
);
});
}
})
})
});

View file

@ -1,9 +0,0 @@
interface TranslateOptions {
from?: string;
to?: string;
}
declare module "translate-google" {
function translate(input: string, options: TranslateOptions): Promise<string>;
export = translate;
}