Move to snekfetch 🐍

This commit is contained in:
Daniel Odendahl Jr
2017-04-16 01:12:22 +00:00
parent 90d3e66e89
commit 8074fe51bd
36 changed files with 252 additions and 311 deletions
+3 -44
View File
@@ -1,47 +1,6 @@
const { Command } = require('discord.js-commando');
const translator = require('custom-translate');
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": "----.",
".": ".-.-.-",
"?": "..--..",
",": "--..--",
"'": ".----."
};
const { dictionary } = require('./morsemappings.json');
module.exports = class MorseCommand extends Command {
constructor(client) {
@@ -59,7 +18,7 @@ module.exports = class MorseCommand extends Command {
prompt: 'What text would you like to convert to morse?',
type: 'string',
validate: content => {
if (translator.letterTrans(content, morse, ' ').length < 1900) {
if (translator.letterTrans(content, dictionary, ' ').length < 1900) {
return true;
}
return 'Your text to encode is too long.';
@@ -73,7 +32,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, dictionary, ' ');
return message.say(encoded);
}
};