Fix All the Crap

This commit is contained in:
Daniel Odendahl Jr
2017-03-25 04:52:59 +00:00
parent ebfbf31787
commit cb4abd7ac4
12 changed files with 42 additions and 59 deletions
+2 -4
View File
@@ -15,10 +15,7 @@ module.exports = class MorseCommand extends commando.Command {
args: [{
key: 'method',
prompt: 'Would you like to encode or decode the text?',
type: 'string',
validate: (str) => {
str.toLowerCase() === 'encode' || str.toLowerCase() === 'decode';
}
type: 'string'
}, {
key: 'text',
prompt: 'What text would you like to convert to morse?',
@@ -33,6 +30,7 @@ module.exports = class MorseCommand extends commando.Command {
}
console.log(`[Command] ${message.content}`);
let methodToUse = args.method;
if (methodToUse.toLowerCase() !== 'encode' || methodToUse.toLowerCase() !== 'decode') return message.channel.send(':x: Error! Please set either encode or decode!');
let toMorse = args.text;
if (methodToUse === 'encode') return message.channel.send(morse.encode(toMorse)).catch(error => message.channel.send(':x: Error! Something went wrong! Perhaps you entered incorrect text?'));
if (methodToUse === 'decode') return message.channel.send(morse.decode(toMorse)).catch(error => message.channel.send(':x: Error! Something went wrong! Perhaps you entered incorrect text?'));
+2 -4
View File
@@ -15,10 +15,7 @@ module.exports = class RomajiCommand extends commando.Command {
args: [{
key: 'kana',
prompt: 'What kana would you like to convert to romaji?',
type: 'string',
validate: (str) => {
hepburn.containsKana(str);
}
type: 'string'
}]
});
}
@@ -29,6 +26,7 @@ module.exports = class RomajiCommand extends commando.Command {
}
console.log(`[Command] ${message.content}`);
let romajify = args.kana;
if (!hepburn.containsKana(romajify)) return message.channel.send(':x: Error! Message contains no Katakana or Hiragana!');
let romajified = hepburn.fromKana(romajify);
if (romajified.length > 1950) return message.channel.send(":x: Error! Your message is too long!");
return message.channel.send(romajified);
+2 -4
View File
@@ -120,10 +120,7 @@ module.exports = class TranslateCommand extends commando.Command {
args: [{
key: 'to',
prompt: 'What language would you like to translate to?',
type: 'string',
validate: (str) => {
languages[str] || str.toLowerCase() === 'list';
}
type: 'string'
}, {
key: 'text',
prompt: 'What text would you like to translate?',
@@ -138,6 +135,7 @@ module.exports = class TranslateCommand extends commando.Command {
}
console.log(`[Command] ${message.content}`);
let languageto = args.to;
if (!languages[languageto] || languageto.toLowerCase() !== 'list') return message.channel.send(':x: Error! Translation type is not valid!');
let thingToTranslate = args.text;
if (languageto === "list") return message.channel.send("af': 'Afrikaans\nsq': 'Albanian'\n'ar': 'Arabic\nhy': 'Armenian\naz': 'Azerbaijani\neu': 'Basque\nbe': 'Belarusian\nbn': 'Bengali\nbs': 'Bosnian\nbg': 'Bulgarian\nca': 'Catalan\nceb': 'Cebuano\nny': 'Chichewa\nzh-cn': 'Chinese Simplified\nzh-tw': 'Chinese Traditional\nco': 'Corsican\nhr': 'Croatian\ncs': 'Czech\nda': 'Danish\nnl': 'Dutch\nen': 'English\neo': 'Esperanto\net': 'Estonian\ntl': 'Filipino\nfi': 'Finnish\nfr': 'French\nfy': 'Frisian\ngl': 'Galician\nka': 'Georgian\nde': 'German\nel': 'Greek\ngu': 'Gujarati\nht': 'Haitian Creole\nha': 'Hausa\nhaw': 'Hawaiian\niw': 'Hebrew\nhi': 'Hindi\nhmn': 'Hmong\nhu': 'Hungarian\nis': 'Icelandic\nig': 'Igbo\nid': 'Indonesian\nga': 'Irish\nit': 'Italian\nja': 'Japanese\njw': 'Javanese\nkn': 'Kannada\nkk': 'Kazakh\nkm': 'Khmer\nko': 'Korean\nku': 'Kurdish (Kurmanji)\nky': 'Kyrgyz\nlo': 'Lao\nla': 'Latin\nlv': 'Latvian\nlt': 'Lithuanian\nlb': 'Luxembourgish\nmk': 'Macedonian\nmg': 'Malagasy\nms': 'Malay\nml': 'Malayalam\nmt': 'Maltese\nmi': 'Maori\nmr': 'Marathi\nmn': 'Mongolian\nmy': 'Myanmar (Burmese)\nne': 'Nepali\nno': 'Norwegian\nps': 'Pashto\nfa': 'Persian\npl': 'Polish\npt': 'Portuguese\nma': 'Punjabi\nro': 'Romanian\nru': 'Russian\nsm': 'Samoan\ngd': 'Scots Gaelic\nsr': 'Serbian\nst': 'Sesotho\nsn': 'Shona\nsd': 'Sindhi\nsi': 'Sinhala\nsk': 'Slovak\nsl': 'Slovenian\nso': 'Somali\nes': 'Spanish\nsu': 'Sudanese\nsw': 'Swahili\nsv': 'Swedish\ntg': 'Tajik\nta': 'Tamil\nte': 'Telugu\nth': 'Thai\ntr': 'Turkish\nuk': 'Ukrainian\nur': 'Urdu\nuz': 'Uzbek\nvi': 'Vietnamese\ncy': 'Welsh\nxh': 'Xhosa\nyi': 'Yiddish\nyo': 'Yoruba\nzu': 'Zulu'");
if (thingToTranslate.length > 200) return message.channel.send(":x: Error! Please keep translations below 200 characters!");