mirror of
https://github.com/keanuplayz/TravBot-v3.git
synced 2024-08-15 02:33:12 +00:00
R.I.P. .translate, may you return another day
This commit is contained in:
parent
78f3490003
commit
69a8452574
4 changed files with 11 additions and 806 deletions
762
package-lock.json
generated
762
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -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": {
|
||||
|
|
|
@ -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`
|
||||
);
|
||||
});
|
||||
}
|
||||
})
|
||||
})
|
||||
});
|
9
src/defs/translate.d.ts
vendored
9
src/defs/translate.d.ts
vendored
|
@ -1,9 +0,0 @@
|
|||
interface TranslateOptions {
|
||||
from?: string;
|
||||
to?: string;
|
||||
}
|
||||
|
||||
declare module "translate-google" {
|
||||
function translate(input: string, options: TranslateOptions): Promise<string>;
|
||||
export = translate;
|
||||
}
|
Loading…
Reference in a new issue