More Clean-Ups

This commit is contained in:
Daniel Odendahl Jr
2017-04-25 14:04:07 +00:00
parent d779aa5f21
commit 657b7b727d
10 changed files with 15 additions and 12 deletions
+2 -1
View File
@@ -12,7 +12,8 @@ module.exports = class LotteryCommand extends Command {
run(message) {
const lottery = Math.floor(Math.random() * 100) + 1;
if (lottery < 99) return message.say(`Nope, sorry ${message.author.username}, you lost.`);
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!`);
}
};
+1 -2
View File
@@ -62,9 +62,8 @@ module.exports = class MathGameCommand extends Command {
time: 10000,
errors: ['time']
});
if (collected.first().content !== solved.toString()) {
if (collected.first().content !== solved.toString())
return message.say(`Aw... Too bad, try again next time!\nThe correct answer is: ${solved}`);
}
return message.say(`Good Job! You won! ${solved} is the correct answer!`);
} catch (err) {
return message.say(`Aw... Too bad, try again next time!\nThe correct answer is: ${solved}`);
+1 -2
View File
@@ -34,9 +34,8 @@ module.exports = class QuizCommand extends Command {
time: 15000,
errors: ['time']
});
if (collected.first().content.toLowerCase() !== answer) {
if (collected.first().content.toLowerCase() !== answer)
return message.say(`The correct answer is: ${answer}`);
}
return message.say(`Perfect! The correct answer is: ${answer}`);
} catch (err) {
return message.say(`Aw... Too bad, try again next time!\nThe Correct Answer was: ${answer}`);
+1 -2
View File
@@ -63,9 +63,8 @@ module.exports = class TypingGameCommand extends Command {
time: time,
errors: ['time']
});
if (collected.first().content !== sentence) {
if (collected.first().content !== sentence)
return message.say('Nope, your sentence does not match the original. Try again next time!');
}
return message.say(`Good Job! You won!`);
} catch (err) {
return message.say('Aw... Too bad, try again next time!');
+2 -1
View File
@@ -12,6 +12,7 @@ module.exports = class EmojiCommand extends Command {
}
run(message) {
return message.say(message.guild.emojis.map(e => e).join('')).catch(() => message.say(':x: Error! Perhaps you have no custom emoji?'));
return message.say(message.guild.emojis.map(e => e).join(''))
.catch(() => message.say(':x: Error! Perhaps you have no custom emoji?'));
}
};
+2 -1
View File
@@ -48,6 +48,7 @@ module.exports = class MemeCommand 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 { type, toprow, bottomrow } = args;
return message.channel.send({files: [`https://memegen.link/${type}/${toprow}/${bottomrow}.jpg`]});
return message.channel.send({files: [`https://memegen.link/${type}/${toprow}/${bottomrow}.jpg`]})
.catch(() => message.say(':x: Error! Something went wrong!'));
}
};
+2 -1
View File
@@ -20,7 +20,8 @@ module.exports = class MathCommand extends Command {
const { expression } = args;
try {
const solved = math.eval(expression);
return message.say(solved).catch(() => message.say(':x: Error! Invalid statement!'));
return message.say(solved)
.catch(() => message.say(':x: Error! Invalid statement!'));
} catch (err) {
return message.say(':x: Error! Invalid statement!');
}
+1
View File
@@ -27,6 +27,7 @@ module.exports = class GoogleCommand extends Command {
.get(`https://www.google.com/search?q=${query}`);
const $ = cheerio.load(text);
let href = $('.r').first().find('a').first().attr('href');
if (!href) throw new Error('No Results');
href = querystring.parse(href.replace('/url?', ''));
return msg.edit(href.q);
} catch (err) {
+2 -1
View File
@@ -28,7 +28,8 @@ module.exports = class NeopetCommand extends Command {
.get(`http://www.sunnyneo.com/petimagefinder.php?name=${pet}&size=5&mood=1`);
const $ = cheerio.load(text);
const link = $('textarea').first().text();
if (!link.includes('cp')) return message.say(':x: Error! Pet not found!');
if (!link.includes('cp'))
return message.say(':x: Error! Pet not found!');
return message.say(link);
} catch (err) {
return message.say(':x: Error! Something went wrong!');
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiaobot",
"version": "32.0.4",
"version": "32.1.0",
"description": "A Discord Bot",
"main": "shardingmanager.js",
"scripts": {