From fd1ebfa02d501bf52fd45b6033fb7d74847748dc Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Thu, 23 Mar 2017 04:44:57 +0000 Subject: [PATCH] Translate Codes in translate.js --- commands/textedit/temmie.js | 111 +++++++++++++++++++++++++++++--- commands/textedit/translate.js | 114 +++++++++++++++++++++++++++++++-- 2 files changed, 213 insertions(+), 12 deletions(-) diff --git a/commands/textedit/temmie.js b/commands/textedit/temmie.js index fb86ef2e..f2ce8931 100644 --- a/commands/textedit/temmie.js +++ b/commands/textedit/temmie.js @@ -56,13 +56,13 @@ const dictionary = { "hungry": "hungr", "muscles": "not coot", "aw": "awwawa", - "yikes": "omg!!!!!!", - "ah": "omg!!!!!!", - "oh": "omg!!!!!!", - "yipe": "omg!!!!!!", - "wait": "omg!!!!!!", - "yes": "yee!!!!!!", - "no": "no!!!!!!", + "yikes": "omg!", + "ah": "omg!", + "oh": "omg!", + "yipe": "omg!", + "wait": "omg!", + "yes": "yee!", + "no": "no!", "person": "bark", "monster": "munster", "monsters": "munsters", @@ -118,7 +118,102 @@ const dictionary = { "you": "u", "your": "ur", "yours": "urs", - "there": "dere" + "there": "dere", + "proud": "prouds", + "random": "rando", + "see": "c", + "this": "dis", + "egg": "eg", + "very": "very!", + "excited": "excite", + "doesn't": "don't", + "sleep": "slep", + "noodles": "alphys foob", + "scream": "screems", + "gonna": "gunna", + "pasta": "papy foob", + "spaghetti": "papy foob", + "scary": "scaredy", + "frightening": "scaredy", + "worry": "worrys", + "worries": "worrys", + "sushi": "undyne foob", + "banana": "bernerner", + "bananas": "bernerners", + "apple": "oppl", + "apples": "oppls", + "grape": "grep", + "grapes": "greps", + "wonder": "wunders", + "wonders": "wunders", + "wondering": "wunders", + "wonderful": "wunderfull", + "think": "finks", + "thinks": "finks", + "thought": "finked", + "beat": "dunks", + "defeat": "dunks", + "defeated": "dunkd", + "they're": "their", + "their": "there", + "you're": "ur", + "because": "cuz", + "bc": "cuz", + "will": "wil", + "things": "thins", + "thing": "thin", + "science": "scienc", + "ice cream": "noice creem", + "spear": "speer", + "baby": "temini", + "babies": "teminis", + "child": "temini", + "children": "teminis", + "kid": "temini", + "kids": "teminis", + "bot": "xiao", + "robot": "mettatun", + "ghost": "bluuk", + "nap": "slep", + "boop": "blep", + "beep": "blep", + "bleep": "blep", + "bop": "blep", + "spider": "spoider", + "spiders": "sploiders", + "music": "moosics", + "again": "agin", + "the": "teh", + "family": "fam", + "smart": "smarts", + "smartness": "smartiness", + "intelligence": "smartiness", + "typo": "tpyo", + "typo'd": "tyop'd", + "typos": "typoys", + "yay": "yee", + "potato": "tato", + "potatoes": "tatos", + "fry": "fri", + "fries": "fri", + "burger": "glamburg", + "steak": "stek", + "heart": "hart", + "love": "lub", + "hate": "h8", + "like": "liek", + "library": "librarby", + "fire": "flemz", + "flame": "flemz", + "fires": "flemz", + "flames": "flemz", + "witchcraft": "magics", + "witchcrafts": "magics", + "magic": "magics", + "sorcery": "magics", + "superpower": "magics", + "superpowers": "magics", + "sorceries": "magics" }; function translateWord(word) { diff --git a/commands/textedit/translate.js b/commands/textedit/translate.js index c2eafdf8..e5f4ad5f 100644 --- a/commands/textedit/translate.js +++ b/commands/textedit/translate.js @@ -1,7 +1,113 @@ const commando = require('discord.js-commando'); const Discord = require('discord.js'); const translate = require('google-translate-api'); -const languages = require('./languages.json'); + +const languages = { + "auto": "Automatic", + "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" +}; module.exports = class TranslateCommand extends commando.Command { constructor(Client) { @@ -24,7 +130,7 @@ module.exports = class TranslateCommand extends commando.Command { if (languageto === "list") { message.channel.send("‘af': 'Afrikaans’\n’sq': 'Albanian'\n'ar': 'Arabic’\n’hy': 'Armenian’\n’az': 'Azerbaijani’\n’eu': 'Basque’\n’be': 'Belarusian’\n’bn': 'Bengali’\n’bs': 'Bosnian’\n’bg': 'Bulgarian’\n’ca': 'Catalan’\n’ceb': 'Cebuano’\n’ny': 'Chichewa’\n’zh-cn': 'Chinese Simplified’\n’zh-tw': 'Chinese Traditional’\n’co': 'Corsican’\n’hr': 'Croatian’\n’cs': 'Czech’\n’da': 'Danish’\n’nl': 'Dutch’\n’en': 'English’\n’eo': 'Esperanto’\n’et': 'Estonian’\n’tl': 'Filipino’\n’fi': 'Finnish’\n’fr': 'French’\n’fy': 'Frisian’\n’gl': 'Galician’\n’ka': 'Georgian’\n’de': 'German’\n’el': 'Greek’\n’gu': 'Gujarati’\n’ht': 'Haitian Creole’\n’ha': 'Hausa’\n’haw': 'Hawaiian’\n’iw': 'Hebrew’\n’hi': 'Hindi’\n’hmn': 'Hmong’\n’hu': 'Hungarian’\n’is': 'Icelandic’\n’ig': 'Igbo’\n’id': 'Indonesian’\n’ga': 'Irish’\n’it': 'Italian’\n’ja': 'Japanese’\n’jw': 'Javanese’\n’kn': 'Kannada’\n’kk': 'Kazakh’\n’km': 'Khmer’\n’ko': 'Korean’\n’ku': 'Kurdish (Kurmanji)’\n’ky': 'Kyrgyz’\n’lo': 'Lao’\n’la': 'Latin’\n’lv': 'Latvian’\n’lt': 'Lithuanian’\n’lb': 'Luxembourgish’\n’mk': 'Macedonian’\n’mg': 'Malagasy’\n’ms': 'Malay’\n’ml': 'Malayalam’\n’mt': 'Maltese’\n’mi': 'Maori’\n’mr': 'Marathi’\n’mn': 'Mongolian’\n’my': 'Myanmar (Burmese)’\n’ne': 'Nepali’\n’no': 'Norwegian’\n’ps': 'Pashto’\n’fa': 'Persian’\n’pl': 'Polish’\n’pt': 'Portuguese’\n’ma': 'Punjabi’\n’ro': 'Romanian’\n’ru': 'Russian’\nsm': 'Samoan’\n’gd': 'Scots Gaelic’\n’sr': 'Serbian’\n’st': 'Sesotho’\n’sn': 'Shona’\n’sd': 'Sindhi’\n’si': 'Sinhala’\n’sk': 'Slovak’\n’sl': 'Slovenian’\n’so': 'Somali’\n’es': 'Spanish’\n’su': 'Sudanese’\n’sw': 'Swahili’\n’sv': 'Swedish’\n’tg': 'Tajik’\n’ta': 'Tamil’\n’te': 'Telugu’\n’th': 'Thai’\n’tr': 'Turkish’\n’uk': 'Ukrainian’\n’ur': 'Urdu’\n’uz': 'Uzbek’\n’vi': 'Vietnamese’\n’cy': 'Welsh’\n’xh': 'Xhosa’\n’yi': 'Yiddish’\n’yo': 'Yoruba’\n’zu': 'Zulu'"); } - else if (languages.entries[languageto]) { + else if (languages[languageto]) { if (!thingToTranslate) { message.channel.send(":x: Error! Nothing to translate!"); } @@ -38,9 +144,9 @@ module.exports = class TranslateCommand extends commando.Command { let languagefrom = res.from.language.iso.toLowerCase(); const embed = new Discord.RichEmbed() .setColor(0x00AE86) - .addField(`Input (From: ${languages.entries[languagefrom]}):`, + .addField(`Input (From: ${languages[languagefrom]}):`, thingToTranslate) - .addField(`Translation (To: ${languages.entries[languageto]}):`, + .addField(`Translation (To: ${languages[languageto]}):`, res.text); message.channel.sendEmbed(embed).catch(console.error); }).catch(err => {