Cleaner Looking args

This commit is contained in:
Daniel Odendahl Jr
2017-05-02 17:54:07 +00:00
parent 57ee7fa82b
commit 3bb21c2df0
83 changed files with 787 additions and 616 deletions
+33 -29
View File
@@ -9,37 +9,41 @@ module.exports = class MemeCommand extends Command {
memberName: 'meme',
description: 'Sends a Meme with text of your choice, and a background of your choice.',
details: `**Codes:** ${codes.join(', ')}`,
args: [{
key: 'type',
prompt: 'What meme type do you want to use?',
type: 'string',
validate: type => {
if (codes.includes(type.toLowerCase()))
return true;
return `${type.toLowerCase()} is not a valid meme type. Use \`x;help meme\` to view a list of types.`;
args: [
{
key: 'type',
prompt: 'What meme type do you want to use?',
type: 'string',
validate: type => {
if (codes.includes(type.toLowerCase()))
return true;
return `${type.toLowerCase()} is not a valid meme type. Use \`help meme\` to view a list of types.`;
},
parse: type => type.toLowerCase()
},
parse: type => type.toLowerCase()
}, {
key: 'top',
prompt: 'What should the top row of the meme to be?',
type: 'string',
validate: top => {
if (/[a-zA-Z0-9.,!?'\s]+$/g.test(top) && top.length < 100)
return true;
return `Please do not use special characters and keep the rows under 100 characters each, top row has ${top.length}.`;
{
key: 'top',
prompt: 'What should the top row of the meme to be?',
type: 'string',
validate: top => {
if (/[a-zA-Z0-9.,!?'\s]+$/g.test(top) && top.length < 100)
return true;
return `Please do not use special characters and keep the rows under 100 characters each, top row has ${top.length}.`;
},
parse: top => top.replace(/[ ]/g, '-').replace(/[?]/g, '~q')
},
parse: top => top.replace(/[ ]/g, '-').replace(/[?]/g, '~q')
}, {
key: 'bottom',
prompt: 'What should the bottom row of the meme to be?',
type: 'string',
validate: bottom => {
if (/[a-zA-Z0-9.,!?'\s]+$/g.test(bottom) && bottom.length < 100)
return true;
return `Please do not use special characters and keep the rows under 100 characters each, bottom row has ${bottom.length}.`;
},
parse: bottom => bottom.replace(/[ ]/g, '-').replace(/[?]/g, '~q')
}]
{
key: 'bottom',
prompt: 'What should the bottom row of the meme to be?',
type: 'string',
validate: bottom => {
if (/[a-zA-Z0-9.,!?'\s]+$/g.test(bottom) && bottom.length < 100)
return true;
return `Please do not use special characters and keep the rows under 100 characters each, bottom row has ${bottom.length}.`;
},
parse: bottom => bottom.replace(/[ ]/g, '-').replace(/[?]/g, '~q')
}
]
});
}