Proper await

This commit is contained in:
Daniel Odendahl Jr
2017-03-24 02:29:31 +00:00
parent 5329d08581
commit 122fcf5de3
103 changed files with 613 additions and 577 deletions
+14 -4
View File
@@ -23,16 +23,26 @@ module.exports = class MorseCommand extends commando.Command {
let [methodToUse] = message.content.toLowerCase().split(" ").slice(1);
let toMorse = message.content.split(" ").slice(2).join(" ");
if (!toMorse) {
return message.channel.send(":x: Error! Nothing to translate! Perhaps you forgot to set the method? Use either encode or decode before your text.");
message.channel.send(":x: Error! Nothing to translate! Perhaps you forgot to set the method? Use either encode or decode before your text.");
}
else if (methodToUse === 'encode') {
return message.channel.send(morse.encode(toMorse)).catch(error => message.channel.send(':x: Error! Something went wrong! Perhaps you entered incorrect text?'));
try {
message.channel.send(morse.encode(toMorse));
}
catch (err) {
message.channel.send(':x: Error! Something went wrong! Perhaps you entered incorrect text?');
}
}
else if (methodToUse === 'decode') {
return message.channel.send(morse.decode(toMorse)).catch(error => message.channel.send(':x: Error! Something went wrong! Perhaps you entered incorrect text?'));
try {
message.channel.send(morse.decode(toMorse));
}
catch (err) {
message.channel.send(':x: Error! Something went wrong! Perhaps you entered incorrect text?');
}
}
else {
return message.channel.send(":x: Error! Method not set/not correct! Use either encode or decode.");
message.channel.send(":x: Error! Method not set/not correct! Use either encode or decode.");
}
}
};