From f6ed26ca91043d4a8e44355d05e02b638bace7dc Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Wed, 12 Apr 2017 20:58:45 +0000 Subject: [PATCH] Morse Fixed? --- commands/textedit/morse.js | 3 +-- functions/translator.js | 5 +++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/commands/textedit/morse.js b/commands/textedit/morse.js index 94d95f9f..e509ebb8 100644 --- a/commands/textedit/morse.js +++ b/commands/textedit/morse.js @@ -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); } }; diff --git a/functions/translator.js b/functions/translator.js index 98c99250..7a05b469 100644 --- a/functions/translator.js +++ b/functions/translator.js @@ -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); };