Space after conditionals

This commit is contained in:
Daniel Odendahl Jr
2017-05-08 13:46:36 +00:00
parent 7e20086b2a
commit 8ba552b21a
78 changed files with 313 additions and 379 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ module.exports = class ClearSettingCommand extends Command {
prompt: 'What setting do you want to clear? `modLog`, `memberLog`, `joinMsg`, `leaveMsg`, `staffRole`, or `singleRole`?',
type: 'string',
validate: setting => {
if(['modLog', 'memberLog', 'joinMsg', 'leaveMsg', 'staffRole', 'singleRole'].includes(setting)) return true;
if (['modLog', 'memberLog', 'joinMsg', 'leaveMsg', 'staffRole', 'singleRole'].includes(setting)) return true;
return 'Please enter either `modLog`, `memberLog`, `joinMsg`, `leaveMsg`, `staffRole`, or `singleRole`.';
}
}
+6 -8
View File
@@ -6,9 +6,7 @@ module.exports = class HelpCommand extends Command {
constructor(client) {
super(client, {
name: 'help',
aliases: [
'commands'
],
aliases: ['commands'],
group: 'util',
memberName: 'help',
description: 'Displays a list of available commands, or detailed information for a specified command.',
@@ -28,8 +26,8 @@ module.exports = class HelpCommand extends Command {
const { command } = args;
const commands = this.client.registry.findCommands(command, false, msg);
const showAll = command && command.toLowerCase() === 'all';
if(command && !showAll) {
if(commands.length === 1) {
if (command && !showAll) {
if (commands.length === 1) {
return msg.say(stripIndents`
__Command **${commands[0].name}**:__ *${commands[0].description}*
${commands[0].guildOnly ? 'Usable Only in Servers' : 'Usable in Servers and DM'}
@@ -38,7 +36,7 @@ module.exports = class HelpCommand extends Command {
**Group:** ${commands[0].group.name}
${commands[0].details || ''}
`);
} else if(commands.length > 1) {
} else if (commands.length > 1) {
return msg.say(`Multiple Commands Found. Please be more specific: ${commands.map(c => `"${c.name}"`).join(', ')}`);
} else {
return msg.say(`Could not identify command. Use ${msg.usage(null)} to view a list of commands you can use.`);
@@ -48,7 +46,7 @@ module.exports = class HelpCommand extends Command {
.setTitle(!showAll ? `Commands Available in ${msg.guild ? msg.guild.name : 'this DM'}` : 'All Commands')
.setDescription(`Use ${msg.usage('<command>')} to view detailed information about a specific command.`)
.setColor(0x00AE86);
for(const group of this.client.registry.groups.array()) {
for (const group of this.client.registry.groups.array()) {
embed.addField(group.name,
!showAll ?
group.commands.filter(c => c.isUsable(msg)).map(c => `\`${c.name}\``).join(', ') || 'None Available' :
@@ -57,7 +55,7 @@ module.exports = class HelpCommand extends Command {
try {
await msg.author.send({ embed });
return msg.say(':mailbox_with_mail: Sent you a DM with information.');
} catch(err) {
} catch (err) {
return msg.say('Failed to send DM. You probably have DMs disabled.');
}
}
+3 -5
View File
@@ -9,9 +9,7 @@ module.exports = class InfoCommand extends Command {
constructor(client) {
super(client, {
name: 'info',
aliases: [
'information'
],
aliases: ['information'],
group: 'util',
memberName: 'info',
description: 'Gives some bot info for your shard.'
@@ -19,8 +17,8 @@ module.exports = class InfoCommand 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.');
const guilds = await this.client.shard.fetchClientValues('guilds.size');
const memory = await this.client.shard.broadcastEval('Math.round(process.memoryUsage().heapUsed / 1024 / 1024)');
+5 -7
View File
@@ -4,9 +4,7 @@ module.exports = class MemberMsgCommand extends Command {
constructor(client) {
super(client, {
name: 'member-message',
aliases: [
'member-msg'
],
aliases: ['member-msg'],
group: 'util',
memberName: 'member-message',
description: 'Sets the message for either join/leave logs to use.',
@@ -18,7 +16,7 @@ module.exports = class MemberMsgCommand extends Command {
prompt: 'Which message would you like to change? Please enter either `joinMsg` or `leaveMsg`.',
type: 'string',
validate: type => {
if(['joinMsg', 'leaveMsg'].includes(type)) return true;
if (['joinMsg', 'leaveMsg'].includes(type)) return true;
return 'Please enter either `joinMsg` or `leaveMsg`.';
}
},
@@ -27,7 +25,7 @@ module.exports = class MemberMsgCommand extends Command {
prompt: 'What should be sent to the channel? Use <user>, <server>, and <mention> as placeholders.',
type: 'string',
validate: message => {
if(message.length < 1000) return true;
if (message.length < 1000) return true;
return 'Invalid Message. Message must be under 1000 characters.';
}
}
@@ -41,10 +39,10 @@ module.exports = class MemberMsgCommand extends Command {
run(msg, args) {
const { type, message } = args;
if(type === 'joinMsg') {
if (type === 'joinMsg') {
msg.guild.settings.set('joinMsg', message);
return msg.say(`Join Message set to "${message}".`);
} else if(type === 'leaveMsg') {
} else if (type === 'leaveMsg') {
msg.guild.settings.set('leaveMsg', message);
return msg.say(`Leave Message set to "${message}".`);
}
+4 -6
View File
@@ -7,9 +7,7 @@ module.exports = class ShardInfoCommand extends Command {
constructor(client) {
super(client, {
name: 'shard-info',
aliases: [
'shard'
],
aliases: ['shard'],
group: 'util',
memberName: 'shard-info',
description: 'Gives some bot info for the Shard you specify.',
@@ -19,7 +17,7 @@ module.exports = class ShardInfoCommand extends Command {
prompt: 'Which Shard would you like to get data for?',
type: 'integer',
validate: shard => {
if(shard < this.client.options.shardCount && shard > -1) return true;
if (shard < this.client.options.shardCount && shard > -1) return true;
return 'Invalid Shard ID';
}
}
@@ -28,8 +26,8 @@ module.exports = class ShardInfoCommand 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 { shard } = args;
const memory = await this.client.shard.broadcastEval('Math.round(process.memoryUsage().heapUsed / 1024 / 1024)');