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
+9 -11
View File
@@ -6,9 +6,7 @@ module.exports = class BanCommand extends Command {
constructor(client) {
super(client, {
name: 'ban',
aliases: [
'banne'
],
aliases: ['banne'],
group: 'moderation',
memberName: 'ban',
description: 'Bans a user and logs the ban to the mod logs.',
@@ -24,7 +22,7 @@ module.exports = class BanCommand extends Command {
prompt: 'What do you want to set the reason as?',
type: 'string',
validate: reason => {
if(reason.length < 140) return true;
if (reason.length < 140) return true;
return 'Invalid Reason. Reason must be under 140 characters.';
}
}
@@ -37,23 +35,23 @@ module.exports = class BanCommand extends Command {
}
async run(msg, args) {
if(!msg.channel.permissionsFor(this.client.user).has('BAN_MEMBERS'))
if (!msg.channel.permissionsFor(this.client.user).has('BAN_MEMBERS'))
return msg.say('This Command requires the `Ban Members` Permission.');
const modlogs = msg.guild.channels.get(msg.guild.settings.get('modLog'));
if(!modlogs) return msg.say('This Command requires a channel set with the `modchannel` command.');
if(!modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES'))
if (!modlogs) return msg.say('This Command requires a channel set with the `modchannel` command.');
if (!modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES'))
return msg.say('This Command requires the `Send Messages` Permission for the Mod Log Channel.');
if(!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS'))
if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS'))
return msg.say('This Command requires the `Embed Links` Permission.');
const { member, reason } = args;
if(!member.bannable) return msg.say('This member is not bannable. Perhaps they have a higher role than me?');
if (!member.bannable) return msg.say('This member is not bannable. Perhaps they have a higher role than me?');
try {
try {
await member.send(stripIndents`
You were banned from ${msg.guild.name}!
Reason: ${reason}.
`);
} catch(err) {
} catch (err) {
await msg.say('Failed to send DM to the user.');
}
await member.ban({ days: 7, reason });
@@ -68,7 +66,7 @@ module.exports = class BanCommand extends Command {
**Reason:** ${reason}
`);
return modlogs.send({ embed });
} catch(err) {
} catch (err) {
return msg.say(`An Error Occurred: ${err}`);
}
}
+8 -8
View File
@@ -21,7 +21,7 @@ module.exports = class KickCommand extends Command {
prompt: 'What do you want to set the reason as?',
type: 'string',
validate: reason => {
if(reason.length < 140) return true;
if (reason.length < 140) return true;
return 'Invalid Reason. Reason must be under 140 characters.';
}
}
@@ -34,23 +34,23 @@ module.exports = class KickCommand extends Command {
}
async run(msg, args) {
if(!msg.channel.permissionsFor(this.client.user).has('KICK_MEMBERS'))
if (!msg.channel.permissionsFor(this.client.user).has('KICK_MEMBERS'))
return msg.say('This Command requires the `Kick Members` Permission.');
const modlogs = msg.guild.channels.get(msg.guild.settings.get('modLog'));
if(!modlogs) return msg.say('This Command requires a channel set with the `modchannel` command.');
if(!modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES'))
if (!modlogs) return msg.say('This Command requires a channel set with the `modchannel` command.');
if (!modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES'))
return msg.say('This Command requires the `Send Messages` Permission for the Mod Log Channel.');
if(!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS'))
if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS'))
return msg.say('This Command requires the `Embed Links` Permission.');
const { member, reason } = args;
if(!member.kickable) return msg.say('This member is not kickable. Perhaps they have a higher role than me?');
if (!member.kickable) return msg.say('This member is not kickable. Perhaps they have a higher role than me?');
try {
try {
await member.send(stripIndents`
You were kicked from ${msg.guild.name}!
Reason: ${reason}.
`);
} catch(err) {
} catch (err) {
await msg.say('Failed to send DM.');
}
await member.kick({ reason });
@@ -65,7 +65,7 @@ module.exports = class KickCommand extends Command {
**Reason:** ${reason}
`);
return modlogs.send({ embed });
} catch(err) {
} catch (err) {
return msg.say(`An Error Occurred: ${err}`);
}
}
+6 -6
View File
@@ -15,7 +15,7 @@ module.exports = class LockdownCommand extends Command {
prompt: 'Please enter either `start` or `stop`.',
type: 'string',
validate: type => {
if(['start', 'stop'].includes(type.toLowerCase())) return true;
if (['start', 'stop'].includes(type.toLowerCase())) return true;
return 'Please enter either `start` or `stop`.';
},
parse: type => type.toLowerCase()
@@ -29,24 +29,24 @@ module.exports = class LockdownCommand extends Command {
}
async run(msg, args) {
if(!msg.channel.permissionsFor(this.client.user).has('ADMINISTRATOR'))
if (!msg.channel.permissionsFor(this.client.user).has('ADMINISTRATOR'))
return msg.say('This Command requires the `Administrator` Permission.');
const { type } = args;
if(type === 'start') {
if (type === 'start') {
try {
await msg.channel.overwritePermissions(msg.guild.defaultRole, { SEND_MESSAGES: false });
return msg.say(stripIndents`
Lockdown Started, users without Administrator can no longer post messages.
Please use \`lockdown stop\` to end the lockdown.
`);
} catch(err) {
} catch (err) {
return msg.say(`An Error Occurred: ${err}`);
}
} else if(type === 'stop') {
} else if (type === 'stop') {
try {
await msg.channel.overwritePermissions(msg.guild.defaultRole, { SEND_MESSAGES: true });
return msg.say('Lockdown Ended, users without Administrator can now post messages.');
} catch(err) {
} catch (err) {
return msg.say(`An Error Occurred: ${err}`);
}
}
+4 -4
View File
@@ -19,7 +19,7 @@ module.exports = class PruneCommand extends Command {
prompt: 'How many messages do you want to delete? Limit of up to 99.',
type: 'integer',
validate: count => {
if(count < 100 && count > 0) return true;
if (count < 100 && count > 0) return true;
return 'Invalid Count. Count must be from 1-99.';
}
}
@@ -32,16 +32,16 @@ module.exports = class PruneCommand extends Command {
}
async run(msg, args) {
if(!msg.channel.permissionsFor(this.client.user).has('READ_MESSAGE_HISTORY'))
if (!msg.channel.permissionsFor(this.client.user).has('READ_MESSAGE_HISTORY'))
return msg.say('This Command requires the `Read Message History` Permission.');
if(!msg.channel.permissionsFor(this.client.user).has('MANAGE_MESSAGES'))
if (!msg.channel.permissionsFor(this.client.user).has('MANAGE_MESSAGES'))
return msg.say('This Command requires the `Manage Messages` Permission.');
const { count } = args;
try {
const messages = await msg.channel.fetchMessages({ limit: count + 1 });
await msg.channel.bulkDelete(messages, true);
return null;
} catch(err) {
} catch (err) {
return msg.say('There are no messages younger than two weeks that can be deleted.');
}
}
+10 -9
View File
@@ -6,6 +6,7 @@ module.exports = class SoftbanCommand extends Command {
constructor(client) {
super(client, {
name: 'softban',
aliases: ['softbanne'],
group: 'moderation',
memberName: 'softban',
description: 'Kicks a user and deletes their messages, and logs the softban to the mod logs.',
@@ -21,7 +22,7 @@ module.exports = class SoftbanCommand extends Command {
prompt: 'What do you want to set the reason as?',
type: 'string',
validate: reason => {
if(reason.length < 140) return true;
if (reason.length < 140) return true;
return 'Invalid Reason. Reason must be under 140 characters.';
}
}
@@ -34,25 +35,25 @@ module.exports = class SoftbanCommand extends Command {
}
async run(msg, args) {
if(!msg.channel.permissionsFor(this.client.user).has('BAN_MEMBERS'))
if (!msg.channel.permissionsFor(this.client.user).has('BAN_MEMBERS'))
return msg.say('This Command requires the `Ban Members` Permission.');
if(!msg.channel.permissionsFor(this.client.user).has('KICK_MEMBERS'))
if (!msg.channel.permissionsFor(this.client.user).has('KICK_MEMBERS'))
return msg.say('This Command requires the `Kick Members` Permission.');
const modlogs = msg.guild.channels.get(msg.guild.settings.get('modLog'));
if(!modlogs) return msg.say('This Command requires a channel set with the `modchannel` command.');
if(!modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES'))
if (!modlogs) return msg.say('This Command requires a channel set with the `modchannel` command.');
if (!modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES'))
return msg.say('This Command requires the `Send Messages` Permission for the Mod Log Channel.');
if(!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS'))
if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS'))
return msg.say('This Command requires the `Embed Links` Permission.');
const { member, reason } = args;
if(!member.bannable) return msg.say('This member is not bannable. Perhaps they have a higher role than me?');
if (!member.bannable) return msg.say('This member is not bannable. Perhaps they have a higher role than me?');
try {
try {
await member.send(stripIndents`
You were softbanned from ${msg.guild.name}!
Reason: ${reason}.
`);
} catch(err) {
} catch (err) {
await msg.say('Failed to send DM to user.');
}
await member.ban({ days: 7, reason });
@@ -68,7 +69,7 @@ module.exports = class SoftbanCommand extends Command {
**Reason:** ${reason}
`);
return modlogs.send({ embed });
} catch(err) {
} catch (err) {
return msg.say(`An Error Occurred: ${err}`);
}
}
+9 -11
View File
@@ -6,9 +6,7 @@ module.exports = class UnbanCommand extends Command {
constructor(client) {
super(client, {
name: 'unban',
aliases: [
'unbanne'
],
aliases: ['unbanne'],
group: 'moderation',
memberName: 'unban',
description: 'Unbans a user and logs the unban to the mod logs.',
@@ -19,7 +17,7 @@ module.exports = class UnbanCommand extends Command {
prompt: 'What member do you want to unban? Please enter the ID of the user.',
type: 'string',
validate: id => {
if(id.length === 18) return true;
if (id.length === 18) return true;
return 'Invalid ID.';
}
},
@@ -28,7 +26,7 @@ module.exports = class UnbanCommand extends Command {
prompt: 'What do you want to set the reason as?',
type: 'string',
validate: reason => {
if(reason.length < 140) return true;
if (reason.length < 140) return true;
return 'Invalid Reason. Reason must be under 140 characters.';
}
}
@@ -41,17 +39,17 @@ module.exports = class UnbanCommand extends Command {
}
async run(msg, args) {
if(!msg.channel.permissionsFor(this.client.user).has('BAN_MEMBERS'))
if (!msg.channel.permissionsFor(this.client.user).has('BAN_MEMBERS'))
return msg.say('This Command requires the `Ban Members` Permission.');
const modlogs = msg.guild.channels.get(msg.guild.settings.get('modLog'));
if(!modlogs) return msg.say('This Command requires a channel set with the `modchannel` command.');
if(!modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES'))
if (!modlogs) return msg.say('This Command requires a channel set with the `modchannel` command.');
if (!modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES'))
return msg.say('This Command requires the `Send Messages` Permission for the Mod Log Channel.');
if(!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS'))
if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS'))
return msg.say('This Command requires the `Embed Links` Permission.');
const { id, reason } = args;
const bans = await msg.guild.fetchBans();
if(!bans.has(id)) return msg.say('This ID is not in the Guild Banlist.');
if (!bans.has(id)) return msg.say('This ID is not in the Guild Banlist.');
const member = bans.get(id);
try {
await msg.guild.unban(member);
@@ -66,7 +64,7 @@ module.exports = class UnbanCommand extends Command {
**Reason:** ${reason}
`);
return modlogs.send({ embed });
} catch(err) {
} catch (err) {
return msg.say(`An Error Occurred: ${err}`);
}
}
+5 -5
View File
@@ -21,7 +21,7 @@ module.exports = class WarnCommand extends Command {
prompt: 'What do you want to set the reason as?',
type: 'string',
validate: reason => {
if(reason.length < 140) return true;
if (reason.length < 140) return true;
return 'Invalid Reason. Reason must be under 140 characters.';
}
}
@@ -35,10 +35,10 @@ module.exports = class WarnCommand extends Command {
async run(msg, args) {
const modlogs = msg.guild.channels.get(msg.guild.settings.get('modLog'));
if(!modlogs) return msg.say('This Command requires a channel set with the `modchannel` command.');
if(!modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES'))
if (!modlogs) return msg.say('This Command requires a channel set with the `modchannel` command.');
if (!modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES'))
return msg.say('This Command requires the `Send Messages` Permission for the Mod Log Channel.');
if(!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS'))
if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS'))
return msg.say('This Command requires the `Embed Links` Permission.');
const { member, reason } = args;
try {
@@ -53,7 +53,7 @@ module.exports = class WarnCommand extends Command {
**Reason:** ${reason}
`);
return modlogs.send({ embed });
} catch(err) {
} catch (err) {
return msg.say(`An Error Occurred: ${err}`);
}
}