akinator-discord.js
Version:
A literal fork of the npm package discord.js-akinator, except with very minor changes(WIP). The only reason I'm publishing this is for private use. But anyone is free to use it if they wish.
15 lines (12 loc) • 465 B
JavaScript
const translator = require('@vitalets/google-translate-api');
/**
*
* @param {String} string
* @param {String} language
*/
module.exports = async function translate(string, language) {
if (!string) return console.log("Translator: No Strings Provided!")
if (!language) return console.log("Translator: No Language Provided!")
let translation = await translator(string, { to: language }).catch(e => console.log(e));
return translation.text;
}