Fixes and Prepare for Bug Checks

This commit is contained in:
Daniel Odendahl Jr
2017-04-05 18:55:16 +00:00
parent 410b41b168
commit dd87d38fcc
4 changed files with 12 additions and 19 deletions
+1 -1
View File
@@ -22,7 +22,7 @@ module.exports = class NitroCommand extends commando.Command {
.setThumbnail('https://pbs.twimg.com/profile_images/814184180649197568/y2eZcVMq.jpg')
.setColor(0x748BD9)
.setURL('https://discordapp.com/nitro')
.setDescription('This Message can only be viewed by members with Discord Nitro.\n\n[More Information](https://discordapp.com/nitro)');
.setDescription('This Message can only be viewed by members with Discord Nitro.\n\n\n[More Information](https://discordapp.com/nitro)');
return message.embed(embed);
}
};
+9 -18
View File
@@ -10,22 +10,18 @@ module.exports = class MorseCommand extends commando.Command {
],
group: 'textedit',
memberName: 'morse',
description: 'Translates text to and from morse code. (;morse encode This is Morse Code.)',
examples: [';morse encode This is Morse Code.', ';morse decode .... . .-.. .-.. --- --..-- ....... .-- --- .-. .-.. -.. .-.-.-'],
description: 'Translates text to morse code. (;morse This is Morse Code.)',
examples: [';morse This is Morse Code.'],
args: [{
key: 'method',
prompt: 'Would you like to encode or decode the text?',
key: 'text',
prompt: 'What text would you like to convert to morse?',
type: 'string',
validate: method => {
if (method.toLowerCase() === 'encode' || method.toLowerCase() === 'decode') {
validate: content => {
if (morse.encode(content).length < 1900) {
return true;
}
return 'Please enter either `encode` or `decode`.';
return 'Your text to encode is too long.';
}
}, {
key: 'text',
prompt: 'What text would you like to convert to/from morse?',
type: 'string'
}]
});
}
@@ -35,13 +31,8 @@ module.exports = class MorseCommand extends commando.Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log(`[Command] ${message.content}`);
const methodToUse = args.method.toLowerCase();
const toMorse = args.text;
if (methodToUse === 'encode') {
return message.say(morse.encode(toMorse)).catch(error => message.say(':x: Error! Something went wrong! Perhaps you entered incorrect text?'));
}
else if (methodToUse === 'decode') {
return message.say(morse.decode(toMorse)).catch(error => message.say(':x: Error! Something went wrong! Perhaps you entered incorrect text?'));
}
const morseEncoded = morse.encode(toMorse);
return message.say(morseEncoded);
}
};
+1
View File
@@ -162,6 +162,7 @@ module.exports = class TranslateCommand extends commando.Command {
return message.embed(embed);
}
catch (err) {
console.error(err);
return message.say(':x: Error! Something went wrong!');
}
}
+1
View File
@@ -37,6 +37,7 @@ module.exports = class YodaCommand extends commando.Command {
return message.say(response.text);
}
catch (err) {
console.error(err);
return message.say(':x: Error! Something went wrong!');
}
}