Nicer args parse

This commit is contained in:
Daniel Odendahl Jr
2017-04-23 23:27:03 +00:00
parent 678d3d3ae8
commit 11a610ab5e
28 changed files with 37 additions and 95 deletions
+1 -3
View File
@@ -20,9 +20,7 @@ module.exports = class MathGameCommand extends Command {
}
return 'Please set the difficulty to either `easy`, `medium`, `hard`, or `extreme`.';
},
parse: text => {
return text.toLowerCase();
}
parse: text => text.toLowerCase()
}]
});
}
+1 -3
View File
@@ -22,9 +22,7 @@ module.exports = class RockPaperScissorsCommand extends Command {
}
return 'Please enter either `rock`, `paper`, or `scissors`.';
},
parse: text => {
return text.toLowerCase();
}
parse: text => text.toLowerCase()
}]
});
}
+1 -3
View File
@@ -19,9 +19,7 @@ module.exports = class TypingGameCommand extends Command {
}
return 'Please set the difficulty to either `easy`, `medium`, `hard`, or `extreme`.';
},
parse: text => {
return text.toLowerCase();
}
parse: text => text.toLowerCase()
}]
});
}
+3 -9
View File
@@ -22,9 +22,7 @@ module.exports = class MemeCommand extends Command {
}
return `${type.toLowerCase()} is not a valid meme type. Use \`x;help meme\` to view a list of types.`;
},
parse: text => {
return text.toLowerCase();
}
parse: text => text.toLowerCase()
}, {
key: 'toprow',
prompt: 'What should the top row of the meme to be?',
@@ -35,9 +33,7 @@ module.exports = class MemeCommand extends Command {
}
return `Please do not use special characters and keep the rows under 100 characters each, you have ${toprow.length}.`;
},
parse: text => {
return text.replace(/[ ]/g, '-').replace(/[?]/g, '~q');
}
parse: text => text.replace(/[ ]/g, '-').replace(/[?]/g, '~q')
}, {
key: 'bottomrow',
prompt: 'What should the bottom row of the meme to be?',
@@ -48,9 +44,7 @@ module.exports = class MemeCommand extends Command {
}
return `Please do not use special characters and keep the rows under 100 characters each, you have ${bottomrow.length}.`;
},
parse: text => {
return text.replace(/[ ]/g, '-').replace(/[?]/g, '~q');
}
parse: text => text.replace(/[ ]/g, '-').replace(/[?]/g, '~q')
}]
});
}
+1 -3
View File
@@ -18,9 +18,7 @@ module.exports = class LockdownCommand extends Command {
}
return 'Please enter either `start` or `stop`.';
},
parse: text => {
return text.toLowerCase();
}
parse: text => text.toLowerCase()
}]
});
}
+1 -3
View File
@@ -22,9 +22,7 @@ module.exports = class EasterEggCommand extends Command {
}
return 'Nope, that\'s not a valid easter egg. Try again!';
},
parse: text => {
return text.toLowerCase();
}
parse: text => text.toLowerCase()
}]
});
}
+1 -3
View File
@@ -22,9 +22,7 @@ module.exports = class RandomNameCommand extends Command {
}
return 'Please enter either `male` or `female`.';
},
parse: text => {
return text.toLowerCase();
}
parse: text => text.toLowerCase()
}]
});
}
+1 -3
View File
@@ -19,9 +19,7 @@ module.exports = class DefineCommand extends Command {
key: 'word',
prompt: 'What would you like to define?',
type: 'string',
parse: text => {
return encodeURIComponent(text);
}
parse: text => encodeURIComponent(text)
}]
});
}
+1 -3
View File
@@ -17,9 +17,7 @@ module.exports = class GoogleCommand extends Command {
key: 'query',
prompt: 'What would you like to search for?',
type: 'string',
parse: text => {
return encodeURIComponent(text);
}
parse: text => encodeURIComponent(text)
}]
});
}
+1 -3
View File
@@ -19,9 +19,7 @@ module.exports = class IMDBCommand extends Command {
key: 'movie',
prompt: 'What movie or TV Show would you like to search for?',
type: 'string',
parse: text => {
return encodeURIComponent(text);
}
parse: text => encodeURIComponent(text)
}]
});
}
+1 -3
View File
@@ -11,9 +11,7 @@ module.exports = class LMGTFYCommand extends Command {
key: 'query',
prompt: 'What would you like to the link to search for?',
type: 'string',
parse: text => {
return encodeURIComponent(text);
}
parse: text => encodeURIComponent(text)
}]
});
}
+1 -3
View File
@@ -25,9 +25,7 @@ module.exports = class MapCommand extends Command {
key: 'location',
prompt: 'What location you like to get a map image for?',
type: 'string',
parse: text => {
return encodeURIComponent(text);
}
parse: text => encodeURIComponent(text)
}]
});
}
+1 -3
View File
@@ -13,9 +13,7 @@ module.exports = class NeopetCommand extends Command {
key: 'pet',
prompt: 'What pet would you like to get the image of?',
type: 'string',
parse: text => {
return encodeURIComponent(text);
}
parse: text => encodeURIComponent(text)
}]
});
}
+1 -3
View File
@@ -18,9 +18,7 @@ module.exports = class OsuCommand extends Command {
key: 'username',
prompt: 'What osu username would you like to search for?',
type: 'string',
parse: text => {
return encodeURIComponent(text);
}
parse: text => encodeURIComponent(text)
}]
});
}
+1 -3
View File
@@ -17,9 +17,7 @@ module.exports = class SoundCloudCommand extends Command {
key: 'query',
prompt: 'What do you want to search SoundCloud for?',
type: 'string',
parse: text => {
return encodeURIComponent(text);
}
parse: text => encodeURIComponent(text)
}]
});
}
+1 -3
View File
@@ -18,9 +18,7 @@ module.exports = class UrbanCommand extends Command {
key: 'word',
prompt: 'What would you like to define?',
type: 'string',
parse: text => {
return encodeURIComponent(text);
}
parse: text => encodeURIComponent(text)
}]
});
}
+1 -3
View File
@@ -13,9 +13,7 @@ module.exports = class WattpadCommand extends Command {
key: 'book',
prompt: 'What book would you like to search for?',
type: 'string',
parse: text => {
return encodeURIComponent(text);
}
parse: text => encodeURIComponent(text)
}]
});
}
+1 -3
View File
@@ -13,9 +13,7 @@ module.exports = class WikipediaCommand extends Command {
key: 'query',
prompt: 'What would you like to search for?',
type: 'string',
parse: text => {
return encodeURIComponent(text).replace(/[)]/g, '%29');
}
parse: text => encodeURIComponent(text)
}]
});
}
+1 -3
View File
@@ -16,9 +16,7 @@ module.exports = class YouTubeCommand extends Command {
key: 'video',
prompt: 'What would you like to search for?',
type: 'string',
parse: text => {
return encodeURIComponent(text);
}
parse: text => encodeURIComponent(text)
}]
});
}
+1 -3
View File
@@ -13,9 +13,7 @@ module.exports = class YuGiOhCommand extends Command {
key: 'card',
prompt: 'What card would you like to get data for?',
type: 'string',
parse: text => {
return encodeURIComponent(text);
}
parse: text => encodeURIComponent(text)
}]
});
}
+1 -3
View File
@@ -25,9 +25,7 @@ module.exports = class BinaryCommand extends Command {
}
return 'Your message content is too long.';
},
parse: text => {
return stringToBinary(text);
}
parse: text => stringToBinary(text)
}]
});
}
+3 -5
View File
@@ -1,5 +1,5 @@
const { Command } = require('discord.js-commando');
const translator = require('custom-translate');
const { letterTrans } = require('custom-translate');
const dictionary = require('./morsemappings.json');
module.exports = class MorseCommand extends Command {
@@ -17,14 +17,12 @@ module.exports = class MorseCommand extends Command {
prompt: 'What text would you like to convert to morse?',
type: 'string',
validate: content => {
if (translator.letterTrans(content, dictionary, ' ').length < 1999) {
if (letterTrans(content, dictionary, ' ').length < 1999) {
return true;
}
return 'Your message content is too long.';
},
parse: text => {
return translator.letterTrans(text.toLowerCase(), dictionary, ' ');
}
parse: text => letterTrans(text.toLowerCase(), dictionary, ' ')
}]
});
}
+3 -5
View File
@@ -1,5 +1,5 @@
const { Command } = require('discord.js-commando');
const translator = require('custom-translate');
const { wordTrans } = require('custom-translate');
const dictionary = require('./piratewords.json');
module.exports = class PirateCommand extends Command {
@@ -18,14 +18,12 @@ module.exports = class PirateCommand extends Command {
prompt: 'What text would you like to convert to pirate?',
type: 'string',
validate: content => {
if (translator.wordTrans(content, dictionary).length < 1999) {
if (wordTrans(content, dictionary).length < 1999) {
return true;
}
return 'Your message content is too long.';
},
parse: text => {
return translator.wordTrans(text, dictionary);
}
parse: text => wordTrans(text, dictionary)
}]
});
}
+1 -3
View File
@@ -11,9 +11,7 @@ module.exports = class ReverseCommand extends Command {
key: 'text',
prompt: 'What text would you like to reverse?',
type: 'string',
parse: text => {
return text.split('').reverse().join('');
}
parse: text => text.split('').reverse().join('')
}]
});
}
+3 -5
View File
@@ -1,5 +1,5 @@
const { Command } = require('discord.js-commando');
const translator = require('custom-translate');
const { wordTrans } = require('custom-translate');
const dictionary = require('./temmiewords.json');
module.exports = class TemmieCommand extends Command {
@@ -14,14 +14,12 @@ module.exports = class TemmieCommand extends Command {
prompt: 'What text would you like to convert to Temmie speak?',
type: 'string',
validate: content => {
if (translator.wordTrans(content, dictionary).length < 1999) {
if (wordTrans(content, dictionary).length < 1999) {
return true;
}
return 'Your message content is too long.';
},
parse: text => {
return translator.wordTrans(text, dictionary);
}
parse: text => wordTrans(text, dictionary)
}]
});
}
+2 -4
View File
@@ -1,5 +1,5 @@
const { Command } = require('discord.js-commando');
const translator = require('custom-translate');
const { letterTrans } = require('custom-translate');
const dictionary = require('./udmappings.json');
module.exports = class UpsideDownCommand extends Command {
@@ -17,9 +17,7 @@ module.exports = class UpsideDownCommand extends Command {
key: 'text',
prompt: 'What text would you like to flip upside-down?',
type: 'string',
parse: text => {
return translator.letterTrans(text, dictionary);
}
parse: text => letterTrans(text, dictionary)
}]
});
}
+1 -3
View File
@@ -18,9 +18,7 @@ module.exports = class ZalgoCommand extends Command {
}
return `Please keep your text under 500 characters, you have ${content.length}.`;
},
parse: text => {
return zalgo(text);
}
parse: text => zalgo(text)
}]
});
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiaobot",
"version": "31.7.0",
"version": "31.8.0",
"description": "A Discord Bot",
"main": "shardingmanager.js",
"scripts": {