Make Code Prettier

This commit is contained in:
Daniel Odendahl Jr
2017-05-04 02:40:56 +00:00
parent e5f93b63cb
commit cf87f126d6
71 changed files with 354 additions and 343 deletions
+1 -2
View File
@@ -12,8 +12,7 @@ module.exports = class LotteryCommand extends Command {
run(msg) {
const lottery = Math.floor(Math.random() * 100) + 1;
if (lottery < 99)
return msg.say(`Nope, sorry ${msg.author.username}, you lost.`);
if(lottery < 99) return msg.say(`Nope, sorry ${msg.author.username}, you lost.`);
return msg.say(`Wow ${msg.author.username}! You actually won! Great job!`);
}
};
+6 -6
View File
@@ -17,7 +17,7 @@ module.exports = class MathGameCommand extends Command {
prompt: 'What should the difficulty of the math game be? `Easy`, `Medium`, `Hard`, `Extreme`, or `Impossible`?',
type: 'string',
validate: difficulty => {
if (['easy', 'medium', 'hard', 'extreme', 'impossible'].includes(difficulty.toLowerCase()))
if(['easy', 'medium', 'hard', 'extreme', 'impossible'].includes(difficulty.toLowerCase()))
return true;
return 'Please set the difficulty to either `easy`, `medium`, `hard`, `extreme`, or `impossible`.';
},
@@ -28,13 +28,13 @@ module.exports = class MathGameCommand extends Command {
}
async run(msg, args) {
if (msg.channel.type !== 'dm')
if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
if(msg.channel.type !== 'dm')
if(!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
return msg.say('This Command requires the `Embed Links` Permission.');
const { difficulty } = args;
const operation = operations[Math.floor(Math.random() * operations.length)];
let value;
switch (difficulty) {
switch(difficulty) {
case 'easy':
value = 10;
break;
@@ -63,13 +63,13 @@ module.exports = class MathGameCommand extends Command {
time: 10000,
errors: ['time']
});
if (collected.first().content !== solved)
if(collected.first().content !== solved)
return msg.say(stripIndents`
Aw... Too bad, try again next time!
The correct answer is: ${solved}
`);
return msg.say(`Good Job! You won! ${solved} is the correct answer!`);
} catch (err) {
} catch(err) {
return msg.say(stripIndents`
Aw... Too bad, try again next time!
The correct answer is: ${solved}
+5 -5
View File
@@ -17,8 +17,8 @@ module.exports = class QuizCommand extends Command {
}
async run(msg) {
if (msg.channel.type !== 'dm')
if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
if(msg.channel.type !== 'dm')
if(!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
return msg.say('This Command requires the `Embed Links` Permission.');
try {
const { body } = await request
@@ -37,16 +37,16 @@ module.exports = class QuizCommand extends Command {
time: 15000,
errors: ['time']
});
if (collected.first().content.toLowerCase() !== answer)
if(collected.first().content.toLowerCase() !== answer)
return msg.say(`The correct answer is: ${answer}`);
return msg.say(`Perfect! The correct answer is: ${answer}`);
} catch (err) {
} catch(err) {
return msg.say(stripIndents`
Aw... Too bad, try again next time!
The Correct Answer was: ${answer}
`);
}
} catch (err) {
} catch(err) {
return msg.say('An Unknown Error Occurred.');
}
}
+13 -13
View File
@@ -17,7 +17,7 @@ module.exports = class RockPaperScissorsCommand extends Command {
prompt: '`Rock`, `Paper`, or `Scissors`?',
type: 'string',
validate: choice => {
if (['rock', 'paper', 'scissors'].includes(choice.toLowerCase()))
if(['rock', 'paper', 'scissors'].includes(choice.toLowerCase()))
return true;
return 'Please enter either `rock`, `paper`, or `scissors`.';
},
@@ -30,26 +30,26 @@ module.exports = class RockPaperScissorsCommand extends Command {
run(msg, args) {
const { choice } = args;
const response = responses[Math.floor(Math.random() * responses.length)];
if (choice === 'rock') {
if (response === 'Rock')
if(choice === 'rock') {
if(response === 'Rock')
return msg.say('Rock! Aw, it\'s a tie!');
if (response === 'Paper')
if(response === 'Paper')
return msg.say('Paper! Yes! I win!');
if (response === 'Scissors')
if(response === 'Scissors')
return msg.say('Scissors! Aw... I lose...');
} else if (choice === 'paper') {
if (response === 'Rock')
} else if(choice === 'paper') {
if(response === 'Rock')
return msg.say('Rock! Aw... I lose...');
if (response === 'Paper')
if(response === 'Paper')
return msg.say('Paper! Aw, it\'s a tie!');
if (response === 'Scissors')
if(response === 'Scissors')
return msg.say('Scissors! Yes! I win!');
} else if (choice === 'scissors') {
if (response === 'Rock')
} else if(choice === 'scissors') {
if(response === 'Rock')
return msg.say('Rock! Yes! I win!');
if (response === 'Paper')
if(response === 'Paper')
return msg.say('Paper! Aw... I lose...');
if (response === 'Scissors')
if(response === 'Scissors')
return msg.say('Scissors! Aw, it\'s a tie!');
}
}
+1 -1
View File
@@ -16,7 +16,7 @@ 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)];
if (slotOne === slotTwo && slotOne === slotThree)
if(slotOne === slotTwo && slotOne === slotThree)
return msg.say(stripIndents`
${slotOne}|${slotTwo}|${slotThree}
Wow! You won! Great job... er... luck!
+6 -6
View File
@@ -15,7 +15,7 @@ module.exports = class TypingGameCommand extends Command {
prompt: 'What should the difficulty of the typing game be? `Easy`, `Medium`, `Hard`, `Extreme`, or `Impossible`?',
type: 'string',
validate: difficulty => {
if (['easy', 'medium', 'hard', 'extreme', 'impossible'].includes(difficulty.toLowerCase()))
if(['easy', 'medium', 'hard', 'extreme', 'impossible'].includes(difficulty.toLowerCase()))
return true;
return 'Please set the difficulty to either `easy`, `medium`, `hard`, `extreme`, or `impossible`.';
},
@@ -26,13 +26,13 @@ module.exports = class TypingGameCommand extends Command {
}
async run(msg, args) {
if (msg.channel.type !== 'dm')
if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
if(msg.channel.type !== 'dm')
if(!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
return msg.say('This Command requires the `Embed Links` Permission.');
const { difficulty } = args;
const sentence = sentences[Math.floor(Math.random() * sentences.length)];
let time;
switch (difficulty) {
switch(difficulty) {
case 'easy':
time = 25000;
break;
@@ -59,10 +59,10 @@ module.exports = class TypingGameCommand extends Command {
time: time,
errors: ['time']
});
if (collected.first().content !== sentence)
if(collected.first().content !== sentence)
return msg.say('Nope, your sentence does not match the original. Try again next time!');
return msg.say(`Good Job! You won!`);
} catch (err) {
} catch(err) {
return msg.say('Aw... Too bad, try again next time!');
}
}