Morse Fixed?

This commit is contained in:
Daniel Odendahl Jr
2017-04-12 20:58:45 +00:00
parent 928dbd05cc
commit f6ed26ca91
2 changed files with 4 additions and 4 deletions
+1 -2
View File
@@ -37,7 +37,6 @@ const morse = {
"7": "--...",
"8": "---..",
"9": "----.",
" ": "/",
".": ".-.-.-",
"?": "..--..",
",": "--..--",
@@ -74,7 +73,7 @@ module.exports = class MorseCommand extends Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
const text = args.text.toLowerCase();
const encoded = translator.letterTrans(text, morse);
const encoded = translator.letterTrans(text, morse, ' ');
return message.say(encoded);
}
};
+3 -2
View File
@@ -15,7 +15,7 @@ module.exports.wordTrans = (text, words) => {
return translation.join(' ');
};
module.exports.letterTrans = (text, letters) => {
module.exports.letterTrans = (text, letters, joinWith) => {
text = text.split('');
let translation = [];
for (let i = 0; i < text.length; i++) {
@@ -27,5 +27,6 @@ module.exports.letterTrans = (text, letters) => {
translation.push(letter);
}
}
return translation.join('');
joinWith = joinWith || '';
return translation.join(joinWith);
};