args and more

This commit is contained in:
Daniel Odendahl Jr
2017-03-25 04:16:27 +00:00
parent 8dd6ec1f9b
commit e2a4a92990
82 changed files with 1089 additions and 1021 deletions
+13 -13
View File
@@ -8,25 +8,25 @@ module.exports = class CowsayCommand extends commando.Command {
group: 'textedit',
memberName: 'cowsay',
description: 'Converts text to cowsay. (;cowsay This text)',
examples: [';cowsay This text']
examples: [';cowsay This text'],
args: [{
key: 'text',
prompt: 'What text would you like the cow to say?',
type: 'string'
}]
});
}
run(message) {
run(message, args) {
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log(`[Command] ${message.content}`);
if (!message.content.split(" ").slice(1).join(" ")) {
return message.channel.send(":x: Error! You entered nothing!");
}
else {
let turnToCowsay = message.content.split(" ").slice(1).join(" ");
return message.channel.sendCode(null, cowsay.say({
text: turnToCowsay,
e: "oO",
T: "U "
})).catch(error => message.channel.send(':x: Error! Perhaps the content is too long?'));
}
let turnToCowsay = args.text;
return message.channel.sendCode(null, cowsay.say({
text: turnToCowsay,
e: "oO",
T: "U "
})).catch(error => message.channel.send(':x: Error! Perhaps the content is too long?'));
}
};