diff --git a/README.md b/README.md index 210cc8e9..b200495b 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ You can add XiaoBot to your server with [this link](https://discordapp.com/oauth You can join the home server with [this link](https://discord.gg/fqQF8mc). ## Modules & APIs -[discord.js](https://discord.js.org/#/), [commando](https://github.com/Gawdl3y/discord.js-commando), [pirate-speak](https://github.com/mikewesthad/pirate-speak), [google-translate-api](https://github.com/matheuss/google-translate-api), [zalgoize](https://github.com/clux/zalgolize), [hepburn](https://github.com/lovell/hepburn), [string-to-binary](https://www.npmjs.com/package/string-to-binary), [roman-numeral-converter-mmxvi](https://github.com/Cein-Markey/roman-numeral-conversion-library), [cowsay](https://github.com/piuccio/cowsay), [morse](https://github.com/ecto/morse), [superagent](https://github.com/visionmedia/superagent), [mathjs](http://mathjs.org/), [moment](http://momentjs.com), [moment-duration-format](https://github.com/jsmreese/moment-duration-format), [jimp](https://github.com/oliver-moran/jimp), [cheerio](https://cheerio.js.org/), [Wattpad API](https://developer.wattpad.com/docs/api), [Wordnik API](http://developer.wordnik.com/docs.html), [osu! API](https://osu.ppy.sh/p/api), [memegen.link](https://memegen.link/), [Yugioh Prices API](http://docs.yugiohprices.apiary.io/#), [YouTube Data API](https://developers.google.com/youtube/v3/), [Yoda Speak API](https://market.mashape.com/ismaelc/yoda-speak), [Discord Bots API](https://bots.discord.pw/api), [Today in History API](http://history.muffinlabs.com/#api), [jService API](http://jservice.io/), [Strawpoll API](https://github.com/strawpoll/strawpoll/wiki/API), [Urban Dictionary API](https://github.com/zdict/zdict/wiki/Urban-dictionary-API-documentation), [OMDB API](http://www.omdbapi.com/), [Yahoo Weather API](https://developer.yahoo.com/weather/) +[discord.js](https://discord.js.org/#/), [commando](https://github.com/Gawdl3y/discord.js-commando), [pirate-speak](https://github.com/mikewesthad/pirate-speak), [zalgoize](https://github.com/clux/zalgolize), [hepburn](https://github.com/lovell/hepburn), [string-to-binary](https://www.npmjs.com/package/string-to-binary), [roman-numeral-converter-mmxvi](https://github.com/Cein-Markey/roman-numeral-conversion-library), [cowsay](https://github.com/piuccio/cowsay), [morse](https://github.com/ecto/morse), [superagent](https://github.com/visionmedia/superagent), [mathjs](http://mathjs.org/), [moment](http://momentjs.com), [moment-duration-format](https://github.com/jsmreese/moment-duration-format), [jimp](https://github.com/oliver-moran/jimp), [cheerio](https://cheerio.js.org/), [Wattpad API](https://developer.wattpad.com/docs/api), [Wordnik API](http://developer.wordnik.com/docs.html), [osu! API](https://osu.ppy.sh/p/api), [memegen.link](https://memegen.link/), [Yugioh Prices API](http://docs.yugiohprices.apiary.io/#), [YouTube Data API](https://developers.google.com/youtube/v3/), [Yoda Speak API](https://market.mashape.com/ismaelc/yoda-speak), [Discord Bots API](https://bots.discord.pw/api), [Today in History API](http://history.muffinlabs.com/#api), [jService API](http://jservice.io/), [Strawpoll API](https://github.com/strawpoll/strawpoll/wiki/API), [Urban Dictionary API](https://github.com/zdict/zdict/wiki/Urban-dictionary-API-documentation), [OMDB API](http://www.omdbapi.com/), [Yahoo Weather API](https://developer.yahoo.com/weather/) ## Self-Hosting You can Self-Host the bot easily, provided you have API keys and a Discord Bot Token. [Node.js](https://nodejs.org/en/) is also required, with at least version 7.8.0 recommended. diff --git a/commands/botinfo/info.js b/commands/botinfo/info.js index 50906d02..6db0b699 100644 --- a/commands/botinfo/info.js +++ b/commands/botinfo/info.js @@ -47,7 +47,7 @@ module.exports = class InfoCommand extends commando.Command { .addField('Library', '[discord.js](https://discord.js.org/#/)', true) .addField('Modules', - '[commando](https://github.com/Gawdl3y/discord.js-commando), [pirate-speak](https://github.com/mikewesthad/pirate-speak), [google-translate-api](https://github.com/matheuss/google-translate-api), [zalgoize](https://github.com/clux/zalgolize), [hepburn](https://github.com/lovell/hepburn), [string-to-binary](https://www.npmjs.com/package/string-to-binary), [roman-numeral-converter-mmxvi](https://github.com/Cein-Markey/roman-numeral-conversion-library), [cowsay](https://github.com/piuccio/cowsay), [morse](https://github.com/ecto/morse), [superagent](https://github.com/visionmedia/superagent), [mathjs](http://mathjs.org/), [moment](http://momentjs.com), [moment-duration-format](https://github.com/jsmreese/moment-duration-format), [jimp](https://github.com/oliver-moran/jimp), [cheerio](https://cheerio.js.org/)') + '[commando](https://github.com/Gawdl3y/discord.js-commando), [pirate-speak](https://github.com/mikewesthad/pirate-speak), [zalgoize](https://github.com/clux/zalgolize), [hepburn](https://github.com/lovell/hepburn), [string-to-binary](https://www.npmjs.com/package/string-to-binary), [roman-numeral-converter-mmxvi](https://github.com/Cein-Markey/roman-numeral-conversion-library), [cowsay](https://github.com/piuccio/cowsay), [morse](https://github.com/ecto/morse), [superagent](https://github.com/visionmedia/superagent), [mathjs](http://mathjs.org/), [moment](http://momentjs.com), [moment-duration-format](https://github.com/jsmreese/moment-duration-format), [jimp](https://github.com/oliver-moran/jimp), [cheerio](https://cheerio.js.org/)') .addField('APIs', '[Wattpad API](https://developer.wattpad.com/docs/api), [Wordnik API](http://developer.wordnik.com/docs.html), [osu! API](https://osu.ppy.sh/p/api), [memegen.link](https://memegen.link/), [Yugioh Prices API](http://docs.yugiohprices.apiary.io/#), [YouTube Data API](https://developers.google.com/youtube/v3/), [Yoda Speak API](https://market.mashape.com/ismaelc/yoda-speak), [Discord Bots API](https://bots.discord.pw/api), [Today in History API](http://history.muffinlabs.com/#api), [jService API](http://jservice.io/), [Strawpoll API](https://github.com/strawpoll/strawpoll/wiki/API), [Urban Dictionary API](https://github.com/zdict/zdict/wiki/Urban-dictionary-API-documentation), [OMDB API](http://www.omdbapi.com/), [Yahoo Weather API](https://developer.yahoo.com/weather/)'); return message.embed(embed); diff --git a/commands/textedit/translate.js b/commands/textedit/translate.js index b2f16258..3e7b958a 100644 --- a/commands/textedit/translate.js +++ b/commands/textedit/translate.js @@ -1,24 +1,19 @@ const commando = require('discord.js-commando'); const Discord = require('discord.js'); -const translate = require('google-translate-api'); +const request = require('superagent'); const languages = { "auto": "Automatic", "af": "Afrikaans", "sq": "Albanian", "ar": "Arabic", - "hy": "Armenian", "az": "Azerbaijani", "eu": "Basque", - "be": "Belarusian", "bn": "Bengali", - "bs": "Bosnian", + "be": "Belarusian", "bg": "Bulgarian", "ca": "Catalan", - "ceb": "Cebuano", - "ny": "Chichewa", "zh-cn": "Chinese Simplified", "zh-tw": "Chinese Traditional", - "co": "Corsican", "hr": "Croatian", "cs": "Czech", "da": "Danish", @@ -29,83 +24,50 @@ const languages = { "tl": "Filipino", "fi": "Finnish", "fr": "French", - "fy": "Frisian", "gl": "Galician", "ka": "Georgian", "de": "German", "el": "Greek", "gu": "Gujarati", "ht": "Haitian Creole", - "ha": "Hausa", - "haw": "Hawaiian", "iw": "Hebrew", "hi": "Hindi", - "hmn": "Hmong", "hu": "Hungarian", "is": "Icelandic", - "ig": "Igbo", "id": "Indonesian", "ga": "Irish", "it": "Italian", "ja": "Japanese", - "jw": "Javanese", "kn": "Kannada", - "kk": "Kazakh", - "km": "Khmer", "ko": "Korean", - "ku": "Kurdish (Kurmanji)", - "ky": "Kyrgyz", - "lo": "Lao", "la": "Latin", "lv": "Latvian", "lt": "Lithuanian", - "lb": "Luxembourgish", "mk": "Macedonian", - "mg": "Malagasy", "ms": "Malay", - "ml": "Malayalam", "mt": "Maltese", - "mi": "Maori", - "mr": "Marathi", - "mn": "Mongolian", - "my": "Myanmar (Burmese)", - "ne": "Nepali", "no": "Norwegian", - "ps": "Pashto", "fa": "Persian", "pl": "Polish", "pt": "Portuguese", - "ma": "Punjabi", "ro": "Romanian", "ru": "Russian", - "sm": "Samoan", "gd": "Scots Gaelic", "sr": "Serbian", - "st": "Sesotho", - "sn": "Shona", - "sd": "Sindhi", - "si": "Sinhala", "sk": "Slovak", "sl": "Slovenian", - "so": "Somali", "es": "Spanish", - "su": "Sudanese", "sw": "Swahili", "sv": "Swedish", - "tg": "Tajik", "ta": "Tamil", "te": "Telugu", "th": "Thai", "tr": "Turkish", "uk": "Ukrainian", "ur": "Urdu", - "uz": "Uzbek", "vi": "Vietnamese", "cy": "Welsh", - "xh": "Xhosa", - "yi": "Yiddish", - "yo": "Yoruba", - "zu": "Zulu" + "yi": "Yiddish" }; module.exports = class TranslateCommand extends commando.Command { @@ -115,7 +77,7 @@ module.exports = class TranslateCommand extends commando.Command { group: 'textedit', memberName: 'translate', description: 'Translates text to a given language. (;translate ja Give me the money!)', - details: '**Codes:** af: Afrikaans, sq: Albanian, ar: Arabic, hy: Armenian, az: Azerbaijani, eu: Basque, be: Belarusian, bn: Bengali, bs: Bosnian, bg: Bulgarian, ca: Catalan, ceb: Cebuano, ny: Chichewa, zh-cn: Chinese Simplified, zh-tw: Chinese Traditional, co: Corsican, hr: Croatian, cs: Czech, da: Danish, nl: Dutch, en: English, eo: Esperanto, et: Estonian, tl: Filipino, fi: Finnish, fr: French, fy: Frisian, gl: Galician, ka: Georgian, de: German, el: Greek, gu: Gujarati, ht: Haitian Creole, ha: Hausa, haw: Hawaiian, iw: Hebrew, hi: Hindi, hmn: Hmong, hu: Hungarian, is: Icelandic, ig: Igbo, id: Indonesian, ga: Irish, it: Italian, ja: Japanese, jw: Javanese, kn: Kannada, kk: Kazakh, km: Khmer, ko: Korean, ku: Kurdish (Kurmanji), ky: Kyrgyz, lo: Lao, la: Latin, lv: Latvian, lt: Lithuanian, lb: Luxembourgish, mk: Macedonian, mg: Malagasy, ms: Malay, ml: Malayalam, mt: Maltese, mi: Maori, mr: Marathi, mn: Mongolian, my: Myanmar (Burmese), ne: Nepali, no: Norwegian, ps: Pashto, fa: Persian, pl: Polish, pt: Portuguese, ma: Punjabi, ro: Romanian, ru: Russian, sm: Samoan, gd: Scots Gaelic, sr: Serbian, st: Sesotho, sn: Shona, sd: Sindhi, si: Sinhala, sk: Slovak, sl: Slovenian, so: Somali, es: Spanish, su: Sudanese, sw: Swahili, sv: Swedish, tg: Tajik, ta: Tamil, te: Telugu, th: Thai, tr: Turkish, uk: Ukrainian, ur: Urdu, uz: Uzbek, vi: Vietnamese, cy: Welsh, xh: Xhosa, yi: Yiddish, yo: Yoruba, zu: Zulu', + details: '**Codes:** af: Afrikaans, sq: Albanian, ar: Arabic, az: Azerbaijani, eu: Basque, bn: Bengali, be: Belarusian, bg: Bulgarian, ca: Catalan, zh-cn: Chinese Simplified, zh-tw: Chinese Traditional, hr: Croatian, cs: Czech, da: Danish, nl: Dutch, en: English, eo: Esperanto, et: Estonian, tl: Filipino, fi: Finnish, fr: French, gl: Galician, ka: Georgian, de: German, el: Greek, gu: Gujarati, ht: Haitian Creole, iw: Hebrew, hi: Hindi, hu: Hungarian, is: Icelandic, id: Indonesian, ga: Irish, it: Italian, ja: Japanese, kn: Kannada, ko: Korean, la: Latin, lv: Latvian, lt: Lithuanian, mk: Macedonian, ms: Malay, mt: Maltese, no: Norwegian, fa: Persian, pl: Polish, pt: Portuguese, ro: Romanian, ru: Russian, gd: Scots Gaelic, sr: Serbian, sk: Slovak, sl: Slovenian, es: Spanish, sw: Swahili, sv: Swedish, ta: Tamil, te: Telugu, th: Thai, tr: Turkish, uk: Ukrainian, ur: Urdu, vi: Vietnamese, cy: Welsh, yi: Yiddish', examples: [';translate ja Give me the the money!'], args: [{ key: 'to', @@ -149,16 +111,24 @@ module.exports = class TranslateCommand extends commando.Command { const languageto = args.to.toLowerCase(); const thingToTranslate = args.text; try { - const res = await translate(thingToTranslate, { - to: languageto - }); - const languagefrom = res.from.language.iso.toLowerCase(); + const response = await request + .get('https://translate.googleapis.com/translate_a/single') + .query({ + client: 'gtx', + sl: 'auto', + tl: languageto, + dt: 't', + q: thingToTranslate + }); + const data = JSON.parse(response.text); + const translated = data[0][0][0]; + const languagefrom = data[8][3][0]; const embed = new Discord.RichEmbed() .setColor(0x00AE86) .addField(`Input (From: ${languages[languagefrom]}):`, thingToTranslate) .addField(`Translation (To: ${languages[languageto]}):`, - res.text); + translated); return message.embed(embed); } catch (err) { diff --git a/html/carbondesc.html b/html/carbondesc.html index 55a1ccc9..8cfe0761 100644 --- a/html/carbondesc.html +++ b/html/carbondesc.html @@ -19,7 +19,6 @@