Better Validators and More Destucturing

This commit is contained in:
Daniel Odendahl Jr
2017-04-19 18:55:26 +00:00
parent c064401b37
commit d77f71b66a
40 changed files with 114 additions and 124 deletions
+1 -3
View File
@@ -26,9 +26,7 @@ module.exports = class YearsCommand extends Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission('ATTACH_FILES')) return message.say(':x: Error! I don\'t have the Attach Files Permission!');
}
const { user } = args;
let userAvatar = user.displayAvatarURL;
userAvatar = userAvatar.replace('.jpg', '.png');
userAvatar = userAvatar.replace('.gif', '.png');
const userAvatar = user.displayAvatarURL.replace('.jpg', '.png').replace('.gif', '.png');
let images = [];
images.push(Jimp.read(userAvatar));
images.push(Jimp.read('./images/3000years.png'));
+1 -3
View File
@@ -26,9 +26,7 @@ module.exports = class BeautifulCommand extends Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission('ATTACH_FILES')) return message.say(':x: Error! I don\'t have the Attach Files Permission!');
}
const { user } = args;
let userAvatar = user.displayAvatarURL;
userAvatar = userAvatar.replace('.jpg', '.png');
userAvatar = userAvatar.replace('.gif', '.png');
const userAvatar = user.displayAvatarURL.replace('.jpg', '.png').replace('.gif', '.png');
let images = [];
images.push(Jimp.read(userAvatar));
images.push(Jimp.read('./images/beautiful.jpg'));
+1 -3
View File
@@ -27,9 +27,7 @@ module.exports = class BobRossCommand extends Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission('ATTACH_FILES')) return message.say(':x: Error! I don\'t have the Attach Files Permission!');
}
const { user } = args;
let userAvatar = user.displayAvatarURL;
userAvatar = userAvatar.replace('.jpg', '.png');
userAvatar = userAvatar.replace('.gif', '.png');
const userAvatar = user.displayAvatarURL.replace('.jpg', '.png').replace('.gif', '.png');
let images = [];
images.push(Jimp.read(userAvatar));
images.push(Jimp.read('./images/BobRoss.png'));
+1 -3
View File
@@ -27,9 +27,7 @@ module.exports = class RIPCommand extends Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission('ATTACH_FILES')) return message.say(':x: Error! I don\'t have the Attach Files Permission!');
}
const { user } = args;
let userAvatar = user.displayAvatarURL;
userAvatar = userAvatar.replace('.jpg', '.png');
userAvatar = userAvatar.replace('.gif', '.png');
const userAvatar = user.displayAvatarURL.replace('.jpg', '.png').replace('.gif', '.png');
let images = [];
images.push(Jimp.read(userAvatar));
images.push(Jimp.read('./images/gravestone.jpg'));
+2 -5
View File
@@ -26,10 +26,7 @@ module.exports = class SteamCardCommand extends Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission('ATTACH_FILES')) return message.say(':x: Error! I don\'t have the Attach Files Permission!');
}
const { user } = args;
const userDisplayName = user.username;
let userAvatar = user.displayAvatarURL;
userAvatar = userAvatar.replace('.jpg', '.png');
userAvatar = userAvatar.replace('.gif', '.png');
const userAvatar = user.displayAvatarURL.replace('.jpg', '.png').replace('.gif', '.png');
let images = [];
images.push(Jimp.read(userAvatar));
images.push(Jimp.read('./images/SteamCard.png'));
@@ -39,7 +36,7 @@ module.exports = class SteamCardCommand extends Command {
avatar.resize(450, 450);
nothing.composite(avatar, 25, 25);
nothing.composite(steamcard, 0, 0);
nothing.print(font, 38, 20, userDisplayName);
nothing.print(font, 38, 20, user.username);
nothing.getBuffer(Jimp.MIME_PNG, (err, buff) => {
if (err) return message.say(':x: Error! Something went wrong!');
return message.channel.send({file: {attachment: buff}});
+2 -3
View File
@@ -16,8 +16,7 @@ module.exports = class LotteryCommand extends Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
const lottery = Math.floor(Math.random() * 100) + 1;
const userName = message.author.username;
if (lottery < 100) return message.say(`Nope, sorry ${userName}, you lost.`);
return message.say(`Wow ${userName}! You actually won! Great job!`);
if (lottery < 99) return message.say(`Nope, sorry ${message.author.username}, you lost.`);
return message.say(`Wow ${message.author.username}! You actually won! Great job!`);
}
};
+2 -2
View File
@@ -22,9 +22,9 @@ module.exports = class QuizCommand extends Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return message.say(':x: Error! I don\'t have the Embed Links Permission!');
}
try {
const response = await request
const { body } = await request
.get('http://jservice.io/api/random?count=1');
const data = response.body[0];
const data = body[0];
const answer = data.answer.toLowerCase().replace(/(<i>|<\/i>)/g, '');
const embed = new RichEmbed()
.setTitle('You have **fifteen** seconds to answer this question:')
+3 -4
View File
@@ -19,10 +19,9 @@ module.exports = class SlotsCommand extends Command {
const slotOne = slotThing[Math.floor(Math.random() * slotThing.length)];
const slotTwo = slotThing[Math.floor(Math.random() * slotThing.length)];
const slotThree = slotThing[Math.floor(Math.random() * slotThing.length)];
const slotFour = slotThing[Math.floor(Math.random() * slotThing.length)];
if (slotOne === slotTwo && slotOne === slotThree && slotOne === slotFour) {
return message.say(`${slotOne}|${slotTwo}|${slotThree}|${slotFour}\nWow! You won! Great job... er... luck!`);
if (slotOne === slotTwo && slotOne === slotThree) {
return message.say(`${slotOne}|${slotTwo}|${slotThree}\nWow! You won! Great job... er... luck!`);
}
return message.say(`${slotOne}|${slotTwo}|${slotThree}|${slotFour}\nAww... You lost... Guess it's just bad luck, huh?`);
return message.say(`${slotOne}|${slotTwo}|${slotThree}\nAww... You lost... Guess it's just bad luck, huh?`);
}
};
+3 -3
View File
@@ -21,7 +21,7 @@ module.exports = class MemeCommand extends Command {
if (memecodes.includes(type.toLowerCase())) {
return true;
}
return 'Please enter a valid meme type. Use `;help meme` to view a list of types.';
return `${type.toLowerCase()} is not a valid meme type. Use \`;help meme\` to view a list of types.`;
},
parse: text => {
return text.toLowerCase();
@@ -34,7 +34,7 @@ module.exports = class MemeCommand extends Command {
if (toprow.match(/^[a-zA-Z0-9.,!?'\s]+$/) && toprow.length < 101) {
return true;
}
return 'Please do not use special characters and keep the rows under 100 characters each.';
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');
@@ -47,7 +47,7 @@ module.exports = class MemeCommand extends Command {
if (bottomrow.match(/^[a-zA-Z0-9.,!?'\s]+$/) && bottomrow.length < 101) {
return true;
}
return 'Please do not use special characters and keep the rows under 100 characters each.';
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');
+2 -2
View File
@@ -22,10 +22,10 @@ module.exports = class BanCommand extends Command {
prompt: 'What do you want to set the reason as?',
type: 'string',
validate: reason => {
if (reason.length < 141) {
if (reason.length < 140) {
return true;
}
return 'Please keep your reason under 140 characters.';
return `Please keep your reason under 140 characters, you have ${reason.length}.`;
}
}]
});
+2 -2
View File
@@ -19,10 +19,10 @@ module.exports = class KickCommand extends Command {
prompt: 'What do you want to set the reason as?',
type: 'string',
validate: reason => {
if (reason.length < 141) {
if (reason.length < 140) {
return true;
}
return 'Please keep your reason under 140 characters.';
return `Please keep your reason under 140 characters, you have ${reason.length}.`;
}
}]
});
+1 -1
View File
@@ -17,7 +17,7 @@ module.exports = class LockdownCommand extends Command {
if (type.toLowerCase() === 'start' || type.toLowerCase() === 'stop') {
return true;
}
return 'Please enter either start or stop.';
return 'Please enter either `start` or `stop`.';
},
parse: text => {
return text.toLowerCase();
+1 -1
View File
@@ -29,7 +29,7 @@ module.exports = class PruneCommand extends Command {
if (count < 100 && count > 0) {
return true;
}
return 'Too many or two few messages to delete. Limit 1-99.';
return `${count} is not a valid amount of messages. Limit 1-99.`;
}
}]
});
+3 -3
View File
@@ -21,17 +21,17 @@ module.exports = class UnbanCommand extends Command {
if (userID.length === 18) {
return true;
}
return 'Invalid ID. Please enter the user you wish to unban\'s ID.';
return `${userID} is not a valid ID. Please enter the user you wish to unban's ID.`;
}
}, {
key: 'reason',
prompt: 'What do you want to set the reason as?',
type: 'string',
validate: reason => {
if (reason.length < 141) {
if (reason.length < 140) {
return true;
}
return 'Please keep your reason under 140 characters.';
return `Please keep your reason under 140 characters, you have ${reason.length}.`;
}
}]
});
+2 -2
View File
@@ -19,10 +19,10 @@ module.exports = class WarnCommand extends Command {
prompt: 'What do you want to set the reason as?',
type: 'string',
validate: reason => {
if (reason.length < 141) {
if (reason.length < 140) {
return true;
}
return 'Please keep your reason under 140 characters.';
return `Please keep your reason under 140 characters, you have ${reason.length}.`;
}
}]
});
+13 -8
View File
@@ -18,16 +18,22 @@ module.exports = class StrawpollCommand extends Command {
prompt: 'What would you like the title of the Strawpoll to be?',
type: 'string',
validate: title => {
if (title.length > 200) {
return 'Please limit your title to 200 characters.';
if (title.length < 200) {
return true;
}
return true;
return `Please keep your title under 200 characters, you have ${title.length}.`;
}
}, {
key: 'choices',
prompt: 'What choices do you want me pick from?',
prompt: 'What choices do you want me pick from? Maximum of 31.',
type: 'string',
infinite: true
infinite: true,
validate: choice => {
if (choice.length < 160) {
return true;
}
return `Please keep your choices under 160 characters each, you have ${choice.length}.`;
}
}]
});
}
@@ -40,14 +46,13 @@ module.exports = class StrawpollCommand extends Command {
if (choices.length < 2) return message.say(':x: Error! You provided less than two choices!');
if (choices.length > 31) return message.say(':x: Error! You provided more than thirty choices!');
try {
const response = await request
const { body } = await request
.post('https://strawpoll.me/api/v2/polls')
.send({
title: title,
options: choices
});
const data = response.body;
return message.say(`${data.title}\nhttp://strawpoll.me/${data.id}`);
return message.say(`${body.title}\nhttp://strawpoll.me/${body.id}`);
}
catch (err) {
return message.say(':x: Error! Something went wrong!');
+5 -5
View File
@@ -22,16 +22,16 @@ module.exports = class TodayCommand extends Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return message.say(':x: Error! I don\'t have the Embed Links Permission!');
}
try {
const response = await request
const { text } = await request
.get('http://history.muffinlabs.com/date')
.buffer(true);
const parsedResponse = JSON.parse(response.text);
const events = parsedResponse.data.Events;
const data = JSON.parse(text);
const events = data.data.Events;
const randomNumber = Math.floor(Math.random() * events.length);
const embed = new RichEmbed()
.setColor(0x9797FF)
.setURL(parsedResponse.url)
.setTitle(`On this day (${parsedResponse.date})...`)
.setURL(data.url)
.setTitle(`On this day (${data.date})...`)
.setTimestamp()
.setDescription(`${events[randomNumber].text} (${events[randomNumber].year})`);
return message.embed(embed);
+4 -5
View File
@@ -23,14 +23,13 @@ module.exports = class WouldYouRatherCommand extends Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return message.say(':x: Error! I don\'t have the Embed Links Permission!');
}
try {
const response = await request
const { body } = await request
.get('http://www.rrrather.com/botapi');
const data = response.body;
const embed = new RichEmbed()
.setTitle(`${data.title}...`)
.setURL(data.link)
.setTitle(`${body.title}...`)
.setURL(body.link)
.setColor(0x9797FF)
.setDescription(`${data.choicea} OR ${data.choiceb}?`);
.setDescription(`${body.choicea} OR ${body.choiceb}?`);
return message.embed(embed);
} catch (err) {
return message.say(':x: Error! Something went wrong!');
+7 -8
View File
@@ -30,24 +30,23 @@ module.exports = class BotSearchCommand extends Command {
let { bot } = args;
bot = bot.id;
try {
const response = await request
const { body } = await request
.get(`https://bots.discord.pw/api/bots/${bot}`)
.set({
'Authorization': process.env.DISCORD_BOTS_KEY
});
const data = response.body;
const embed = new RichEmbed()
.setColor(0x9797FF)
.setAuthor('Discord Bots', 'https://cdn.discordapp.com/icons/110373943822540800/47336ad0631ac7aac0a48a2ba6246c65.jpg')
.setTitle(data.name)
.setTitle(body.name)
.setURL('https://bots.discord.pw/')
.setDescription(data.description)
.setDescription(body.description)
.addField('**Library:**',
data.library, true)
.addField('**Prefix:**',
data.prefix, true)
body.library, true)
.addField('**Invite:**',
`[Here](${data.invite_url})`, true);
`[Here](${body.invite_url})`, true)
.addField('**Prefix:**',
body.prefix, true);
return message.embed(embed);
} catch (err) {
return message.say(':x: Error! Bot not Found!');
+2 -2
View File
@@ -34,9 +34,9 @@ module.exports = class DefineCommand extends Command {
}
const { word } = args;
try {
const response = await request
const { body } = await request
.get(`http://api.wordnik.com:80/v4/word.json/${word}/definitions?limit=1&includeRelated=false&useCanonical=false&api_key=${process.env.WORDNIK_KEY}`);
const data = response.body[0];
const data = body[0];
const embed = new RichEmbed()
.setColor(0x9797FF)
.setTitle(data.word)
+1 -1
View File
@@ -21,7 +21,7 @@ module.exports = class DiscrimCommand extends Command {
if (discrim.match(/^[0-9]+$/) && discrim.length === 4) {
return true;
}
return 'Invalid discriminator.';
return `${discrim} is not a valid discriminator.`;
}
}]
});
+2 -2
View File
@@ -28,9 +28,9 @@ module.exports = class ForecastCommand extends Command {
}
const { location } = args;
try {
const response = await request
const { body } = await request
.get(`https://query.yahooapis.com/v1/public/yql?q=select * from weather.forecast where u=\'f\' AND woeid in (select woeid from geo.places(1) where text="${location}")&format=json`);
const info = response.body.query.results.channel;
const info = body.query.results.channel;
const data = info.item.forecast;
const embed = new RichEmbed()
.setColor(0x0000FF)
+2 -2
View File
@@ -32,9 +32,9 @@ module.exports = class GoogleCommand extends Command {
const { query } = args;
const msg = await message.say('Searching...');
try {
const response = await request
const { text } = await request
.get(`https://www.google.com/search?q=${query}`);
const $ = cheerio.load(response.text);
const $ = cheerio.load(text);
let href = $('.r').first().find('a').first().attr('href');
href = querystring.parse(href.replace('/url?', ''));
return msg.edit(href.q);
+13 -13
View File
@@ -9,7 +9,8 @@ module.exports = class IMDBCommand extends Command {
aliases: [
'movie',
'tvshow',
'film'
'film',
'omdb'
],
group: 'search',
memberName: 'imdb',
@@ -33,29 +34,28 @@ module.exports = class IMDBCommand extends Command {
}
const { movie } = args;
try {
const response = await request
const { body } = await request
.get(`http://www.omdbapi.com/?t=${movie}&plot=full`);
const data = response.body;
const embed = new RichEmbed()
.setColor(0xDBA628)
.setAuthor('IMDB', 'http://static.wixstatic.com/media/c65cbf_31901b544fe24f1890134553bf40c8be.png')
.setURL(`http://www.imdb.com/title/${data.imdbID}`)
.setTitle(`${data.Title} (${data.imdbRating} Score)`)
.setDescription(data.Plot.substr(0, 1900))
.setURL(`http://www.imdb.com/title/${body.imdbID}`)
.setTitle(`${body.Title} (${body.imdbRating} Score)`)
.setDescription(body.Plot.substr(0, 2000))
.addField('**Genres:**',
data.Genre)
body.Genre)
.addField('**Year:**',
data.Year, true)
body.Year, true)
.addField('**Rated:**',
data.Rated, true)
body.Rated, true)
.addField('**Runtime:**',
data.Runtime, true)
body.Runtime, true)
.addField('**Directors:**',
data.Director)
body.Director)
.addField('**Writers:**',
data.Writer)
body.Writer)
.addField('**Actors:**',
data.Actors);
body.Actors);
return message.embed(embed);
} catch (err) {
return message.say(':x: Error! Movie not found!');
+2 -2
View File
@@ -40,9 +40,9 @@ module.exports = class MapCommand extends Command {
}
const { zoom, location } = args;
try {
const response = await request
const { body } = await request
.get(`https://maps.googleapis.com/maps/api/staticmap?center=${location}&zoom=${zoom}&size=500x500&key=${process.env.GOOGLE_KEY}`);
return message.channel.send({file: {attachment: response.body}});
return message.channel.send({file: {attachment: body}});
} catch (err) {
return message.say(':x: Error! Something went wrong! Make sure you entered the location correctly!');
}
+2 -2
View File
@@ -28,9 +28,9 @@ module.exports = class NeopetCommand extends Command {
}
const { pet } = args;
try {
const response = await request
const { text } = await request
.get(`http://www.sunnyneo.com/petimagefinder.php?name=${pet}&size=5&mood=1`);
const $ = cheerio.load(response.text);
const $ = cheerio.load(text);
const link = $('textarea').first().text();
if (!link.includes('cp')) return message.say(':x: Error! Pet not found!');
return message.say(link);
+2 -2
View File
@@ -33,9 +33,9 @@ module.exports = class OsuCommand extends Command {
}
const { username } = args;
try {
const response = await request
const { body } = await request
.get(`https://osu.ppy.sh/api/get_user?k=${process.env.OSU_KEY}&u=${username}&type=string`);
const data = response.body[0];
const data = body[0];
const embed = new RichEmbed()
.setColor(0xFF66AA)
.setAuthor('osu!', 'http://vignette3.wikia.nocookie.net/osugame/images/c/c9/Logo.png/revision/latest?cb=20151219073209')
+4 -4
View File
@@ -33,17 +33,17 @@ module.exports = class UrbanCommand extends Command {
}
const { word } = args;
try {
const response = await request
const { body } = await request
.get(`http://api.urbandictionary.com/v0/define?term=${word}`);
const data = response.body.list[0];
const data = body.list[0];
const embed = new RichEmbed()
.setColor(0x32a8f0)
.setAuthor('Urban Dictionary', 'http://a1.mzstatic.com/eu/r30/Purple71/v4/66/54/68/6654683f-cacd-4a55-1784-f14257f77874/icon175x175.png')
.setURL(data.permalink)
.setTitle(data.word)
.setDescription(data.definition.substr(0, 1900))
.setDescription(data.definition.substr(0, 2000))
.addField('**Example:**',
data.example.substr(0, 1900) || 'None');
data.example.substr(0, 2000) || 'None');
return message.embed(embed);
} catch (err) {
return message.say(':x: Error! Word not found!');
+3 -3
View File
@@ -28,18 +28,18 @@ module.exports = class WattpadCommand extends Command {
}
const { book } = args;
try {
const response = await request
const { body } = await request
.get(`https://api.wattpad.com:443/v4/stories?query=${book}&limit=1`)
.set({
'Authorization': `Basic ${process.env.WATTPAD_KEY}`
});
const data = response.body.stories[0];
const data = body.stories[0];
const embed = new RichEmbed()
.setColor(0xF89C34)
.setAuthor('Wattpad', 'http://www.selfpubtoolbox.com/wp-content/uploads/2015/05/a6044fd3a88acd5043860484db972ca6.png')
.setURL(data.url)
.setTitle(data.title)
.setDescription(data.description.substr(0, 1500))
.setDescription(data.description.substr(0, 2000))
.addField('**Author:**',
data.user, true)
.addField('**Parts:**',
+2 -2
View File
@@ -25,9 +25,9 @@ module.exports = class WeatherCommand extends Command {
}
const { location } = args;
try {
const response = await request
const { body } = await request
.get(`https://query.yahooapis.com/v1/public/yql?q=select * from weather.forecast where u=\'f\' AND woeid in (select woeid from geo.places(1) where text="${location}")&format=json`);
const data = response.body.query.results.channel;
const data = body.query.results.channel;
const embed = new RichEmbed()
.setColor(0x0000FF)
.setAuthor(data.title, 'http://media.idownloadblog.com/wp-content/uploads/2013/12/yahoo-weather-213x220.png')
+3 -3
View File
@@ -28,10 +28,10 @@ module.exports = class WikipediaCommand extends Command {
}
const { query } = args;
try {
const response = await request
const { body } = await request
.get(`https://en.wikipedia.org/w/api.php?action=query&prop=extracts&format=json&titles=${query}&exintro=&explaintext=&redirects=&formatversion=2`);
const data = response.body.query.pages[0];
const description = data.extract.substr(0, 1900).split('\n').join('\n\n');
const data = body.query.pages[0];
const description = data.extract.substr(0, 2000).split('\n').join('\n\n');
const embed = new RichEmbed()
.setColor(0xE7E7E7)
.setTitle(data.title)
+2 -2
View File
@@ -31,9 +31,9 @@ module.exports = class YouTubeCommand extends Command {
}
const { video } = args;
try {
const response = await request
const { body } = await request
.get(`https://www.googleapis.com/youtube/v3/search?part=snippet&type=video&maxResults=1&q=${video}&key=${process.env.GOOGLE_KEY}`);
const data = response.body.items[0];
const data = body.items[0];
const embed = new RichEmbed()
.setColor(0xDD2825)
.setTitle(data.snippet.title)
+2 -2
View File
@@ -28,9 +28,9 @@ module.exports = class YuGiOhCommand extends Command {
}
const { card } = args;
try {
const response = await request
const { body } = await request
.get(`http://yugiohprices.com/api/card_data/${card}`);
const data = response.body.data;
const data = body.data;
if (data.card_type === 'monster') {
const embed = new RichEmbed()
.setColor(0xBE5F1F)
+3 -3
View File
@@ -21,10 +21,10 @@ module.exports = class BinaryCommand extends Command {
prompt: 'What text would you like to convert to binary?',
type: 'string',
validate: content => {
if (stringToBinary(content).length > 1950) {
return 'Your message content is too long.';
if (stringToBinary(content).length < 2000) {
return true;
}
return true;
return 'Your message content is too long.';
},
parse: text => {
return stringToBinary(text);
+1 -1
View File
@@ -16,7 +16,7 @@ module.exports = class CowsayCommand extends Command {
if (text.length < 1500) {
return true;
}
return 'Your message content is too long.';
return `Please keep your content under 1500 characters, you have ${text.length}.`;
}
}]
});
+2 -2
View File
@@ -18,10 +18,10 @@ 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 < 1900) {
if (translator.letterTrans(content, dictionary, ' ').length < 1999) {
return true;
}
return 'Your text to encode is too long.';
return 'Your message content is too long.';
},
parse: text => {
return translator.letterTrans(text.toLowerCase(), dictionary, ' ');
+3 -3
View File
@@ -19,10 +19,10 @@ 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 > 1950) {
return 'Your message content is too long.';
if (translator.wordTrans(content, dictionary).length < 1999) {
return true;
}
return true;
return 'Your message content is too long.';
},
parse: text => {
return translator.wordTrans(text, dictionary);
+3 -3
View File
@@ -15,10 +15,10 @@ 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 > 1950) {
return 'Your message content is too long.';
if (translator.wordTrans(content, dictionary).length < 1999) {
return true;
}
return true;
return 'Your message content is too long.';
},
parse: text => {
return translator.wordTrans(text, dictionary);
+3 -3
View File
@@ -14,10 +14,10 @@ module.exports = class ZalgoCommand extends Command {
prompt: 'What text would you like to convert to zalgo?',
type: 'string',
validate: content => {
if (zalgo(content).length > 1950) {
return 'Your message content is too long.';
if (content.length > 500) {
return true;
}
return true;
return `Please keep your text under 500 characters, you have ${content.length}.`;
},
parse: text => {
return zalgo(text);
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiaobot",
"version": "29.0.0",
"version": "30.0.0",
"description": "A Discord Bot",
"main": "shardingmanager.js",
"scripts": {