mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Morse Fixed?
This commit is contained in:
@@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user