Remove Tons of Dependencies

This commit is contained in:
Daniel Odendahl Jr
2017-04-12 17:48:02 +00:00
parent b82af4b08f
commit f1c4802890
18 changed files with 488 additions and 445 deletions
+41 -3
View File
@@ -1,5 +1,43 @@
const { Command } = require('discord.js-commando');
const morse = require('morse');
const translator = require('../../functions/translator.js');
const morse = {
"a": ".-",
"b": "-...",
"c": "-.-.",
"d": "-..",
"e": ".",
"f": "..-.",
"g": "--.",
"h": "....",
"i": "..",
"j": ".---",
"k": "-.-",
"l": ".-..",
"m": "--",
"n": "-.",
"o": "---",
"p": ".--.",
"q": "--.-",
"r": ".-.",
"s": "...",
"t": "-",
"u": "..-",
"v": "...-",
"w": ".--",
"x": "-..-",
"y": "-.--",
"z": "--..",
"0": "-----",
"1": ".----",
"2": "..---",
"3": "...--",
"4": "....-",
"5": ".....",
"6": "-....",
"7": "--...",
"8": "---..",
"9": "----."
};
module.exports = class MorseCommand extends Command {
constructor(client) {
@@ -17,7 +55,7 @@ module.exports = class MorseCommand extends Command {
prompt: 'What text would you like to convert to morse?',
type: 'string',
validate: content => {
if (morse.encode(content).length < 1900) {
if (translator.letterTrans(content, morse).length < 1900) {
return true;
}
return 'Your text to encode is too long.';
@@ -31,7 +69,7 @@ module.exports = class MorseCommand extends Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
const text = args.text;
const encoded = morse.encode(text);
const encoded = translator.letterTrans(text, morse);
return message.say(encoded);
}
};