From 83ceabdcb5c7533ab8e2d350484fbb7e16a5dec0 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Thu, 4 Apr 2024 10:02:16 -0400 Subject: [PATCH] Send text morse too --- commands/voice/morse.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/commands/voice/morse.js b/commands/voice/morse.js index 61a21cde..be971fcf 100644 --- a/commands/voice/morse.js +++ b/commands/voice/morse.js @@ -18,7 +18,8 @@ module.exports = class MorseCommand extends Command { key: 'text', type: 'string', validate: text => { - if (letterTrans(text.toLowerCase(), dictionary, ' ').length < 2000) return true; + const translated = letterTrans(text.toLowerCase(), dictionary, ' '); + if (translated.replace(/ {2}/g, ' / ').length < 2000) return true; return 'Invalid text, your text is too long.'; }, parse: text => text.toLowerCase() @@ -34,7 +35,8 @@ module.exports = class MorseCommand extends Command { return msg.reply(`I am not in a voice channel. Use ${usage} to fix that!`); } if (!connection.canPlay) return msg.reply('I am already playing audio in this server.'); - const translated = letterTrans(text, dictionary, ' '); + const translated = letterTrans(text.toLowerCase(), dictionary, ' '); + await msg.say(translated.replace(/ {2}/g, ' / ')); const letters = translated.split(''); let skip = false; await reactIfAble(msg, this.client.user, '🔉');