mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-14 08:08:34 +02:00
Remove Tons of Dependencies
This commit is contained in:
@@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user