Add All Validators.

This commit is contained in:
Daniel Odendahl Jr
2017-03-25 07:05:13 +00:00
parent be79696113
commit a604110dfc
9 changed files with 35 additions and 12 deletions
-1
View File
@@ -26,7 +26,6 @@ module.exports = class YearsCommand extends commando.Command {
}
console.log(`[Command] ${message.content}`);
let user = args.user;
if (!user.displayAvatarURL) return message.channel.send(":x: Error! This user has no avatar!");
let userAvatar = user.displayAvatarURL;
userAvatar = userAvatar.replace(".jpg", ".png");
userAvatar = userAvatar.replace(".gif", ".png");
+2 -2
View File
@@ -121,13 +121,13 @@ module.exports = class MemeCommand extends commando.Command {
}
}, {
key: 'content',
prompt: 'What should the meme content be?',
prompt: 'What should the meme content be? Split the bottom and top text of the meme with " | ".',
type: 'string',
validate: content => {
if (content.includes(' | ') && content.match(/^[a-zA-Z0-9|.,!?'-\s]+$/)) {
return true;
}
return 'Please split your choices with ` | ` and do not use special characters.';
return 'Please split your choices with " | " and do not use special characters.';
}
}]
});
+1 -1
View File
@@ -19,7 +19,7 @@ module.exports = class ChooseCommand extends commando.Command {
if (content.includes(' | ')) {
return true;
}
return 'Please split your choices with ` | `.';
return 'Please split your choices with " | ".';
}
}]
});
+7 -2
View File
@@ -12,7 +12,13 @@ module.exports = class BinaryCommand extends commando.Command {
args: [{
key: 'text',
prompt: 'What text would you like to convert to binary?',
type: 'string'
type: 'string',
validate: content => {
if (stringToBinary(content).length > 1950) {
return 'Your message content is too long.';
}
return true;
}
}]
});
}
@@ -24,7 +30,6 @@ module.exports = class BinaryCommand extends commando.Command {
console.log(`[Command] ${message.content}`);
let turnToBinary = args.text;
let binaryText = stringToBinary(turnToBinary);
if (binaryText.length > 1950) return message.channel.send(":x: Error! Your message is too long!");
return message.channel.send(binaryText);
}
};
+1 -1
View File
@@ -24,7 +24,7 @@ module.exports = class MorseCommand extends commando.Command {
}
}, {
key: 'text',
prompt: 'What text would you like to convert to morse?',
prompt: 'What text would you like to convert to/from morse?',
type: 'string'
}]
});
+7 -1
View File
@@ -16,7 +16,13 @@ module.exports = class PirateCommand extends commando.Command {
args: [{
key: 'text',
prompt: 'What text would you like to convert to pirate?',
type: 'string'
type: 'string',
validate: content => {
if (pirateSpeak.translate(content).length > 1950) {
return 'Your message content is too long.';
}
return true;
}
}]
});
}
+3 -1
View File
@@ -18,6 +18,9 @@ module.exports = class RomajiCommand extends commando.Command {
type: 'string',
validate: kana => {
if (hepburn.containsKana(kana)) {
if (hepburn.fromKana(kana).length > 1950) {
return 'Your message content is too long.';
}
return true;
}
return 'Please enter text in either Hiragana or Katakana.';
@@ -33,7 +36,6 @@ module.exports = class RomajiCommand extends commando.Command {
console.log(`[Command] ${message.content}`);
let romajify = args.kana;
let romajified = hepburn.fromKana(romajify);
if (romajified.length > 1950) return message.channel.send(":x: Error! Your message is too long!");
return message.channel.send(romajified);
}
};
+7 -1
View File
@@ -297,7 +297,13 @@ module.exports = class TemmieCommand extends commando.Command {
args: [{
key: 'text',
prompt: 'What text would you like to convert to Temmie speak?',
type: 'string'
type: 'string',
validate: content => {
if (temmize(content).length > 1950) {
return 'Your message content is too long.';
}
return true;
}
}]
});
}
+7 -2
View File
@@ -12,7 +12,13 @@ module.exports = class ZalgoCommand extends commando.Command {
args: [{
key: 'text',
prompt: 'What text would you like to convert to zalgo?',
type: 'string'
type: 'string',
validate: content => {
if (zalgo(content).length > 1950) {
return 'Your message content is too long.';
}
return true;
}
}]
});
}
@@ -23,7 +29,6 @@ module.exports = class ZalgoCommand extends commando.Command {
}
console.log(`[Command] ${message.content}`);
let zalgoified = zalgo(args.text);
if (zalgoified.length > 1950) return message.channel.send(":x: Error! Your message is too long!");
return message.channel.send(zalgoified);
}
};