Formatting

This commit is contained in:
Daniel Odendahl Jr
2017-03-23 01:35:22 +00:00
parent 72718c7c62
commit 40a4af36c4
109 changed files with 2660 additions and 2505 deletions
+11 -8
View File
@@ -2,7 +2,7 @@ const commando = require('discord.js-commando');
const morse = require('morse');
module.exports = class MorseCommand extends commando.Command {
constructor(Client){
constructor(Client) {
super(Client, {
name: 'morse',
aliases: [
@@ -16,20 +16,23 @@ module.exports = class MorseCommand extends commando.Command {
}
async run(message) {
if(message.channel.type !== 'dm') {
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log("[Command] " + message.content);
let [methodToUse] = message.content.toLowerCase().split(" ").slice(1);
let toMorse = message.content.split(" ").slice(2).join(" ");
if(toMorse === "") {
if (toMorse === "") {
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') {
}
else if (methodToUse === 'encode') {
message.channel.send(morse.encode(toMorse)).catch(error => message.channel.send(':x: Error! Something went wrong! Perhaps you entered incorrect text?'));
} else if(methodToUse === 'decode') {
}
else if (methodToUse === 'decode') {
message.channel.send(morse.decode(toMorse)).catch(error => message.channel.send(':x: Error! Something went wrong! Perhaps you entered incorrect text?'));
} else {
}
else {
message.channel.send(":x: Error! Method not set/not correct! Use either encode or decode.");
}
}
};
};