Skip to content
This repository was archived by the owner on Nov 19, 2017. It is now read-only.

Commit 00cf76f

Browse files
committed
A lot of style changes
1 parent 29b757a commit 00cf76f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+229
-129
lines changed

Commando.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ client.setProvider(new SequelizeProvider(Database.db));
3535
client.dispatcher.addInhibitor(msg => {
3636
const blacklist = client.provider.get('global', 'userBlacklist', []);
3737
if (!blacklist.includes(msg.author.id)) return false;
38-
return `User ${msg.author.username}#${msg.author.discriminator} (${msg.author.id}) has been blacklisted.`;
38+
return `User ${msg.author.tag} (${msg.author.id}) has been blacklisted.`;
3939
});
4040

4141
client.on('error', winston.error)
@@ -49,7 +49,7 @@ client.on('error', winston.error)
4949
.on('disconnect', () => winston.warn('Disconnected!'))
5050
.on('reconnect', () => winston.warn('Reconnecting...'))
5151
.on('commandRun', (cmd, promise, msg, args) => {
52-
winston.info(oneLine`${msg.author.username}#${msg.author.discriminator} (${msg.author.id})
52+
winston.info(oneLine`${msg.author.tag} (${msg.author.id})
5353
> ${msg.guild ? `${msg.guild.name} (${msg.guild.id})` : 'DM'}
5454
>> ${cmd.groupID}:${cmd.memberName}
5555
${Object.values(args)[0] !== '' || [] ? `>>> ${Object.values(args)}` : ''}
@@ -107,7 +107,7 @@ client.on('error', winston.error)
107107
const isAuthor = await Starboard.isAuthor(message.id, user.id);
108108
if (isAuthor || message.author.id === user.id) return message.channel.send(`${user}, you can't star your own messages.`); // eslint-disable-line consistent-return, max-len
109109
const hasStarred = await Starboard.hasStarred(message.id, user.id);
110-
if (hasStarred) return message.channel.send(`${user}, you've already starred this message.`); // eslint-disable-line consistent-return, max-len
110+
if (hasStarred) return; // eslint-disable-line consistent-return, max-len
111111
const isStarred = await Starboard.isStarred(message.id);
112112
if (isStarred) return Starboard.addStar(message, starboard, user.id); // eslint-disable-line consistent-return
113113
Starboard.createStar(message, starboard, user.id);
@@ -118,7 +118,7 @@ client.on('error', winston.error)
118118
const starboard = message.guild.channels.find('name', 'starboard');
119119
if (!starboard) return message.channel.send(`${user}, you can't unstar things without a #starboard...`); // eslint-disable-line consistent-return, max-len
120120
const hasStarred = await Starboard.hasStarred(message.id, user.id);
121-
if (!hasStarred) return message.channel.send(`${user}, you never starred this message.`); // eslint-disable-line consistent-return, max-len
121+
if (!hasStarred) return; // eslint-disable-line consistent-return, max-len
122122
Starboard.removeStar(message, starboard, user.id);
123123
})
124124
.on('unknownCommand', msg => {
@@ -135,7 +135,7 @@ client.on('error', winston.error)
135135
.on('commandBlocked', (msg, reason) => {
136136
winston.info(oneLine`
137137
Command ${msg.command ? `${msg.command.groupID}:${msg.command.memberName}` : ''}
138-
blocked; User ${msg.author.username}#${msg.author.discriminator} (${msg.author.id}): ${reason}
138+
blocked; User ${msg.author.tag} (${msg.author.id}): ${reason}
139139
`);
140140
})
141141
.on('commandPrefixChange', (guild, prefix) => {

commands/economy/add.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ module.exports = class MoneyAddCommand extends Command {
5050
run(msg, args) {
5151
const { member, donuts } = args;
5252
Currency._changeBalance(member.id, donuts);
53+
5354
return msg.reply(`successfully added ${Currency.convert(donuts)} to ${member.displayName}'s balance.`);
5455
}
5556
};

commands/economy/daily-random.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ module.exports = class DailyRandomCommand extends Command {
2222
}
2323

2424
async run(msg) {
25-
const received = await Daily.received(msg.author.id);
2625
const guild = await msg.guild.fetchMembers();
2726
const member = guild.members.filter(mem => mem.presence.status === 'online' && !mem.user.bot).random();
27+
const received = await Daily.received(msg.author.id);
2828

2929
if (received) {
3030
const nextDaily = await Daily.nextDaily(msg.author.id);
@@ -35,6 +35,7 @@ module.exports = class DailyRandomCommand extends Command {
3535
}
3636

3737
Daily.receive(msg.author.id, member.id);
38+
3839
return msg.reply(oneLine`
3940
${member.displayName}#${member.user.discriminator} (${member.id}) has successfully received your daily
4041
${Currency.convert(Daily.dailyDonationPayout)}.

commands/economy/daily.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@ module.exports = class DailyCommand extends Command {
3030
}
3131

3232
async run(msg, args) {
33-
const received = await Daily.received(msg.author.id);
3433
const member = args.member || msg.member;
35-
34+
const received = await Daily.received(msg.author.id);
3635
if (received) {
3736
const nextDaily = await Daily.nextDaily(msg.author.id);
3837
return msg.reply(stripIndents`
@@ -49,6 +48,7 @@ module.exports = class DailyCommand extends Command {
4948
}
5049

5150
Daily.receive(msg.author.id);
51+
5252
return msg.reply(`You have successfully received your daily ${Currency.convert(Daily.dailyPayout)}.`);
5353
}
5454
};

commands/economy/deposit.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ module.exports = class DepositCommand extends Command {
2828
const balance = await Currency.getBalance(msg.author.id);
2929

3030
if (['all', '-all', '-a'].includes(donuts)) return parseInt(balance);
31+
3132
return parseInt(donuts);
3233
}
3334
}
@@ -37,7 +38,6 @@ module.exports = class DepositCommand extends Command {
3738

3839
async run(msg, args) {
3940
const { donuts } = args;
40-
4141
if (donuts <= 0) return msg.reply(`you can't deposit 0 or less ${Currency.convert(0)}.`);
4242

4343
const userBalance = await Currency.getBalance(msg.author.id);
@@ -49,6 +49,7 @@ module.exports = class DepositCommand extends Command {
4949
}
5050

5151
Bank.deposit(msg.author.id, donuts);
52+
5253
return msg.reply(`successfully deposited ${Currency.convert(donuts)} to the bank!`);
5354
}
5455
};

commands/economy/leaderboard.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ module.exports = class MoneyLeaderboardCommand extends Command {
8282

8383
redis.db.setAsync('moneyleaderboard', JSON.stringify(money));
8484
redis.db.expire('moneyleaderboard', 3600);
85+
8586
return JSON.stringify(money);
8687
}
8788
};

commands/economy/lock-all.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ module.exports = class LockAllCommand extends Command {
2727
const channelLocks = this.client.provider.get(msg.guild.id, 'locks', []);
2828
for (const channel of channels.values()) {
2929
if (channelLocks.includes(channel.id)) continue;
30-
3130
channelLocks.push(channel.id);
3231
}
3332

3433
this.client.provider.set(msg.guild.id, 'locks', channelLocks);
34+
3535
return msg.reply(stripIndents`
3636
all channels on this server have been locked. You can no longer earn xp or ${Currency.textPlural} anywhere.
3737
`);

commands/economy/lock.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ module.exports = class LockCommand extends Command {
4040

4141
channelLocks.push(channel.id);
4242
this.client.provider.set(msg.guild.id, 'locks', channelLocks);
43+
4344
return msg.reply(stripIndents`
4445
this channel has been locked. You can no longer earn xp or ${Currency.textPlural} in ${channel}.
4546
`);

commands/economy/remove.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ module.exports = class MoneyRemoveCommand extends Command {
5050
run(msg, args) {
5151
const { member, donuts } = args;
5252
Currency._changeBalance(member.id, donuts);
53+
5354
return msg.reply(`successfully removed ${Currency.convert(donuts)} from ${member.displayName}'s balance.`);
5455
}
5556
};

commands/economy/trade.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ module.exports = class MoneyTradeCommand extends Command {
4444
const balance = await Currency.getBalance(msg.author.id);
4545

4646
if (['all', '-all', '-a'].includes(donuts)) return parseInt(balance);
47+
4748
return parseInt(donuts);
4849
}
4950
}
@@ -53,7 +54,6 @@ module.exports = class MoneyTradeCommand extends Command {
5354

5455
async run(msg, args) {
5556
const { member, donuts } = args;
56-
5757
if (member.id === msg.author.id) return msg.reply(`you can't trade ${Currency.textPlural} with yourself, ya dingus.`); // eslint-disable-line
5858
if (member.user.bot) return msg.reply(`don't give your ${Currency.textPlural} to bots: they're bots, man.`);
5959
if (donuts <= 0) return msg.reply(`you can't trade 0 or less ${Currency.convert(0)}.`);
@@ -68,6 +68,7 @@ module.exports = class MoneyTradeCommand extends Command {
6868

6969
Currency.removeBalance(msg.author.id, donuts);
7070
Currency.addBalance(member.id, donuts);
71+
7172
return msg.reply(`${member.displayName} successfully received your ${Currency.convert(donuts)}!`);
7273
}
7374
};

commands/economy/unlock-all.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ module.exports = class UnlockAllCommand extends Command {
2424

2525
run(msg) {
2626
this.client.provider.set(msg.guild.id, 'locks', []);
27+
2728
return msg.reply(stripIndents`
2829
the lock on all channels has been lifted.
2930
You can now earn xp and ${Currency.textPlural} on the entire server again.

commands/economy/unlock.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ module.exports = class UnlockCommand extends Command {
4343
const index = channelLocks.indexOf(channel.id);
4444
channelLocks.splice(index, 1);
4545
this.client.provider.set(msg.guild.id, 'locks', channelLocks);
46+
4647
return msg.reply(stripIndents`
4748
the channel lock has been lifted. You can now earn xp and ${Currency.textPlural} in ${channel} again.
4849
`);

commands/economy/withdraw.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ module.exports = class WidthdrawCommand extends Command {
2828
const balance = await Bank.getBalance(msg.author.id);
2929

3030
if (['all', '-all', '-a'].includes(donuts)) return parseInt(balance);
31+
3132
return parseInt(donuts);
3233
}
3334
}
@@ -56,6 +57,7 @@ module.exports = class WidthdrawCommand extends Command {
5657
}
5758

5859
Bank.withdraw(msg.author.id, donuts);
60+
5961
return msg.reply(`successfully withdrew ${Currency.convert(donuts)} from the bank!`);
6062
}
6163
};

commands/games/blackjack.js

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,18 @@ module.exports = class BlackjackCommand extends Command {
2626
validate: async (bet, msg) => {
2727
bet = parseInt(bet);
2828
const balance = await Currency.getBalance(msg.author.id);
29-
3029
if (balance < bet) {
3130
return `
3231
you don't have enough ${Currency.textPlural}.
3332
Your current account balance is ${Currency.convert(balance)}.
3433
Please specify a valid amount of ${Currency.textPlural}.
3534
`;
3635
}
37-
3836
if (![100, 200, 300, 400, 500, 1000].includes(bet)) {
3937
return `
4038
please choose \`100, 200, 300, 400, 500, 1000\` for your bet.
4139
`;
4240
}
43-
4441
return true;
4542
}
4643
}
@@ -50,13 +47,11 @@ module.exports = class BlackjackCommand extends Command {
5047

5148
run(msg, args) {
5249
const { bet } = args;
53-
5450
if (Blackjack.gameExists(msg.author.id)) {
5551
return msg.reply(`you can't start 2 games of blackjack at the same time.`);
5652
}
5753

5854
const blackjack = new Blackjack(msg);
59-
6055
return msg.say(
6156
`New game of blackjack started with ${msg.member.displayName} with a bet of ${Currency.convert(bet)}!`
6257
).then(async () => {
@@ -137,6 +132,7 @@ module.exports = class BlackjackCommand extends Command {
137132
? 'won' : 'lost'} ${Currency.convert(Math.abs(winnings))}`}`;
138133

139134
if (winnings !== 0) Currency.changeBalance(msg.author.id, winnings);
135+
140136
return msg.embed(embed);
141137
});
142138
}
@@ -146,6 +142,7 @@ module.exports = class BlackjackCommand extends Command {
146142
if (dealerValue > 21) return 'dealer bust';
147143
if (playerValue === dealerValue) return 'push';
148144
if (playerValue === 'Blackjack' || playerValue > dealerValue) return 'win';
145+
149146
return 'loss';
150147
}
151148

@@ -155,21 +152,17 @@ module.exports = class BlackjackCommand extends Command {
155152
let currentHand = hands[0];
156153
let totalBet = bet;
157154

158-
const nextHand = () => { currentHand = hands[hands.indexOf(currentHand) + 1]; };
159-
155+
const nextHand = () => currentHand = hands[hands.indexOf(currentHand) + 1]; // eslint-disable-line no-return-assign, max-len
160156
while (currentHand) { // eslint-disable-line no-unmodified-loop-condition
161157
if (currentHand.length === 1) blackjack.hit(currentHand);
162-
163158
if (Blackjack.handValue(currentHand) === 'Blackjack') {
164159
nextHand();
165160
continue;
166161
}
167-
168162
if (Blackjack.handValue(currentHand) >= 21) {
169163
nextHand();
170164
continue;
171165
}
172-
173166
if (currentHand.doubled) {
174167
blackjack.hit(currentHand);
175168
nextHand();
@@ -228,9 +221,7 @@ module.exports = class BlackjackCommand extends Command {
228221
});
229222

230223
if (responses.size === 0) break;
231-
232224
const action = responses.first().content.toLowerCase();
233-
234225
if (action === 'stand' || Blackjack.handValue(currentHand) >= 21) {
235226
if (currentHand === hands[hands.length - 1]) break;
236227
nextHand();
@@ -246,6 +237,7 @@ module.exports = class BlackjackCommand extends Command {
246237
currentHand.doubled = true;
247238
}
248239
}
240+
249241
return resolve(hands);
250242
});
251243
}

commands/games/roulette-info.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ module.exports = class RouletteInfo extends Command {
4141
\`roulette 300 2nd\`
4242
\`roulette 200 odd\`
4343
`,
44-
image: { url: 'https://a.cuntflaps.me/lcfoa.png' }
44+
image: { url: 'https://a.safe.moe/lcfoa.png' }
4545
});
4646
}
4747
};

commands/games/roulette.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ module.exports = class RouletteCommand extends Command {
3232
validate: async (bet, msg) => {
3333
bet = parseInt(bet);
3434
const balance = await Currency.getBalance(msg.author.id);
35-
3635
if (balance < bet) {
3736
return `
3837
you don't have enough ${Currency.textPlural} to bet.
@@ -72,12 +71,10 @@ module.exports = class RouletteCommand extends Command {
7271
run(msg, args) {
7372
const { bet, space } = args;
7473
let roulette = Roulette.findGame(msg.guild.id);
75-
7674
if (roulette) {
7775
if (roulette.hasPlayer(msg.author.id)) {
7876
return msg.reply('you have already put a bet in this game of roulette.');
7977
}
80-
8178
roulette.join(msg.author, bet, space);
8279
Currency.removeBalance(msg.author.id, bet);
8380

@@ -98,7 +95,6 @@ module.exports = class RouletteCommand extends Command {
9895
setTimeout(() => msg.say('The roulette starts spinning!'), 14500);
9996

10097
const winners = await roulette.awaitPlayers(16000).filter(player => player.winnings !== 0);
101-
10298
winners.forEach(winner => Currency.changeBalance(winner.user.id, winner.winnings));
10399

104100
return msg.embed({

commands/games/russian-roulette.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ module.exports = class RussianRouletteCommand extends Command {
2525
const donuts = 120;
2626
const balance = await Currency.getBalance(msg.author.id);
2727
let roulette = RussianRoulette.findGame(msg.guild.id);
28-
2928
if (balance < donuts) {
3029
return msg.reply(stripIndents`
3130
you don't have enough ${Currency.textPlural}.
@@ -38,11 +37,13 @@ module.exports = class RussianRouletteCommand extends Command {
3837
if (roulette.hasPlayer(msg.author.id)) {
3938
return msg.reply('you have already joined this game of russian roulette.');
4039
}
40+
4141
if (roulette.players.length === 6) {
4242
return msg.reply('only 6 people can join at a time. You\'ll have to wait for the next round');
4343
}
4444

4545
roulette.join(msg.author, donuts);
46+
4647
return msg.reply('you have successfully joined the game.');
4748
}
4849

@@ -57,12 +58,9 @@ module.exports = class RussianRouletteCommand extends Command {
5758
Use the ${msg.usage()} command in the next 15 seconds to join!
5859
`).then(async () => {
5960
setTimeout(() => msg.say('5 more seconds for new people to join'), 10000);
60-
setTimeout(() => {
61-
if (roulette.players.length > 1) msg.say('The game begins!');
62-
}, 14500);
61+
setTimeout(() => { if (roulette.players.length > 1) msg.say('The game begins!'); }, 14500);
6362

6463
const players = await roulette.awaitPlayers(15000);
65-
6664
if (players.length === 1) {
6765
return msg.say('Seems like no one else wanted to join. Ah well, maybe another time.');
6866
}
@@ -76,7 +74,6 @@ module.exports = class RussianRouletteCommand extends Command {
7674
}
7775

7876
survivors = players.filter(player => player !== deadPlayer);
79-
8077
Currency.removeBalance(deadPlayer.user.id, donuts);
8178
survivors.forEach(survivor => Currency.addBalance(survivor.user.id, donuts / survivors.length));
8279

@@ -95,6 +92,7 @@ module.exports = class RussianRouletteCommand extends Command {
9592
generateBarrel() {
9693
let barrel = [0, 0, 0, 0, 0, 0];
9794
barrel[Math.floor(Math.random() * barrel.length)] = 1;
95+
9896
return barrel;
9997
}
10098
};

0 commit comments

Comments
 (0)